refactor(图表): 折线图图例符号修改为实心 #12168

This commit is contained in:
wisonic 2024-09-26 17:26:55 +08:00
parent c9130a190a
commit d6677aa922

View File

@ -289,8 +289,11 @@ export class Line extends G2PlotChartView<LineOptions, G2Line> {
}
protected configLegend(chart: Chart, options: LineOptions): LineOptions {
const optionTmp = super.configLegend(chart, options)
if (!optionTmp.legend) {
return optionTmp
}
const xAxisExt = chart.xAxisExt[0]
if (optionTmp.legend && xAxisExt?.customSort?.length > 0) {
if (xAxisExt?.customSort?.length > 0) {
// 图例自定义排序
const l = optionTmp.legend
const basicStyle = parseJson(chart.customAttr).basicStyle
@ -303,11 +306,8 @@ export class Line extends G2PlotChartView<LineOptions, G2Line> {
marker: {
symbol: l.marker.symbol,
style: {
r: 6,
fill: 'rgba(0,0,0,0)',
lineWidth: 2,
lineJoin: 'round',
stroke: basicStyle.colors[index % basicStyle.colors.length]
r: 4,
fill: basicStyle.colors[index % basicStyle.colors.length]
}
}
})
@ -322,6 +322,12 @@ export class Line extends G2PlotChartView<LineOptions, G2Line> {
legend
}
}
optionTmp.legend.marker.style = style => {
return {
r: 5,
fill: style.stroke
}
}
return optionTmp
}
protected setupOptions(chart: Chart, options: LineOptions): LineOptions {