Przeglądaj źródła

Merge branch 'eta2.4.2' into debug

shanbinzhang 1 miesiąc temu
rodzic
commit
2e805df148
1 zmienionych plików z 23 dodań i 10 usunięć
  1. 23 10
      src/hooks/chart/render.js

+ 23 - 10
src/hooks/chart/render.js

@@ -1329,6 +1329,7 @@ function setStackOrCombinChart(e){
     let series=[]
     let yAxis=[]
     let xAxis = {}
+    let ExtraConfig={}
 
     let temYLeftArr=[]
     let temYRightArr=[]
@@ -1339,6 +1340,9 @@ function setStackOrCombinChart(e){
 
     //有右二轴时排个序 按照左 右 右2的顺序
     let newData = data.some(_ =>_.IsAxis===2) ? changeEdbOrder(data) : data;
+    if(e.ChartInfo.ChartType===3 && e.ChartInfo.ExtraConfig){
+        ExtraConfig=JSON.parse(e.ChartInfo.ExtraConfig)
+    }
 
 
     newData.forEach((item,index)=>{
@@ -1348,7 +1352,7 @@ function setStackOrCombinChart(e){
 
         //堆叠图的yAxis必须一致 数据列所对应的y轴
         let serie_yIndex = index;
-        if([3,4].includes(e.ChartInfo.ChartType)) {
+        if([4].includes(e.ChartInfo.ChartType)||(e.ChartInfo.ChartType ===3 && ExtraConfig.IsHeap==1)) {
             // 类型为堆叠图时公用第一个指标y轴 
             serie_yIndex =  0;
         } else if(e.ChartInfo.ChartType ===6 && ['areaspline','column'].includes(item.ChartStyle)) {
@@ -1359,13 +1363,13 @@ function setStackOrCombinChart(e){
         item.IsAxis = serie_yIndex === index ? item.IsAxis : newData[serie_yIndex].IsAxis;
         item.IsOrder = serie_yIndex === index ? item.IsOrder : newData[serie_yIndex].IsOrder;
 
-        temYLeftIndex = [3,4].includes(e.ChartInfo.ChartType) 
+        temYLeftIndex = [4].includes(e.ChartInfo.ChartType) 
             ? (newData[serie_yIndex].IsAxis ? serie_yIndex : -1)
             : data.findIndex((item) => item.IsAxis===1);
-        temYRightIndex = [3,4].includes(e.ChartInfo.ChartType) 
+        temYRightIndex = [4].includes(e.ChartInfo.ChartType) 
             ? (newData[serie_yIndex].IsAxis ? -1 : serie_yIndex)
             : data.findIndex((item) => !item.IsAxis);
-        temYRightTwoIndex = [3,4].includes(e.ChartInfo.ChartType) 
+        temYRightTwoIndex = [4].includes(e.ChartInfo.ChartType) 
             ? -1
             : data.findIndex((item) => item.IsAxis===2);
         
@@ -1384,13 +1388,19 @@ function setStackOrCombinChart(e){
         //预测指标配置
         let predict_params = item.EdbInfoCategoryType === 1 ? getPredictParams(item) : {};
         //图表可配置的线条数就10条,第11条用第1条的配置,索引取下模
-        const lineIndex = chartTheme ? index%chartTheme.lineOptionList.length : index
+        const lineIndex = chartTheme ? index%chartTheme.lineOptionList.length : index;
+        let stacking = e.ChartInfo.ChartType==6
+            ? !e.DataResp.IsHeap?undefined:'normal'
+            : (e.ChartInfo.ChartType==3&&ExtraConfig.IsHeap==1)?ExtraConfig.HeapWay==1?'normal':'percent':undefined;
+
         let seriesItemObj={
             data:[],
             dataGrouping:{
                 enabled:false
             },
-            type: chartStyle || item.ChartStyle,
+            type: e.ChartInfo.ChartType !== 3
+                ? (chartStyle || item.ChartStyle)
+                : ExtraConfig.IsHeap==1?'area':((chartTheme && chartTheme.lineOptionList[lineIndex].lineType) || item.ChartStyle),
             yAxis:serie_yIndex,
             name:temName,
             nameZh:temName,
@@ -1402,7 +1412,10 @@ function setStackOrCombinChart(e){
             LatestDate:item.LatestDate,
             LatestValue:item.LatestValue,
             ...predict_params,
-            stacking:e.ChartInfo.ChartType==6&&!e.DataResp.IsHeap?undefined:'normal',
+            stacking,
+            threshold: e.ChartInfo.ChartType==3
+                ?(item.ChartScale?Number(item.ChartScale):0)
+                :null
         }
         item.DataList = item.DataList || [];
         for (let i of item.DataList) {
@@ -1442,7 +1455,7 @@ function setStackOrCombinChart(e){
             IsAxis:item.IsAxis,
             labels: {
                 formatter: function (ctx) {
-                    return sameSideIndex !== index ? '' : ctx.value;
+                    return sameSideIndex !== index ? '' : e.ChartInfo.ChartType===3&&ExtraConfig.HeapWay==2?ctx.value+'%':ctx.value;
                 },
                 align: 'center',
                 x: [0,2].includes(item.IsAxis) ? 5 : -5,
@@ -1468,8 +1481,8 @@ function setStackOrCombinChart(e){
             },
             opposite: [0,2].includes(item.IsAxis),
             reversed: item.IsOrder,
-            min: Number(minLimit),
-            max: Number(maxLimit),
+            min: e.ChartInfo.ChartType===3&&ExtraConfig.HeapWay==2?null:Number(minLimit),
+            max: e.ChartInfo.ChartType===3&&ExtraConfig.HeapWay==2?null:Number(maxLimit),
             tickWidth: sameSideIndex !== index ? 0 : 1,
             visible: serie_yIndex === index && sameSideIndex ===index,
             plotBands: setAxisPlotAreas(item.IsAxis),