Selaa lähdekoodia

Merge branch 'need_pool45'

Karsa 9 kuukautta sitten
vanhempi
commit
c2d82ec492
1 muutettua tiedostoa jossa 28 lisäystä ja 0 poistoa
  1. 28 0
      src/views/ppt_manage/mixins/pptMixins.js

+ 28 - 0
src/views/ppt_manage/mixins/pptMixins.js

@@ -540,10 +540,32 @@ export default {
     /* 主题样式*/
     const chartTheme =  ChartThemeStyle ? JSON.parse(ChartThemeStyle) : null;
 
+      console.log(options)
       this.$nextTick(() => {
         let is_linear = options.series 
           ? options.series.some(_ => _.chartType === 'linear')
           : false ;
+
+          /* 根据板式控制的季节图x轴的刻度数
+              板式1 不管  其余3个
+              板式10 12的曲线,堆积柱,组合 也固定3个 其余板式不管
+            */
+          const { modelId } = this.pageList[index];
+          let minData=[],maxData=[];
+          if([1,2,4,6].includes(MyChartType)) {
+            options.series.forEach(item => {
+              minData.push(item.data[0][0])
+              maxData.push(item.data[item.data.length-1][0])
+            })
+          }
+          
+          let tickInterval = undefined;
+          if((modelId!==1&&MyChartType===2) 
+            || ([1,4,6].includes(MyChartType)&&[10,12].includes(modelId))) {
+              tickInterval = (Math.max(...maxData)-Math.min(...minData))/4;
+          }
+        
+
         //title样式
         let titleHTML = null
         //中英文发布页需设置title换行
@@ -601,6 +623,10 @@ export default {
               }
             },
           },
+          xAxis: {
+            ...options.xAxis,
+            tickInterval: is_linear ? undefined : tickInterval
+          }
         }
         //奇怪柱不堆叠
         let secialBarOpt = (options.series.some(_ => _.chartType === 'linear') && options.series.some(_ => _.chartType === 'linear')) ? {
@@ -614,6 +640,8 @@ export default {
 
         if(!$(`#${refName}`)[0]) return
 
+        console.log(SpecialOption)
+
         if(is_linear)
           Highcharts.chart({
             // Highcharts 配置