Kaynağa Gözat

ETA_1.9.0 图表配置优化

hbchen 8 ay önce
ebeveyn
işleme
05c7818b4f
2 değiştirilmiş dosya ile 62 ekleme ve 28 silme
  1. 38 25
      src/hooks/chart/useChartRender.ts
  2. 24 3
      src/views/sheetShow/index.vue

+ 38 - 25
src/hooks/chart/useChartRender.ts

@@ -235,12 +235,18 @@ const setDefaultLineOptions = () => {
 
     let obj = {
       data: [] as any[],
-      type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
-      dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
+      type: (chartTheme&&chartTheme.lineOptionList[index].lineType) || 'spline',
+      dashStyle: (chartTheme&&chartTheme.lineOptionList[index].dashStyle)||'Solid',
       yAxis: sameSideIndex,
       name,
       color: item.ChartColor,
-      lineWidth: Number(item.ChartWidth)||(chartTheme&&chartTheme.lineOptions.lineWidth)||1,
+      lineWidth: Number(item.ChartWidth)||(chartTheme&&chartTheme.lineOptionList[index].lineWidth)||1,
+      marker: {
+        enabled:chartTheme.lineOptionList[index].dataMark && chartTheme.lineOptionList[index].dataMark!='none',
+        symbol: chartTheme.lineOptionList[index].markType || 'circle',
+        fillColor:chartTheme.lineOptionList[index].markColor,
+        radius: chartTheme.lineOptionList[index].markSize
+      },
       ...predict_params
     };
     item.DataList = item.DataList || []
@@ -343,17 +349,24 @@ const setSeasonOptions = () => {
   const chartTheme =  state.chartInfo.ChartThemeStyle ? JSON.parse(state.chartInfo.ChartThemeStyle) : null;
 
   /*处理数据列*/
-  for (let j of chartDataHandle) {
+  for (let index in chartDataHandle) {
+    let j = chartDataHandle[index]
     //预测指标配置
     let predict_params =  chartData.EdbInfoCategoryType === 1 ? getSeasonPredictParams(j.CuttingDataTimestamp) : {};
 
     let serie_item = {
       data: [] as any[],
-      type: (chartTheme&&chartTheme.lineOptions.lineType) || chartData.ChartStyle,
-      dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
+      type: (chartTheme&&chartTheme.lineOptionList[index].lineType) || chartData.ChartStyle,
+      dashStyle: (chartTheme&&chartTheme.lineOptionList[index].dashStyle)||'Solid',
       yAxis: 0,
       name: j.ChartLegend,
-      lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 1,
+      lineWidth: (chartTheme&&chartTheme.lineOptionList[index].lineWidth) || 1,
+      marker: {
+        enabled:chartTheme.lineOptionList[index].dataMark && chartTheme.lineOptionList[index].dataMark!='none',
+        symbol: chartTheme.lineOptionList[index].markType || 'circle',
+        fillColor:chartTheme.lineOptionList[index].markColor,
+        radius: chartTheme.lineOptionList[index].markSize
+      },
       ...predict_params
     };
     const data_array = _.cloneDeep(j.DataList);
@@ -727,7 +740,7 @@ const setScatterChartOptions = () => {
     color: ChartColor,
     chartType: 'linear',
     marker: {
-      radius: (chartTheme&&chartTheme.lineOptions.radius)||5,
+      radius: (chartTheme&&chartTheme.lineOptionList[0].radius)||5,
     },
   }
   real_data.forEach(_ => {
@@ -957,7 +970,7 @@ const setSectionScatterChart = () => {
 
     //数据列
     let series: any[] = [];
-    DataList.forEach(item => {
+    DataList.forEach((item:any,index:number) => {
         //数据列
         let series_item = {
             data: [] as any[],
@@ -968,7 +981,7 @@ const setSectionScatterChart = () => {
             chartType: 'linear',
             zIndex:1,
             marker: {
-              radius: (chartTheme&&chartTheme.lineOptions.radius)||5,
+              radius: (chartTheme&&chartTheme.lineOptionList[index].radius)||5,
             },
             visible: true
         }
@@ -1155,19 +1168,19 @@ const setCommodityChart = () => {
   }
 
   //数据列
-  data.forEach((item: { Value: number[]; Name: string; Date: string; Color: string;NameEn: string,XEdbInfoIdList: number[],NoDataEdbList: number[] }) => {
+  data.forEach((item: { Value: number[]; Name: string; Date: string; Color: string;NameEn: string,XEdbInfoIdList: number[],NoDataEdbList: number[] },index:number) => {
     //处理首或/尾全是无效数据的以null填充
     let filterData = filterInvalidData(item)
 
     let serie_item = {
       data: filterData,
-      type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
-      dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
+      type: (chartTheme&&chartTheme.lineOptionList[index].lineType) || 'spline',
+      dashStyle: (chartTheme&&chartTheme.lineOptionList[index].dashStyle)||'Solid',
       yAxis: 0,
       name: language.value === 'zh' ? item.Name : item.NameEn,
       color: item.Color,
       chartType: 'linear',
-      lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 3,
+      lineWidth: (chartTheme&&chartTheme.lineOptionList[index].lineWidth) || 3,
       marker: {
         enabled: false
       }
@@ -1328,16 +1341,16 @@ const initRelevanceChartData=(data)=>{
 
   //处理series
   let seriesData:any[]=[]
-  data.YDataList.forEach(item=>{
+  data.YDataList.forEach((item:any,index:number)=>{
     let serie_item = {
       data: item.Value,
-      type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
-      dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
+      type: (chartTheme&&chartTheme.lineOptionList[index].lineType) || 'spline',
+      dashStyle: (chartTheme&&chartTheme.lineOptionList[index].dashStyle)||'Solid',
       yAxis: 0,
       name: language.value=='zh'?data.ChartInfo.ChartName:data.ChartInfo.ChartNameEn,
       color: item.Color,
       chartType: 'linear',
-      lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 3,
+      lineWidth: (chartTheme&&chartTheme.lineOptionList[index].lineWidth) || 3,
       marker: {
         enabled: false
       }
@@ -1439,12 +1452,12 @@ const setStatisticFrequency = () => {
 
     let series_item = {
       data: item.Value.map(_ =>[_.X,_.Y]),
-      dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
-      type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
+      dashStyle: (chartTheme&&chartTheme.lineOptionList[index].dashStyle)||'Solid',
+      type: (chartTheme&&chartTheme.lineOptionList[index].lineType) || 'spline',
       yAxis: index,
       name: language.value === 'zh' ? item.Name : item.NameEn,
       color: item.Color,
-      lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth)||3,
+      lineWidth: (chartTheme&&chartTheme.lineOptionList[index].lineWidth)||3,
       chartType: 'linear',
       zIndex:1
     }
@@ -1715,16 +1728,16 @@ const setRadarChart = () => {
 
     //系列
     let series:any[] = [];
-    YDataList.forEach(item => {
+    YDataList.forEach((item,index) => {
       let serie_item = {
         data: item.Value,
         pointPlacement: 'on',
-        type: (chartTheme&&chartTheme.lineOptions.lineType) || 'line',
-        dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
+        type: (chartTheme&&chartTheme.lineOptionList[index].lineType) || 'line',
+        dashStyle: (chartTheme&&chartTheme.lineOptionList[index].dashStyle)||'Solid',
         yAxis: 0,
         name: language.value==='zh' ? (item.Name || item.Date) : item.Date,
         color: item.Color,
-        lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 1,
+        lineWidth: (chartTheme&&chartTheme.lineOptionList[index].lineWidth) || 1,
         chartType: 'linear'
       };
       series.push(serie_item)

+ 24 - 3
src/views/sheetShow/index.vue

@@ -67,8 +67,17 @@ const refreshSheet = async()=>{
     <h3 class="title">{{info.ExcelName}}</h3>
     
     <sheet :data="info.TableInfo.TableDataList" :config="info.Config"/>
-    <div class="tool">
-        <span @click="refreshSheet">刷新</span>
+    <div class="tool sheet-bottom">
+      <div class="sheet-source" 
+        v-if="info.SourcesFrom&&JSON.parse(info.SourcesFrom).isShow"
+        :style="`
+            color: ${ JSON.parse(info.SourcesFrom).color };
+            font-size: ${ JSON.parse(info.SourcesFrom).fontSize }px;
+        `"
+      >
+          source:<em>{{ JSON.parse(info.SourcesFrom).text}}</em>
+      </div>
+      <span @click="refreshSheet" style="color: #666;">刷新</span>
     </div>
   </div>
 </template>
@@ -88,11 +97,23 @@ const refreshSheet = async()=>{
     margin-bottom: 8px;
   }
   .tool{
-    text-align: right;
+    // text-align: right;
     margin-top: 5px;
     span{
         cursor: pointer;
     }
   }
+  .sheet-bottom{
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    white-space: nowrap;
+    .sheet-source{
+      width: 30%;
+      min-width: 150px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+    }
+  }
 }
 </style>