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:
Evan Rusackas
2026-02-21 22:11:01 -08:00
parent 72d39bea85
commit 67d8ed5a70
2 changed files with 101 additions and 1 deletions

View File

@@ -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