From ee330de238cce88b9d94919f61b06c8daab509bb Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Mon, 25 May 2026 15:32:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=A3=E7=82=B9=E5=9B=BE):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96y=E8=BD=B4=E5=88=BB=E5=BA=A6=E5=92=8C=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A0=B7=E5=BC=8F=EF=BC=8C=E8=B0=83=E6=95=B4=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E4=BD=8D=E7=BD=AE=E5=8F=8A=E6=96=87=E6=9C=AC=E5=AF=B9?= =?UTF-8?q?=E9=BD=90=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/g2/relation/scatter.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/relation/scatter.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/relation/scatter.ts index 686cb6c894..03b5c2c8e6 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/relation/scatter.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/relation/scatter.ts @@ -109,6 +109,11 @@ export class Scatter extends G2ChartView { y: 'value', color: 'category' }, + scale: { + y: { + nice: true + } + }, legend: { size: false } @@ -236,14 +241,17 @@ export class Scatter extends G2ChartView { const value = valueFormatter(d.value, label.labelFormatter) return toString(value) }, - position: 'top', + position: 'inside', style: { fill: label.color, fontSize: label.fontSize, - textBaseline: 'bottom', + textAlign: 'center', + textBaseline: 'middle', fillOpacity: 1 }, - transform: label.fullDisplay ? [] : [{ type: 'overlapHide' }, { type: 'exceedAdjust' }] + transform: label.fullDisplay + ? [{ type: 'exceedAdjust' }] + : [{ type: 'exceedAdjust' }, { type: 'overlapHide' }] } ] } @@ -468,6 +476,7 @@ export class Scatter extends G2ChartView { const scaleOpt = { scale: { y: { + nice: false, domainMin: yAxis.axisValue.min, domainMax: yAxis.axisValue.max, tickCount: yAxis.axisValue.splitCount < 2 ? 2 : yAxis.axisValue.splitCount, @@ -483,6 +492,11 @@ export class Scatter extends G2ChartView { } } defaultsDeep(axisOption, scaleOpt) + const result = defaultsDeep(options, axisOption) + if (result.scale?.y) { + result.scale.y.nice = false + } + return result } return defaultsDeep(options, axisOption) }