jwyu hai 10 meses
pai
achega
78cf8aef3f

+ 0 - 3
src/hooks/chart/config.js

@@ -3,9 +3,6 @@
 
 // 图默认配置
 export const chartDefaultOpts={
-	accessibility:{
-		enabled:false
-	},
     //图表配置
 	chart: {
 		spacingTop: 30,

+ 19 - 17
src/hooks/chart/render.js

@@ -1,6 +1,6 @@
 // 图渲染逻辑模块
 
-import {ref,nextTick,reactive} from 'vue'
+import {onMounted,ref,nextTick,reactive} from 'vue'
 import {chartDefaultOpts,scatterXAxis,basicYAxis,basicXAxis,leadUnitEnMap,relevanceUnitEnMap} from './config'
 import Highcharts from 'highcharts/highstock';
 import HighchartsFormat from 'highcharts';
@@ -48,7 +48,7 @@ const axisLimitState = reactive({//极值数据
     xMax:0,
 })
 //仅ETA图库内图表需要使用自定义上下限
-let useSalfLimit = false
+let useSelfLimit = false
 let isUseSelfLimit = ref(false)
 
 export function useChartRender(){
@@ -74,7 +74,7 @@ export function useChartRender(){
  * 9 统计特征/频率
  * 10 跨品种分析
  */
-export function chartRender({data,renderId,lang='zh',changeLangIsCheck,showChartTitle=true}){
+export function chartRender({data,renderId,lang='zh',changeLangIsCheck,showChartTitle=true,shouldUseSelfLimit=false}){
     // 初始化掉极值数据
     axisLimitState.leftIndex=-1
     axisLimitState.rightIndex=-1
@@ -103,7 +103,8 @@ export function chartRender({data,renderId,lang='zh',changeLangIsCheck,showChart
     LangType.value=lang
     RenderDomId.value=renderId
     chartData.value=data
-    useSalfLimit = ['/myETA/chartdetail','/chartETA/chartdetail'].includes(window.location.pathname)
+   /*  useSelfLimit = ['/myETA/chartdetail','/chartETA/chartdetail'].includes(window.location.pathname) */
+   useSelfLimit = shouldUseSelfLimit
     if(data.ChartInfo.Source===1){
         const chartSetMap = {
             1: setSplineOpt,
@@ -678,12 +679,13 @@ function setSplineOpt(e){
         }
 
         //获取上下限
+        console.log('useSelfLimit',useSelfLimit)
         let minLimit = 0,maxLimit = 0
-        if(!useSalfLimit||!isETASource){
+        if(!useSelfLimit||!isETASource){
             minLimit = item.MinData
             maxLimit = item.MaxData
         }
-        if(useSalfLimit&&isETASource){
+        if(useSelfLimit&&isETASource){
             const limitMap = {
                 0:['rightMin','rightMax'],
                 1:['leftMin','leftMax'],
@@ -771,7 +773,7 @@ function setSplineOpt(e){
     yAxis.forEach(item=>{
         if(item.IsAxis===1){//左轴
             axisLimitState.hasLeftAxis=true
-            if(!useSalfLimit||!isETASource){
+            if(!useSelfLimit||!isETASource){
                 axisLimitState.leftMin=data[temYLeftIndex].MinData
                 axisLimitState.leftMax=data[temYLeftIndex].MaxData
 
@@ -780,7 +782,7 @@ function setSplineOpt(e){
             }
         }else if (item.IsAxis===2){ // 右2轴
             axisLimitState.hasRightTwoAxis=true
-            if(!useSalfLimit||!isETASource){
+            if(!useSelfLimit||!isETASource){
                 axisLimitState.rightTwoMin=data[temYRightTwoIndex].MinData
                 axisLimitState.rightTwoMax=data[temYRightTwoIndex].MaxData
 
@@ -789,7 +791,7 @@ function setSplineOpt(e){
             }
         }else{
             axisLimitState.hasRightAxis=true
-            if(!useSalfLimit||!isETASource){
+            if(!useSelfLimit||!isETASource){
                 axisLimitState.rightMin=data[temYRightIndex].MinData
                 axisLimitState.rightMax=data[temYRightIndex].MaxData
 
@@ -858,7 +860,7 @@ function setSeasonOpt(e){
     //获取上下限
     let minLimit = 0,maxLimit = 0
     //非ETA图库不使用自定义上下限
-    if(!useSalfLimit){
+    if(!useSelfLimit){
         minLimit = data.MinData
         maxLimit = data.MaxData
     }else{
@@ -918,7 +920,7 @@ function setSeasonOpt(e){
     // chartData.rangeSelector=rangeSelector
     // 设置坐标轴极值
     axisLimitState.hasLeftAxis=true
-    if(!useSalfLimit){
+    if(!useSelfLimit){
         axisLimitState.leftMin=Number(data.MinData)
         axisLimitState.leftMax=Number(data.MaxData)
     }
@@ -1084,7 +1086,7 @@ function setStackOrCombinChart(e){
         //获取上下限
         let minLimit = 0,maxLimit = 0
         //非ETA图库不使用自定义上下限
-        if(!useSalfLimit){
+        if(!useSelfLimit){
             minLimit = newData[sameSideIndex].MinData
             maxLimit = newData[sameSideIndex].MaxData
         }else{
@@ -1183,7 +1185,7 @@ function setStackOrCombinChart(e){
     yAxis.forEach(item=>{
         if(item.IsAxis === 1){//左轴
             axisLimitState.hasLeftAxis=true
-            if(!useSalfLimit){
+            if(!useSelfLimit){
                 axisLimitState.leftMin=data[temYLeftIndex].MinData
                 axisLimitState.leftMax=data[temYLeftIndex].MaxData
 
@@ -1192,7 +1194,7 @@ function setStackOrCombinChart(e){
             }
         }else if (item.IsAxis===2){ // 右2轴
             axisLimitState.hasRightTwoAxis=true
-            if(!useSalfLimit){
+            if(!useSelfLimit){
                 axisLimitState.rightTwoMin=data[temYRightTwoIndex].MinData
                 axisLimitState.rightTwoMax=data[temYRightTwoIndex].MaxData
 
@@ -1202,7 +1204,7 @@ function setStackOrCombinChart(e){
             
         }else{
             axisLimitState.hasRightAxis=true
-            if(!useSalfLimit){
+            if(!useSelfLimit){
                 axisLimitState.rightMin=data[temYRightIndex].MinData
                 axisLimitState.rightMax=data[temYRightIndex].MaxData
 
@@ -1300,7 +1302,7 @@ function setScatterOptions(data){
 
     //获取上下限
     let minLimit = 0,maxLimit = 0
-    if(!useSalfLimit){
+    if(!useSelfLimit){
         minLimit = data.ChartInfo.LeftMin||0;
         maxLimit = data.ChartInfo.LeftMax||0;
     }else{
@@ -2288,7 +2290,7 @@ function setRadarChart({DataResp,EdbInfoList,ChartInfo}) {
     return {
       chart: {
         ...chartDefaultOpts.chart,
-        ...chartTheme.drawOption,
+        ...chartTheme?.drawOption,
         spacing: [2,10,2,10],
         polar:true,
       },

+ 6 - 1
src/views/etaChart/components/ChartWrap.vue

@@ -73,6 +73,10 @@ async function getChartDetail() {
     tableData.value = res.Data.EdbInfoList || []
     intro.value = res.Data.ChartInfo.Description
     chartInfo.value = res.Data.ChartInfo
+
+    //初始化上下限
+    isUseSelfLimit.value = true
+    setLimitData(res.Data)
     nextTick(() => {
       chartRender({
         data: {
@@ -85,7 +89,8 @@ async function getChartDetail() {
         renderId: 'chart-box',
         // lang:currentLang.value,
         changeLangIsCheck: false,
-        showChartTitle: true
+        showChartTitle: true,
+        shouldUseSelfLimit:true,
       })
     })
   }