浏览代码

兼容滚动相关性

Karsa 2 年之前
父节点
当前提交
5eb3d27daa
共有 3 个文件被更改,包括 14 次插入24 次删除
  1. 0 1
      src/components/chart.vue
  2. 12 21
      src/views/chartShow/index.vue
  3. 2 2
      src/views/sheetShow/index.vue

+ 0 - 1
src/components/chart.vue

@@ -8,7 +8,6 @@ import { defineComponent, ref, watch, onMounted, PropType } from 'vue';
 import Highcharts from 'highcharts/highstock';
 import HighchartszhCN from '@/utils/highcahrts-zh_CN';
 import { defaultOpts } from '@/utils/chartOptions';
-import { log } from 'util';
 
 HighchartszhCN(Highcharts);
 

+ 12 - 21
src/views/chartShow/index.vue

@@ -164,7 +164,8 @@ export default defineComponent({
 
         const sourceTypeMap = {
           2: initCommodityData,
-          3: initRelevanceChartData
+          3: initRelevanceChartData,
+          4: initRelevanceChartData
         }
         sourceTypeMap[Data.ChartInfo.Source] && sourceTypeMap[Data.ChartInfo.Source](Data);
         
@@ -189,10 +190,10 @@ export default defineComponent({
       }
       // 处理X轴
       let xAxis={
-        categories: data.XEdbIdValue,
+        categories: data.ChartInfo.Source===3 ? data.XEdbIdValue : data.DataResp.XDateTimeValue,
         tickWidth: 1,
         title: {
-          text:  language.value=='ch'?`期数(${data.CorrelationChartInfo.LeadUnit})`:`stage(${relevanceUnitEnMap[data.CorrelationChartInfo.LeadUnit]})`,
+          text: data.ChartInfo.Source===3 ? (language.value=='ch'?`期数(${data.CorrelationChartInfo.LeadUnit})`:`stage(${relevanceUnitEnMap[data.CorrelationChartInfo.LeadUnit]})`):null,
           align: 'high',
           rotation: 0,
           x: 0,
@@ -200,7 +201,7 @@ export default defineComponent({
           offset: 20,
         },
         tickInterval: 1,
-        offset:-85,
+        offset:0,
         tickmarkPlacement:'on'
       }
 
@@ -209,8 +210,6 @@ export default defineComponent({
         ...basicYAxis,
         title: {
           text: language.value=='ch'?'相关性系数':'Correlation coefficient',
-          // textCh: '相关性系数',
-          // textEn: 'Correlation coefficient',
           align: 'high',
           rotation: 0,
           y: -15,
@@ -238,8 +237,6 @@ export default defineComponent({
           type: 'spline',
           yAxis: 0,
           name: language.value=='ch'?data.ChartInfo.ChartName:data.ChartInfo.ChartNameEn,
-          // nameCh: data.ChartInfo.ChartName,
-          // nameEn: data.ChartInfo.ChartNameEn,
           color: item.Color,
           chartType: 'linear',
           lineWidth: 3,
@@ -250,32 +247,26 @@ export default defineComponent({
         seriesData.push(serie_item)
       })
 
+      const { LeadValue,LeadUnit } = data.CorrelationChartInfo;
       let tooltip = {
 
         formatter: function() {
-          let str=''
+          const that:any = this;
+          let str='';
           if(language.value=='ch'){
-            str = `<p>相关性系数:${this.y.toFixed(4)}</p><br><p>领先${this.x}期</p>`
+            str = `<p>相关性系数:${that.y.toFixed(4)}</p><br><p>领先${ data.ChartInfo.Source===3 ?that.x+'期' : LeadValue+LeadUnit}</p>`
           }else{
-            str = `<p>Correlation coefficient:${this.y.toFixed(4)}</p><br><p>lead${this.x}stage</p>`
+            str = `<p>Correlation coefficient:${that.y.toFixed(4)}</p><br><p>lead${ data.ChartInfo.Source===3 ? that.x+'stage' : LeadValue+relevanceUnitEnMap[LeadUnit]}</p>`
           }
           
           return str
         },
-        // formatterCh: function() {
-        //   let str = `<p>相关性系数:${this.y.toFixed(4)}</p><br><p>领先${this.x}期</p>`
-        //   return str
-        // },
-        // formatterEn: function() {
-        //   let str = `<p>Correlation coefficient:${this.y.toFixed(4)}</p><br><p>lead${this.x}stage</p>`
-        //   return str
-        // }
       }
 
       state.options = {
-        isRelevanceChart:true,
+        isRelevanceChart:data.ChartInfo.Source===3,
         title: {
-          text:''
+          text:'',
         },
         series: seriesData,
         yAxis: [yAxis] ,

+ 2 - 2
src/views/sheetShow/index.vue

@@ -8,14 +8,14 @@ import { IUnknowObject } from '@/types';
 const route = useRoute();
 const code = ref(route.query.code || '')
 
-interface IInfoType extends IUnknowObject {
+interface InfoType extends IUnknowObject {
   ExcelName: string;
   TableInfo: any;
   ExcelImage: string;
   UniqueCode: string;
 }
 const showData = ref(false);
-const info = ref<IInfoType|any>({});
+const info = ref<InfoType|any>({});
 const loading = ref(false);
 const getInfo = async() => {
   loading.value = true;