From 4328b712ae1afa0b713fa9d5eaef34ab592f84f0 Mon Sep 17 00:00:00 2001 From: wisonic Date: Fri, 18 Oct 2024 11:13:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=9B=BE=E4=BE=8B=E7=9A=84=E5=9B=BE=E6=A0=87=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/components/js/panel/charts/map/map.ts | 4 +++- .../js/panel/charts/others/quadrant.ts | 17 +++++++++++++++++ .../components/js/panel/charts/others/radar.ts | 14 ++++++++++++++ .../js/panel/charts/others/scatter.ts | 14 ++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts index d86e817423..fbac7000eb 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts @@ -295,7 +295,9 @@ export class Map extends L7PlotChartView { color: legend.color }, 'l7plot-legend__category-marker': { - ...LEGEND_SHAPE_STYLE_MAP[legend.icon] + ...LEGEND_SHAPE_STYLE_MAP[legend.icon], + width: '8px', + height: '8px' } } } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts index bd20834404..23e94cc72f 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts @@ -401,6 +401,7 @@ export class Quadrant extends G2PlotChartView { } return chart } + protected configColor(chart: Chart, options: ScatterOptions): ScatterOptions { const { xAxis, yAxis, yAxisExt } = chart if (!(xAxis?.length && yAxis?.length && yAxisExt?.length)) { @@ -408,6 +409,7 @@ export class Quadrant extends G2PlotChartView { } return this.configSingleDimensionColor(chart, options) } + public setupSeriesColor(chart: ChartObj, data?: any[]): ChartBasicStyle['seriesColor'] { const { xAxis, yAxis, yAxisExt } = chart if (!(xAxis?.length && yAxis?.length && yAxisExt?.length)) { @@ -416,6 +418,21 @@ export class Quadrant extends G2PlotChartView { const tmp = data?.[0]?.data return setUpSingleDimensionSeriesColor(chart, tmp) } + + protected configLegend(chart: Chart, options: ScatterOptions): ScatterOptions { + const optionTmp = super.configLegend(chart, options) + if (!optionTmp.legend) { + return optionTmp + } + optionTmp.legend.marker.style = style => { + return { + r: 4, + fill: style.fill + } + } + return optionTmp + } + protected setupOptions(chart: Chart, options: ScatterOptions) { return flow( this.configTheme, diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/radar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/radar.ts index a2e01f71d4..31a38c0ef7 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/radar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/radar.ts @@ -220,6 +220,20 @@ export class Radar extends G2PlotChartView { } } + protected configLegend(chart: Chart, options: RadarOptions): RadarOptions { + const optionTmp = super.configLegend(chart, options) + if (!optionTmp.legend) { + return optionTmp + } + optionTmp.legend.marker.style = style => { + return { + r: 4, + fill: style.stroke + } + } + return optionTmp + } + protected setupOptions(chart: Chart, options: RadarOptions): RadarOptions { return flow( this.configTheme, diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/scatter.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/scatter.ts index 8c39c1110a..eb307fa3d9 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/scatter.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/scatter.ts @@ -248,6 +248,20 @@ export class Scatter extends G2PlotChartView { } } + protected configLegend(chart: Chart, options: ScatterOptions): ScatterOptions { + const optionTmp = super.configLegend(chart, options) + if (!optionTmp.legend) { + return optionTmp + } + optionTmp.legend.marker.style = style => { + return { + r: 4, + fill: style.fill + } + } + return optionTmp + } + protected setupOptions(chart: Chart, options: ScatterOptions) { return flow( this.configTheme,