Browse Source

fix 面积范围图透明度,右轴title

cxmo 9 months ago
parent
commit
409999d516

+ 1 - 1
src/views/dataEntry_manage/components/addAverageDialog.vue

@@ -125,7 +125,7 @@ export default {
                 /* if(!this.averageForm.Legend){
                     this.getLegend()
                 } */
-                this.$refs.averageFormRef.clearValidate()
+                this.$refs.averageFormRef&&this.$refs.averageFormRef.clearValidate()
             }
         }
     },

+ 18 - 5
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -10,6 +10,11 @@ import futuresInterface from '@/api/modules/futuresBaseApi';
 import chartRelevanceApi from '@/api/modules/chartRelevanceApi';
 import { fittingEquationInterface,statisticFeatureInterface,crossVarietyInterface } from '@/api/modules/chartRelevanceApi';
 
+//获取RGBA的透明度
+const parseRgbaColor = (color='rgba(51, 51, 51, 1)') => {
+    const arr = color.match(/(\d(\.\d+)?)+/g) || ['','','',1];
+    return parseFloat(arr[3]||1)
+}
 /* 散点x轴 */
 const scatterXAxis = {
   tickPosition: 'inside',
@@ -1156,7 +1161,8 @@ export const chartSetMixin = {
             type:'arearange',//上下限是一个范围
             data:[],
             name:MaxMinLimits.Legend||'同期上下限',
-            color:MaxMinLimits.Color||'#075EEE'
+            color:MaxMinLimits.Color||'#075EEE' ,
+            fillOpacity:parseRgbaColor(MaxMinLimits.Color||'')>0.75?0.75:parseRgbaColor(MaxMinLimits.Color||'') //透明度最高0.75 
         }
         MaxMinLimits.List.forEach(item=>{
             serieItem.data.push([item.DataTimestamp,item.MinValue,item.MaxValue])
@@ -1182,7 +1188,8 @@ export const chartSetMixin = {
             type:'arearange',//标准差也是一个范围
             data:[],
             name:SamePeriodStandardDeviation.Legend||'同期标准差',
-            color:SamePeriodStandardDeviation.Color||'#075EEE'
+            color:SamePeriodStandardDeviation.Color||'#075EEE',
+            fillOpacity:parseRgbaColor(SamePeriodStandardDeviation.Color||'')>0.75?0.75:parseRgbaColor(SamePeriodStandardDeviation.Color||'')
         }
         SamePeriodStandardDeviation.List.forEach(item=>{
             serieItem.data.push([item.DataTimestamp,item.MinValue,item.MaxValue])
@@ -1211,7 +1218,7 @@ export const chartSetMixin = {
         }
         let serieItem = {
             ...serieConfig,
-            name:SeasonRightConfig.Legend||'右轴',
+            name:SeasonRightConfig.Legend||'',
             data:[],
             yAxis:1,
         }
@@ -1260,7 +1267,13 @@ export const chartSetMixin = {
       }];
       //如果有右轴,seasonYdata加上右轴
       if(SeasonRightConfig.IsShow){
-        const rightEdb = (SeasonRightConfig.IndicatorType===1?SeasonRightConfig.EdbInfoList[0]:newval[1])||{unit:''}
+        const rightEdb = (SeasonRightConfig.IndicatorType===1?SeasonRightConfig.EdbInfoList[0]:newval[1])||{Unit:''}
+        //左轴同比:text为空或% 右轴指标:取指标单位
+        if(SeasonRightConfig.IndicatorType===1){
+            rightEdb.Unit = SeasonRightConfig.NumFormat===1?'%':''
+        }else{
+            rightEdb.Unit = newval[1]&&(newval[1].ConvertUnit||newval[1].Unit)||''
+        }
         seasonYdata.push({
             ...seasonOptions.yAxis,
             opposite: true,//右轴
@@ -1275,7 +1288,7 @@ export const chartSetMixin = {
                 }
               },
               title: {
-                text: SeasonRightConfig.Legend||'右轴test',
+                text: rightEdb.Unit||'',
                 style:{
                   ...chartTheme&&chartTheme.yAxisOptions.style
                 },