fix(图表): 修复柱线组合图修改指标显示名称后,图例没有变化的问题

#10009
#10277
This commit is contained in:
ulleo 2024-07-02 18:19:22 +08:00
parent 2b0169295f
commit cd3847d5fe

View File

@ -423,9 +423,9 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
formatter: (text: string, item: any, index: number) => { formatter: (text: string, item: any, index: number) => {
let name = undefined let name = undefined
if (item.viewId === 'left-axes-view' && text === 'value') { if (item.viewId === 'left-axes-view' && text === 'value') {
name = left[0]?.name name = left[0]?.categories[0]
} else if (item.viewId === 'right-axes-view' && text === 'valueExt') { } else if (item.viewId === 'right-axes-view' && text === 'valueExt') {
name = right[0]?.name name = right[0]?.categories[0]
} }
item.id = item.id + '__' + index //防止重复的图例出现问题但是左右轴如果有相同的怎么办 item.id = item.id + '__' + index //防止重复的图例出现问题但是左右轴如果有相同的怎么办
if (name === undefined) { if (name === undefined) {