From 0d01aee716a6a3f1a7621952f0755da47fe82bb5 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Tue, 12 Sep 2023 18:05:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E8=A1=A8=E5=A4=B4=E6=82=AC=E5=81=9C=E6=9C=AA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=8D=95=E5=85=83=E6=A0=BC=E5=85=A8=E9=83=A8=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/chart/table/table-info.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/frontend/src/views/chart/chart/table/table-info.js b/core/frontend/src/views/chart/chart/table/table-info.js index c860adbaac..3a17dbbbbd 100644 --- a/core/frontend/src/views/chart/chart/table/table-info.js +++ b/core/frontend/src/views/chart/chart/table/table-info.js @@ -334,6 +334,10 @@ export function baseTablePivot(s2, container, chart, action, headerAction, table const columns = [] const meta = [] + const fieldMap = fields.reduce((pre, next) => { + pre[next['dataeaseName']] = next['name'] + return pre + }, {}) // add drill list if (chart.drill) { @@ -486,10 +490,10 @@ export function baseTablePivot(s2, container, chart, action, headerAction, table // hover const size = customAttr?.size if (size?.tableRowTooltip?.show) { - s2.on(S2Event.ROW_CELL_HOVER, event => showTooltip(s2, event)) + s2.on(S2Event.ROW_CELL_HOVER, event => showTooltip(s2, event, fieldMap)) } if (size?.tableColTooltip?.show) { - s2.on(S2Event.COL_CELL_HOVER, event => showTooltip(s2, event)) + s2.on(S2Event.COL_CELL_HOVER, event => showTooltip(s2, event, fieldMap)) } // theme const customTheme = getCustomTheme(chart) @@ -703,10 +707,13 @@ function mappingColor(value, defaultColor, field, type) { return color } -function showTooltip(s2Instance, event) { +function showTooltip(s2Instance, event, fieldMap) { const cell = s2Instance.getCell(event.target) - const content = cell.actualText - + const meta = cell.getMeta() + let content = meta.value + if (fieldMap?.[content]) { + content = fieldMap?.[content] + } s2Instance.showTooltip({ position: { x: event.clientX,