Browse Source

Merge branch 'debug' of http://8.136.199.33:3000/eta_front/eta_chart_front into debug

shanbinzhang 4 months ago
parent
commit
668ca312f5

+ 33 - 9
src/hooks/chart/useChartRender.ts

@@ -780,7 +780,10 @@ const setStackOrCombinChart = () => {
   // const chartData = _.cloneDeep(dataList);
   // const chartData = _.cloneDeep(dataList);
   //有右二轴时排个序 按照左 右 右2的顺序
   //有右二轴时排个序 按照左 右 右2的顺序
   let chartData = dataList.some(_ =>_.IsAxis===2) ? changeEdbOrder(dataList) : _.cloneDeep(dataList);
   let chartData = dataList.some(_ =>_.IsAxis===2) ? changeEdbOrder(dataList) : _.cloneDeep(dataList);
-
+  let ExtraConfig={}
+  if(chartInfo.ChartType===3 && chartInfo.ExtraConfig){
+    ExtraConfig=JSON.parse(chartInfo.ExtraConfig)
+  }
   //支持的图表类型
   //支持的图表类型
   const chartTypeMap: IChartType  = {
   const chartTypeMap: IChartType  = {
     3: 'areaspline',
     3: 'areaspline',
@@ -798,7 +801,7 @@ const setStackOrCombinChart = () => {
     
     
      //堆叠图的yAxis必须一致 数据列所对应的y轴
      //堆叠图的yAxis必须一致 数据列所对应的y轴
     let serie_yIndex = index;
     let serie_yIndex = index;
-    if([3,4].includes(chartInfo.ChartType)) {
+    if([4].includes(chartInfo.ChartType) || (chartInfo.ChartType ===3 && ExtraConfig?.IsHeap==1)) {
       // 类型为堆叠图时公用第一个指标y轴 
       // 类型为堆叠图时公用第一个指标y轴 
       serie_yIndex =  0;
       serie_yIndex =  0;
     } else if(chartInfo.ChartType ===6 && ['areaspline','column'].includes(item.ChartStyle)) {
     } else if(chartInfo.ChartType ===6 && ['areaspline','column'].includes(item.ChartStyle)) {
@@ -810,7 +813,7 @@ const setStackOrCombinChart = () => {
     item.IsOrder = serie_yIndex === index ? item.IsOrder : chartData[serie_yIndex].IsOrder;
     item.IsOrder = serie_yIndex === index ? item.IsOrder : chartData[serie_yIndex].IsOrder;
 
 
     // 右2轴下标
     // 右2轴下标
-    let rightTwoIndex = [3,4].includes(chartInfo.ChartType) 
+    let rightTwoIndex = [4].includes(chartInfo.ChartType) 
     ? -1
     ? -1
     : dataList.findIndex(item => item.IsAxis===2);
     : dataList.findIndex(item => item.IsAxis===2);
 
 
@@ -833,7 +836,7 @@ const setStackOrCombinChart = () => {
       labels: {
       labels: {
         formatter: function (ctx: any) {
         formatter: function (ctx: any) {
           let val = ctx.value;
           let val = ctx.value;
-          return sameSideIndex !== index ? '' : val;
+          return sameSideIndex !== index ? '' : chartInfo.ChartType===3&&ExtraConfig?.HeapWay==2?val+'%':val;
         },
         },
         align: 'center',
         align: 'center',
         x: [0,2].includes(item.IsAxis) ? 5 : -5,
         x: [0,2].includes(item.IsAxis) ? 5 : -5,
@@ -856,8 +859,8 @@ const setStackOrCombinChart = () => {
       },
       },
       opposite: [0,2].includes(item.IsAxis),
       opposite: [0,2].includes(item.IsAxis),
       reversed: item.IsOrder,
       reversed: item.IsOrder,
-      min: Number(minLimit),
-      max: Number(maxLimit),
+      min: chartInfo.ChartType===3&&ExtraConfig?.HeapWay==2?null:Number(minLimit),
+      max: chartInfo.ChartType===3&&ExtraConfig?.HeapWay==2?null:Number(maxLimit),
       tickWidth: sameSideIndex !== index ? 0 : 1,
       tickWidth: sameSideIndex !== index ? 0 : 1,
       visible: serie_yIndex === index && sameSideIndex ===index,
       visible: serie_yIndex === index && sameSideIndex ===index,
       plotBands: setAxisPlotAreas(item.IsAxis),
       plotBands: setAxisPlotAreas(item.IsAxis),
@@ -897,7 +900,8 @@ const setStackOrCombinChart = () => {
       borderWidth: 1,
       borderWidth: 1,
       borderColor: item.ChartColor,
       borderColor: item.ChartColor,
       ...predict_params,
       ...predict_params,
-      stacking:chartInfo.ChartType==6&&DataResp.IsHeap!==1?undefined:'normal',
+      stacking:chartInfo.ChartType==6?DataResp.IsHeap!==1?undefined:'normal':chartInfo.ChartType==3&&ExtraConfig?.IsHeap==1?ExtraConfig?.HeapWay==1?'normal':'percent':undefined,
+      threshold: chartInfo.ChartType==3?item.ChartScale?Number(item.ChartScale):0:null
     };
     };
     
     
     item.DataList = item.DataList || []
     item.DataList = item.DataList || []
@@ -940,11 +944,31 @@ const setStackOrCombinChart = () => {
     plotLines: setAxisPlotLines(3,'datetime')
     plotLines: setAxisPlotLines(3,'datetime')
   }
   }
 
 
-  return {
+  let options={
     series: data,
     series: data,
     yAxis: ydata,
     yAxis: ydata,
     xAxis
     xAxis
-  };
+  }
+
+  //面积图百分比tooltip
+  if(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;
 }
 }
 
 
 
 

+ 1 - 1
src/router/index.ts

@@ -26,7 +26,7 @@ export const routes: AppRouteRecordRaw[] = [
   {
   {
     path: '/chart/previewHt',
     path: '/chart/previewHt',
     component: () => import('@/views/chartShow/previewHT.vue'),
     component: () => import('@/views/chartShow/previewHT.vue'),
-    name: '图表预览',
+    name: '海通图表预览',
   },
   },
   {
   {
     path: '/sheetshow',
     path: '/sheetshow',

+ 4 - 1
src/views/chartShow/index.vue

@@ -57,7 +57,7 @@
     <div class="bootom-source">
     <div class="bootom-source">
 
 
       <!-- 自定义来源 -->
       <!-- 自定义来源 -->
-      <div>
+      <div class="source-box">
         <div class="chart-source text_oneLine" 
         <div class="chart-source text_oneLine" 
           v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow"
           v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow"
           :style="`
           :style="`
@@ -247,4 +247,7 @@ export default defineComponent({
 </script>
 </script>
 <style scoped lang="less">
 <style scoped lang="less">
 @import './index.less';
 @import './index.less';
+.source-box {
+  max-width: 50%;
+}
 </style>
 </style>

+ 1 - 1
src/views/chartShow/previewHT.vue

@@ -30,7 +30,7 @@ const getChartInfo = async (type = '') => {
 
 
   loading.value = true;
   loading.value = true;
   try {
   try {
-    const { Data } = await ChartApi.getChart({
+    const { Data } = await ChartApi.chartDetail({
       UniqueCode: code.value || '',
       UniqueCode: code.value || '',
     });
     });
     loading.value = false;
     loading.value = false;