Browse Source

图表en配置修改

Karsa 2 years ago
parent
commit
43a0fc7159
1 changed files with 18 additions and 10 deletions
  1. 18 10
      src/views/chartShow/index.vue

+ 18 - 10
src/views/chartShow/index.vue

@@ -184,6 +184,7 @@ export default defineComponent({
 
       //拼接标题 数据列
       let data = [] as any[],ydata = [] as any[],minTimeArr: number[] = [],maxTimeArr: number[] = [];
+      let rightTwoIndex = dataList.findIndex(item => item.IsAxis ===2);
       // const chartData = _.cloneDeep(dataList);
        //有右二轴时排个序 按照左 右 右2的顺序
       let chartData = dataList.some(_ =>_.IsAxis===2) ? changeEdbOrder(dataList) : _.cloneDeep(dataList);
@@ -216,6 +217,7 @@ export default defineComponent({
             align: 'high',
             rotation: 0,
             y: -15,
+            x: (item.IsAxis===0 && rightTwoIndex>-1) ? -chartData[rightTwoIndex].Unit.length*12 : 0,
             textAlign: item.IsAxis===1 ? 'left' : 'right',
             reserveSpace: false
           },
@@ -371,6 +373,11 @@ export default defineComponent({
         item.IsAxis = serie_yIndex === index ? item.IsAxis : chartData[serie_yIndex].IsAxis;
         item.IsOrder = serie_yIndex === index ? item.IsOrder : chartData[serie_yIndex].IsOrder;
 
+        // 右2轴下标
+        let rightTwoIndex = [3,4].includes(chartInfo.ChartType) 
+        ? -1
+        : dataList.findIndex(item => item.IsAxis===2);
+
         //y轴
         let textEn = item.Unit?item.UnitEn:''
         let yItem = {
@@ -392,6 +399,7 @@ export default defineComponent({
             align: 'high',
             rotation: 0,
             y: -15,
+            x: (item.IsAxis===0 && rightTwoIndex>-1) ? -chartData[rightTwoIndex].Unit.length*12 : 0,
             textAlign: item.IsAxis===1 ? 'left' : 'right',
             reserveSpace: false
           },
@@ -819,26 +827,26 @@ export default defineComponent({
         0: '右轴',
         2: '右2轴'
       }:{
-        0: 'right axis',
-        2: 'second right axis'
+        0: 'RHS',
+        2: '2-RHS'
       }
       const orderLabelMap:any = lang=='ch'?{
         1: '逆序'
       }:{
-        1: 'reverse'
+        1: 'REV'
       }
       const edbInfoMap:any = lang=='ch'?{
         0: '领先'
       }:{
-        0: 'lead'
+        0: 'Lead'
       }
 
       const leadUnitEnMap:any = {
-        '年': 'year',
-        '季': 'quarter',
-        '月': 'month',
-        '周': 'week',
-        '天': 'day',
+        '年': 'Y',
+        '季': 'Q',
+        '月': 'M',
+        '周': 'W',
+        '天': 'D',
       }
       //英文领先单位转换
       const edbLeadUnit = lang=='ch' ? LeadUnit : leadUnitEnMap[LeadUnit];
@@ -847,7 +855,7 @@ export default defineComponent({
       //逆序拼接
       let order_tag = orderLabelMap[Number(IsOrder)] ? `${axis_tag ? ',': ''}${orderLabelMap[Number(IsOrder)]}` : ''
       //领先拼接
-      let edb_tag = edbInfoMap[EdbInfoType] ? `${(axis_tag||order_tag) ? ',' : '' }${edbInfoMap[EdbInfoType]}${LeadValue}${edbLeadUnit}` : '';
+      let edb_tag = edbInfoMap[EdbInfoType] ? `${(axis_tag||order_tag) ? ',' : '' }${edbInfoMap[EdbInfoType]} ${LeadValue}${edbLeadUnit}` : '';
 
       return (axis_tag || order_tag || edb_tag) ? `(${axis_tag}${order_tag}${edb_tag})` : ''
     }