Description
Describe the bug
With the removal of default showLegendExtra
values on Ordinal
, the chart now incorrectly sizes legends with long showLegendExtra
values.
To Reproduce
Steps to reproduce the behavior:
- Go to http://localhost:9001/?path=/story/axes--different-tooltip-formatter
- Remove the
spacingBuffer
theme override - Notice the screenshot below.
Additional context
The defaultExtra
values are both null
elastic-charts/src/chart_types/xy_chart/legend/legend.ts
Lines 99 to 102 in 0e6353f
When the formatted value is used to determine the labels here
The defaultExtra
is thus omitted and never used in the size calculations rendering a narrow legend size.
I suspect a fix would be to calculate the last value even for Ordinal
scales and use a sample formatted value in the dimensions calculations, but still hide the default values on Ordinal
scales.
Expected behaviour
The legend should find the correct size including the showLegendExtra
content