diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts index 3162c22a53..a4b539e5da 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts @@ -13,7 +13,8 @@ import { configPlotTooltipEvent, configYaxisTitleLengthLimit, getTooltipContainer, - TOOLTIP_TPL + TOOLTIP_TPL, + getPadding } from '../../common/common_antv' import { DEFAULT_LEGEND_STYLE } from '@/views/chart/components/editor/util/chart' @@ -209,7 +210,7 @@ export class Quadrant extends G2PlotChartView { data: data, xField: 'yAxis', yField: 'yAxisExt', - appendPadding: 30, + appendPadding: getPadding(chart), pointStyle: { fillOpacity: 0.8, stroke: '#bbb' diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts index 266cdd260a..4544cb7b14 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts @@ -2098,10 +2098,12 @@ export function configYaxisTitleLengthLimit(chart, plot) { ? wrappedTitle.slice(0, wrappedTitle.length - 2) + '...' : wrappedTitle + '...' } - // 更新Y轴标题的原始文本和截断后的文本 - ev.view.options.axes.yAxisExt.title.originalText = yAxis.name - ev.view.options.axes.yAxisExt.title.text = wrappedTitle + const { title } = ev.view.options.axes.yAxisExt + if (title) { + title.originalText = yAxis.name + title.text = wrappedTitle + } }) }