浏览代码

Merge branch 'ETA2.4.2' into debug

ldong 2 月之前
父节点
当前提交
21c0951b65
共有 2 个文件被更改,包括 48 次插入16 次删除
  1. 36 14
      src/hooks/chart/render.js
  2. 12 2
      src/views/chartETA/ChartDetail.vue

+ 36 - 14
src/hooks/chart/render.js

@@ -1338,6 +1338,7 @@ function setStackOrCombinChart(e){
     let series=[]
     let yAxis=[]
     let xAxis = {}
+    let ExtraConfig={}
 
     let temYLeftArr=[]
     let temYRightArr=[]
@@ -1348,7 +1349,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)=>{
 
@@ -1357,7 +1360,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)) {
@@ -1368,13 +1371,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);
         
@@ -1399,7 +1402,7 @@ function setStackOrCombinChart(e){
             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,
@@ -1411,7 +1414,8 @@ function setStackOrCombinChart(e){
             LatestDate:item.LatestDate,
             LatestValue:item.LatestValue,
             ...predict_params,
-            stacking:e.ChartInfo.ChartType==6&&!e.DataResp.IsHeap?undefined:'normal',
+            stacking:e.ChartInfo.ChartType==6?!e.DataResp.IsHeap?undefined:'normal':e.ChartInfo.ChartType==3&&ExtraConfig.IsHeap==1?ExtraConfig.HeapWay==1?'normal':'percent':undefined,
+            threshold: e.ChartInfo.ChartType==3?item.ChartScale?Number(item.ChartScale):0:null
         }
         item.DataList = item.DataList || [];
         for (let i of item.DataList) {
@@ -1450,8 +1454,8 @@ function setStackOrCombinChart(e){
             ...basicYAxis,
             IsAxis:item.IsAxis,
             labels: {
-                formatter: function (ctx) {
-                    return sameSideIndex !== index ? '' : ctx.value;
+                formatter:  (ctx) => {
+                    return sameSideIndex !== index ? '' : e.ChartInfo.ChartType===3&&ExtraConfig.HeapWay==2?ctx.value+'%':ctx.value;
                 },
                 align: 'center',
                 x: [0,2].includes(item.IsAxis) ? 5 : -5,
@@ -1477,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),
@@ -1551,14 +1555,32 @@ function setStackOrCombinChart(e){
         }
     })
     
-   
-
-    return {
+    let options={
         series,
         xAxis:xAxis,
         yAxis,
         rangeSelector:{ enabled: false}
     }
+
+    //面积图百分比tooltip
+    if(e.ChartInfo.ChartType===3&&ExtraConfig.HeapWay == 2) {
+        options.tooltip = {
+            split: false,
+            shared: true,
+            dateTimeLabelFormats: {
+                // 时间格式化字符
+                day: '%Y/%m/%d',
+                week: "%Y/%m",
+                month: '%Y/%m',
+                year: '%Y/%m',
+            },
+            xDateFormat:'%Y/%m/%d',
+            className:'chart-tooltips-box',
+            pointFormat: '<span style=\"color:{point.color}\">●</span><span>{series.name}</span>' +':<b>{point.percentage:.1f}%</b> ({point.y:,.1f})<br/>'
+        }
+    }
+
+    return options
 }
 
 

+ 12 - 2
src/views/chartETA/ChartDetail.vue

@@ -111,6 +111,16 @@ function setDateAppear() {
     }
 }
 
+// 是否面积图堆叠百分比
+function isChartHeap(info){
+    let tag=true
+    if(info.ChartType==3&&info.ExtraConfig){
+        let ExtraConfig=JSON.parse(info.ExtraConfig)
+        tag=ExtraConfig.HeapWay==2?false:true
+    }
+    return tag
+}
+
 onMounted(() => {
     currentLang.value = localStorage.getItem('chartETALange')==='EN'?'en':'zh'
     initChartState(route.query)
@@ -818,7 +828,7 @@ function openDateSelect(){
         <!-- 指标模块 -->
         <div class="edb-list-box">
             <!-- pad 设置上下限按钮 -->
-            <div class="pad-limit-set-btn" @click="handleShowAxisLimitOpt" v-if="![3,4,6,7,8,9].includes(chartInfo.Source)&&checkAuthBtn(chartLibBtn.chartLib_editLimit)">设置上下限</div>
+            <div class="pad-limit-set-btn" @click="handleShowAxisLimitOpt" v-if="![3,4,6,7,8,9].includes(chartInfo.Source)&&checkAuthBtn(chartLibBtn.chartLib_editLimit)&&isChartHeap(chartInfo)">设置上下限</div>
             <!-- <div class="list-lable">指标信息</div> -->
             <div class="list-box">
                 <div class="list-item" v-for="item in edbList" :key="item.EdbInfoId" @click="handleShowEDBInfo(item)">
@@ -838,7 +848,7 @@ function openDateSelect(){
                 <img class="icon" style="transform: rotate(180deg);" src="@/assets/imgs/icon_arrow.png" alt="">
                 <div>下一张</div>
             </div>
-            <div class="item" @click="handleShowAxisLimitOpt" v-if="![3,4,6,7,8,9].includes(chartInfo.Source)&&checkAuthBtn(chartLibBtn.chartLib_editLimit)">
+            <div class="item" @click="handleShowAxisLimitOpt" v-if="![3,4,6,7,8,9].includes(chartInfo.Source)&&checkAuthBtn(chartLibBtn.chartLib_editLimit)&&isChartHeap(chartInfo)">
                 <img class="icon" src="@/assets/imgs/myETA/icon_limit.png" alt="">
                 <div>上下限</div>
             </div>