fix(图表): 修复从对称条形图切换为柱线组合组后,右轴显示不正确的问题

This commit is contained in:
ulleo 2024-06-05 11:25:10 +08:00
parent 049c661fd5
commit 3ba3ed27e4

View File

@ -246,21 +246,17 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
...options
}
tempOption.yAxis = {}
if (!yAxis) {
//左右轴都要隐藏
tempOption.yAxis = {
value: false,
valueExt: false
}
tempOption.yAxis.value = false
} else {
tempOption.yAxis = {
value: undefined,
valueExt: undefined
}
}
tempOption.yAxis.value = undefined
yAxis.position = 'left'
const yAxisTmp = parseJson(chart.customStyle).yAxis
if (yAxis.label) {
yAxis.label.style.textAlign = 'end'
yAxis.label.formatter = value => {
return valueFormatter(value, yAxisTmp.axisLabelFormatter)
}
@ -278,9 +274,18 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
} else {
tempOption.yAxis.value = yAxis
}
}
if (!yAxisExt) {
//左右轴都要隐藏
tempOption.yAxis.valueExt = false
} else {
tempOption.yAxis.valueExt = undefined
yAxisExt.position = 'right'
const yAxisExtTmp = parseJson(chart.customStyle).yAxisExt
if (yAxisExt.label) {
yAxisExt.label.style.textAlign = 'start'
yAxisExt.label.formatter = value => {
return valueFormatter(value, yAxisExtTmp.axisLabelFormatter)
}
@ -298,6 +303,7 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
} else {
tempOption.yAxis.valueExt = yAxisExt
}
}
return tempOption
}