Эх сурвалжийг харах

🎨 perf<数据中心>: 图表组件改为两条折线图

xinyan 10 сар өмнө
parent
commit
276fe131f6

+ 4 - 7
src/views/reportManage/dataCenter/normalDisplay/components/DateTendency/index.vue

@@ -125,7 +125,7 @@ const option: any = {
     {
       id: 1,
       name: '',
-      type: 'bar',
+      type: 'line',
       encode: {
         x: 'data_datetime',
         y: '',
@@ -185,13 +185,10 @@ async function initLine() {
   option.series = metrics.value.map((metric, index) => ({
     id: index,
     name: metric.label,
-    type: metric.color == '#3fd4cf' ? 'line' : 'bar',
+    type: index === 0 ? 'bar' : 'line',
     encode: { x: 'data_datetime', y: metric.metric },
     yAxisIndex: index,
-    itemStyle: {
-      color: index > 1 ? '#3fd4cf' : (index === 0 ? '#0085ff' : '#ff9500'),
-      borderRadius: [6, 6, 6, 6]
-    },
+    itemStyle: { color: option.series.type == 'bar' ? '#0085ff' : metric.color, borderRadius: [6, 6, 6, 6] },
     lineStyle: { color: metric.color },
     barWidth: '16px',
     areaStyle:
@@ -280,7 +277,7 @@ function changeMetric() {
     const baseConfig: any = {
       id: index,
       name: metric.label,
-      type: metric.color == '#3fd4cf' ? 'line' : 'bar',
+      type: metric.color === '#0085ff' ? 'bar' : 'line',
       encode: { x: 'data_datetime', y: metric.metric },
       yAxisIndex: index,
       itemStyle: { color: metric.color, borderRadius: [6, 6, 6, 6] },

+ 3 - 5
src/views/reportManage/dataCenter/normalDisplay/components/MetricsCards/index.vue

@@ -40,7 +40,6 @@ const metricMap = computed(() => {
 const initializeMetrics = () => {
   selectedMetric.value = [];
   displayMetrics.value = [];
-  //console.log('初始化', selectedMetric.value);
   Object.keys(colorsMap).forEach(key => delete colorsMap[key]);
 
   if (dateType.value === 'day' || dateType.value === 'month') {
@@ -51,15 +50,14 @@ const initializeMetrics = () => {
   } else if (dateType.value === 'week') {
     selectedMetric.value = weekInitData.value;
   }
-  console.log('initData.value', initData);
-  console.log('111', selectedMetric.value);
+  //console.log('initData.value', initData);
+  //console.log('111', selectedMetric.value);
   for (const info of selectedMetric.value) {
     displayMetrics.value.push({metric: info.metric, color: info.color});
     if (info.color) {
       colorsMap[info.color] = true;
     }
   }
-  console.log('initializeMetrics', selectedMetric.value);
   emits('update:modelValue', selectedMetric.value);
 };
 
@@ -135,7 +133,7 @@ watch(selectedMetric, () => {
       info.color = undefined;
     }
   }
-  console.log('watch', selectedMetric.value);
+  //console.log('watch', selectedMetric.value);
 }, {deep: true});
 
 watch(