mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(echarts): Show full labels in bar chart tooltips
Fixes #31864 When bar chart axis labels are visually truncated by ECharts due to space constraints, the tooltip now shows the full label text by preferring the axisValue/axisValueLabel properties which contain the complete text. This allows users to hover over data points and see the full name even when the axis label is shortened for display purposes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1010,8 +1010,12 @@ export default function transformProps(
|
||||
trigger: richTooltip ? 'axis' : 'item',
|
||||
formatter: (params: any) => {
|
||||
const [xIndex, yIndex] = isHorizontal ? [1, 0] : [0, 1];
|
||||
// For axis tooltips, prefer axisValue/axisValueLabel which contains the full label
|
||||
// even when the axis label is visually truncated
|
||||
const xValue: number = richTooltip
|
||||
? params[0].value[xIndex]
|
||||
? (params[0].axisValue ??
|
||||
params[0].axisValueLabel ??
|
||||
params[0].value[xIndex])
|
||||
: params.value[xIndex];
|
||||
const forecastValue: CallbackDataParams[] = richTooltip
|
||||
? params
|
||||
|
||||
Reference in New Issue
Block a user