From 3ba3ed27e47a4fcea27286e1e62ecd3aad6bd35f Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 5 Jun 2024 11:25:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=8E=E5=AF=B9=E7=A7=B0=E6=9D=A1=E5=BD=A2=E5=9B=BE=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=E6=9F=B1=E7=BA=BF=E7=BB=84=E5=90=88=E7=BB=84?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=8F=B3=E8=BD=B4=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/others/chart-mix.ts | 88 ++++++++++--------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts index c69513fc4a..18c5a45910 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts @@ -246,57 +246,63 @@ export class ColumnLineMix extends G2PlotChartView { ...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) + } + } + const axisValue = yAxisTmp.axisValue + if (!axisValue?.auto) { + tempOption.yAxis.value = { + ...yAxis, + min: axisValue.min, + max: axisValue.max, + minLimit: axisValue.min, + maxLimit: axisValue.max, + tickCount: axisValue.splitCount + } + } else { + tempOption.yAxis.value = yAxis } } - const yAxisTmp = parseJson(chart.customStyle).yAxis - if (yAxis.label) { - yAxis.label.formatter = value => { - return valueFormatter(value, yAxisTmp.axisLabelFormatter) - } - } - const axisValue = yAxisTmp.axisValue - if (!axisValue?.auto) { - tempOption.yAxis.value = { - ...yAxis, - min: axisValue.min, - max: axisValue.max, - minLimit: axisValue.min, - maxLimit: axisValue.max, - tickCount: axisValue.splitCount - } + if (!yAxisExt) { + //左右轴都要隐藏 + tempOption.yAxis.valueExt = false } else { - tempOption.yAxis.value = yAxis - } + tempOption.yAxis.valueExt = undefined + yAxisExt.position = 'right' - const yAxisExtTmp = parseJson(chart.customStyle).yAxisExt - if (yAxisExt.label) { - yAxisExt.label.formatter = value => { - return valueFormatter(value, yAxisExtTmp.axisLabelFormatter) + const yAxisExtTmp = parseJson(chart.customStyle).yAxisExt + if (yAxisExt.label) { + yAxisExt.label.style.textAlign = 'start' + yAxisExt.label.formatter = value => { + return valueFormatter(value, yAxisExtTmp.axisLabelFormatter) + } } - } - const axisExtValue = yAxisExtTmp.axisValue - if (!axisExtValue?.auto) { - tempOption.yAxis.valueExt = { - ...yAxisExt, - min: axisExtValue.min, - max: axisExtValue.max, - minLimit: axisExtValue.min, - maxLimit: axisExtValue.max, - tickCount: axisExtValue.splitCount + const axisExtValue = yAxisExtTmp.axisValue + if (!axisExtValue?.auto) { + tempOption.yAxis.valueExt = { + ...yAxisExt, + min: axisExtValue.min, + max: axisExtValue.max, + minLimit: axisExtValue.min, + maxLimit: axisExtValue.max, + tickCount: axisExtValue.splitCount + } + } else { + tempOption.yAxis.valueExt = yAxisExt } - } else { - tempOption.yAxis.valueExt = yAxisExt } return tempOption