Преглед изворни кода

Merge branch 'need_pool168'

Karsa пре 5 месеци
родитељ
комит
703de257b7
2 измењених фајлова са 40 додато и 6 уклоњено
  1. 32 4
      src/views/ppt_manage/mixins/mixins.js
  2. 8 2
      src/views/ppt_manage/mixins/pptMixins.js

+ 32 - 4
src/views/ppt_manage/mixins/mixins.js

@@ -167,7 +167,8 @@ export default {
               return val;
             },
             align: 'center',
-            x: [0,2].includes(item.IsAxis) ? 5 : -5,
+            x: [0,2].includes(item.IsAxis) ? 2 : -2,
+            y: 3,
             style: {
               ...chartTheme&&chartTheme.yAxisOptions.style,
             }
@@ -232,6 +233,7 @@ export default {
               ? Highcharts.dateFormat('%m/%d', ctx.value)
               : Highcharts.dateFormat('%y/%m', ctx.value);
           },
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -341,7 +343,8 @@ export default {
               return sameSideIndex !== index ? '' : val;
             },
             align: 'center',
-            x: [0,2].includes(item.IsAxis) ? 5 : -5,
+            x: [0,2].includes(item.IsAxis) ? 2 : -2,
+            y: 3,
             style: {
               ...chartTheme&&chartTheme.yAxisOptions.style
             }
@@ -410,6 +413,7 @@ export default {
                ? Highcharts.dateFormat('%m/%d', ctx.value)
                : Highcharts.dateFormat('%y/%m', ctx.value);
            },
+           y: 14,
            style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -479,6 +483,8 @@ export default {
             return val;
           },
           align: 'center',
+          x: -2,
+          y: 3,
           style: {
             ...chartTheme&&chartTheme.yAxisOptions.style
           }
@@ -512,6 +518,7 @@ export default {
           formatter: function (ctx) {
             return Highcharts.dateFormat('%m/%d', ctx.value);
           },
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -611,7 +618,7 @@ export default {
       //y轴
       const textYZh = chartData[1].ConvertUnit||chartData[1].Unit
       const textYEn = chartData[1].ConvertEnUnit||chartData[1].UnitEn||chartData[1].ConvertUnit||chartData[1].Unit
-      let yAxis = {
+      let yAxis = [{
         title: {
           text:  `${textYZh}`,
           textCh:textYZh,
@@ -628,6 +635,8 @@ export default {
           formatter: function (ctx) {
             return ctx.value;
           },
+          x: -2,
+          y: 3,
           align: 'center',
           style:{
             ...chartTheme&&chartTheme.yAxisOptions.style
@@ -652,7 +661,7 @@ export default {
         tickPixelInterval: 50,
         plotBands: this.setAxisPlotAreas(1),
         plotLines: this.setAxisPlotLines(1)
-      }
+      }]
 
       //数据列
       let series = {
@@ -694,6 +703,7 @@ export default {
             offset: 15,
           },
           labels: {
+            y: 14,
             style: {
               ...chartTheme&&chartTheme.xAxisOptions.style
             }
@@ -722,6 +732,7 @@ export default {
         categories: this.barXIdData.map(_ => this.barEdbData.find(edb => edb.EdbInfoId===_).EdbAliasName),
         tickWidth: 1,
         labels: {
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -751,6 +762,8 @@ export default {
             let val = ctx.value;
             return val;
           },
+          x: -2,
+          y: 3,
           align: 'center',
           style:{
             ...chartTheme&&chartTheme.yAxisOptions.style
@@ -826,6 +839,7 @@ export default {
         categories: this.commodityXData.map(_ =>_.Name),
         tickWidth: 1,
         labels: {
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -854,6 +868,8 @@ export default {
             let val = ctx.value;
             return val;
           },
+          x: -2,
+          y: 3,
           align: 'center',
           style:{
             ...chartTheme&&chartTheme.yAxisOptions.style
@@ -1040,6 +1056,7 @@ export default {
           }
         },
         labels: {
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -1070,6 +1087,8 @@ export default {
             let val = ctx.value;
             return val;
           },
+          x: -2,
+          y: 3,
           align: 'center',
           style:{
             ...chartTheme&&chartTheme.yAxisOptions.style
@@ -1164,6 +1183,8 @@ export default {
           },
         },
         labels: {
+          x: -2,
+          y: 3,
           style:{
             ...chartTheme&&chartTheme.yAxisOptions.style
           },
@@ -1190,6 +1211,7 @@ export default {
           align: 'middle',
         },
         labels: {
+          y: 14,
           style:{
             ...chartTheme&&chartTheme.xAxisOptions.style
           },
@@ -1342,6 +1364,7 @@ export default {
         ...scatterXAxis,
         tickWidth: 1,
         labels: {
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -1366,6 +1389,8 @@ export default {
             },
           },
           labels: {
+            x: 0,
+            y: 3,
             style:{
               ...chartTheme&&chartTheme.yAxisOptions.style
             },
@@ -1443,6 +1468,8 @@ export default {
           }
         },
         labels: {
+          x: -2,
+          y: 3,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }
@@ -1467,6 +1494,7 @@ export default {
           }
         },
         labels: {
+          y: 14,
           style: {
             ...chartTheme&&chartTheme.xAxisOptions.style
           }

+ 8 - 2
src/views/ppt_manage/mixins/pptMixins.js

@@ -662,7 +662,9 @@ export default {
           || ([1,4,6].includes(MyChartType)&&[10,12].includes(modelId))) {
               tickInterval = (Math.max(...maxData)-Math.min(...minData))/6;
           }
-        
+          
+          //y轴也要刻度数量固定...
+          let tickAmount = [3,4,5,10,11,12].includes(modelId)?6:undefined;
 
         //title样式
         let titleHTML = null
@@ -722,7 +724,11 @@ export default {
           xAxis: {
             ...options.xAxis,
             tickInterval: is_linear ? undefined : tickInterval
-          }
+          },
+          yAxis: options.yAxis.map(_ => ({
+            ..._,
+            tickAmount
+          }))
         }
         //奇怪柱不堆叠
         let secialBarOpt = (options.series.some(_ => _.chartType === 'linear') && options.series.some(_ => _.chartType === 'linear')) ? {