Merge pull request #12763 from dataease/pr@dev-v2@refactor_chart_legend_size_style

refactor(图表): 统一图例的图标大小和样式
This commit is contained in:
wisonic-s 2024-10-18 11:15:25 +08:00 committed by GitHub
commit 26364b19a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 1 deletions

View File

@ -295,7 +295,9 @@ export class Map extends L7PlotChartView<ChoroplethOptions, Choropleth> {
color: legend.color
},
'l7plot-legend__category-marker': {
...LEGEND_SHAPE_STYLE_MAP[legend.icon]
...LEGEND_SHAPE_STYLE_MAP[legend.icon],
width: '8px',
height: '8px'
}
}
}

View File

@ -401,6 +401,7 @@ export class Quadrant extends G2PlotChartView<ScatterOptions, G2Scatter> {
}
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<ScatterOptions, G2Scatter> {
}
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<ScatterOptions, G2Scatter> {
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,

View File

@ -220,6 +220,20 @@ export class Radar extends G2PlotChartView<RadarOptions, G2Radar> {
}
}
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,

View File

@ -248,6 +248,20 @@ export class Scatter extends G2PlotChartView<ScatterOptions, G2Scatter> {
}
}
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,