From b24a46e6f6cf3f776b04c5b9a5c5f9589f4a6bbf Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 10 Mar 2022 10:10:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=A2=9C=E8=89=B2=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/bar/bar.js | 4 ++-- frontend/src/views/chart/chart/funnel/funnel.js | 2 +- frontend/src/views/chart/chart/gauge/gauge.js | 4 ++-- frontend/src/views/chart/chart/gauge/gauge_antv.js | 4 ++-- frontend/src/views/chart/chart/line/line.js | 2 +- frontend/src/views/chart/chart/map/map.js | 2 +- frontend/src/views/chart/chart/mix/mix.js | 2 +- frontend/src/views/chart/chart/mix/mix_antv.js | 2 +- frontend/src/views/chart/chart/pie/pie.js | 4 ++-- frontend/src/views/chart/chart/radar/radar.js | 2 +- frontend/src/views/chart/chart/scatter/scatter.js | 2 +- frontend/src/views/chart/chart/treemap/treemap.js | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/views/chart/chart/bar/bar.js b/frontend/src/views/chart/chart/bar/bar.js index b55d9a9ed3..aee859135f 100644 --- a/frontend/src/views/chart/chart/bar/bar.js +++ b/frontend/src/views/chart/chart/bar/bar.js @@ -25,7 +25,7 @@ export function baseBarOption(chart_option, chart) { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { @@ -88,7 +88,7 @@ export function horizontalBarOption(chart_option, chart) { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/funnel/funnel.js b/frontend/src/views/chart/chart/funnel/funnel.js index 522016ecfe..16f699d2b7 100644 --- a/frontend/src/views/chart/chart/funnel/funnel.js +++ b/frontend/src/views/chart/chart/funnel/funnel.js @@ -40,7 +40,7 @@ export function baseFunnelOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // y.type = 'funnel' chart_option.series[0].data.push(y) diff --git a/frontend/src/views/chart/chart/gauge/gauge.js b/frontend/src/views/chart/chart/gauge/gauge.js index 15054a3074..71c6a1814c 100644 --- a/frontend/src/views/chart/chart/gauge/gauge.js +++ b/frontend/src/views/chart/chart/gauge/gauge.js @@ -63,7 +63,7 @@ export function baseGaugeOption(chart_option, chart) { for (let i = 0; i < arr.length; i++) { const ele = arr[i] const p = parseInt(ele) / 100 - range.push([p, hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)]) + range.push([p, hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)]) if (!flag && per <= p) { flag = true index = i @@ -73,7 +73,7 @@ export function baseGaugeOption(chart_option, chart) { index = arr.length } - range.push([1, hexColorToRGBA(customAttr.color.colors[arr.length % 9], customAttr.color.alpha)]) + range.push([1, hexColorToRGBA(customAttr.color.colors[arr.length % customAttr.color.colors.length], customAttr.color.alpha)]) chart_option.series[0].axisLine = { lineStyle: { color: range diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index 000219141b..82cd5071d7 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -88,12 +88,12 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { options.indicator = { pointer: { style: { - stroke: theme.styleSheet.paletteQualitative10[index % 9] + stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length] } }, pin: { style: { - stroke: theme.styleSheet.paletteQualitative10[index % 9] + stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length] } } } diff --git a/frontend/src/views/chart/chart/line/line.js b/frontend/src/views/chart/chart/line/line.js index 2ef2ea59ba..faf0f5fb88 100644 --- a/frontend/src/views/chart/chart/line/line.js +++ b/frontend/src/views/chart/chart/line/line.js @@ -25,7 +25,7 @@ export function baseLineOption(chart_option, chart) { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index aee4192f28..27ec15676d 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -73,7 +73,7 @@ export function baseMapOption(chart_option, chart) { y.name = chart.data.x[i] // color // y.itemStyle = { - // color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), + // color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha), // borderRadius: 0 // } chart_option.series[0].data.push(y) diff --git a/frontend/src/views/chart/chart/mix/mix.js b/frontend/src/views/chart/chart/mix/mix.js index bad33d3181..3380996cb4 100644 --- a/frontend/src/views/chart/chart/mix/mix.js +++ b/frontend/src/views/chart/chart/mix/mix.js @@ -27,7 +27,7 @@ export function baseMixOption(chart_option, chart) { y.type = y.type ? y.type : 'bar' // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/mix/mix_antv.js b/frontend/src/views/chart/chart/mix/mix_antv.js index c361008d3b..8298d79b5c 100644 --- a/frontend/src/views/chart/chart/mix/mix_antv.js +++ b/frontend/src/views/chart/chart/mix/mix_antv.js @@ -43,7 +43,7 @@ export function baseMixOptionAntV(plot, container, chart, action) { const o = { type: '', options: { - color: colors[i % 9], + color: colors[i % colors.length], data: d.data, xField: 'field', yField: 'value', diff --git a/frontend/src/views/chart/chart/pie/pie.js b/frontend/src/views/chart/chart/pie/pie.js index d2afdd159d..e7622d8dda 100644 --- a/frontend/src/views/chart/chart/pie/pie.js +++ b/frontend/src/views/chart/chart/pie/pie.js @@ -41,7 +41,7 @@ export function basePieOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha), borderRadius: 0 } y.type = 'pie' @@ -94,7 +94,7 @@ export function rosePieOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha), borderRadius: customAttr.size.pieRoseRadius } y.type = 'pie' diff --git a/frontend/src/views/chart/chart/radar/radar.js b/frontend/src/views/chart/chart/radar/radar.js index d2b582981c..0de2f39d7c 100644 --- a/frontend/src/views/chart/chart/radar/radar.js +++ b/frontend/src/views/chart/chart/radar/radar.js @@ -33,7 +33,7 @@ export function baseRadarOption(chart_option, chart) { } // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // label if (customAttr.label) { diff --git a/frontend/src/views/chart/chart/scatter/scatter.js b/frontend/src/views/chart/chart/scatter/scatter.js index 9e2924368a..d6f1a88a95 100644 --- a/frontend/src/views/chart/chart/scatter/scatter.js +++ b/frontend/src/views/chart/chart/scatter/scatter.js @@ -30,7 +30,7 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/treemap/treemap.js b/frontend/src/views/chart/chart/treemap/treemap.js index 4db4572bea..6c6befa083 100644 --- a/frontend/src/views/chart/chart/treemap/treemap.js +++ b/frontend/src/views/chart/chart/treemap/treemap.js @@ -49,7 +49,7 @@ export function baseTreemapOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // y.type = 'treemap' chart_option.series[0].data.push(y)