elastic / elastic-charts

https://elastic.github.io/elastic-charts/storybook
Other
371 stars 120 forks source link

[Waffle] Calculating values for Legend items not working well for some cases. #1512

Closed alexwizp closed 2 years ago

alexwizp commented 2 years ago

Describe the bug: This issue was based on https://github.com/elastic/kibana/pull/119339#issuecomment-981584962

Summary:

Screenshot 2021-11-29 at 13 20 44

I cannot make sense of this legend vs tooltip information. The tooltip says there's 4 records in range 0.0$, but the legend says 0.0$ 0. Am I missing something or is there a bug?

Screenshot 2021-11-29 at 13 22 14

I see that it happens if value is 0

markov00 commented 2 years ago

that's odd, I can clearly spot that the 0 is even not styled as the other texts:

Screenshot 2021-12-02 at 13 36 06

Checking the DOM, that 0 is not on the extra parameter, but something added to the DOM. @rshen91 can you please take a look here? I can't reproduce it directly within elastic charts storybook. I'm trying with a dataset that, within Lens shows that issue but not in charts only

data={[
          [0, 1161],
          [20, 1391],
          [40, 519],
          [60, 519],
          [80, 119],
          [100, 73],
          [120, 8],
          [140, 24],
          [160, 10],
          [180, 1],
          [200, 6],
          [340, 1],
          [400, 1],
          [420, 1],
          [1080, 1],
        ].map((d) => [`${d[0].toFixed(2)}$`, d[1]])}
rshen91 commented 2 years ago
Screen Shot 2021-12-27 at 10 05 34 AM

Confirming what Marco saw earlier - digging in the kibana code base to see what's overriding the legend item extra parameter 👀

Seeing this issue in a similar waffle chart with a title of $0.00, again, weird formatting and #text vs. using the legendItem extra value

Screen Shot 2021-12-27 at 8 10 07 PM
rshen91 commented 2 years ago

Ok I got this to be reproduced on the elastic charts side whew!