patternfly-react icon indicating copy to clipboard operation
patternfly-react copied to clipboard

Bug - Stack Charts - lines render weirdly if they have no data

Open alexcreasy opened this issue 1 year ago • 5 comments
trafficstars

Describe the problem When using stack charts with multiple lines, if there is no data (i.e. an empty array) for one of the lines it will render very bizarrely (see gif below).

How do you reproduce the problem? Create a stack chart with multiple lines, and pass an empty array as the data property to one of the ChartArea components. You'll see that the line will be plotted from x0,y0 to xmax, ymax.

As shown in the GIF below, this can be reproduced on the PF website here: https://www.patternfly.org/charts/stack-chart#multi-color-unordered-responsive-container

Expected behavior The line is not rendered if the data prop is an empty array.

Is this issue blocking you? No, we can work around using conditional rendering when e.g. prometheus gives us an empty array.

Screenshots Aug-14-2024 14-27-03

What is your environment?

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

What is your product and what release date are you targeting? RHOAI

Any other information?

alexcreasy avatar Sep 12 '24 13:09 alexcreasy

cc @dlabrecq

tlabaj avatar Sep 12 '24 14:09 tlabaj

This appears to be a known issue with VictoryStack.

I can reproduce using a VictoryStack stack example.

Screenshot 2024-09-12 at 1 45 29 PM

If there is no data, omit the ChartArea component from the chart. Alternatively, you can use data={[null]}.

dlabrecq avatar Sep 12 '24 17:09 dlabrecq

@alexcreasy can we close this since it is a Victory issue. Dan has provided a work around.

tlabaj avatar Sep 19 '24 15:09 tlabaj

@dlabrecq that victory bug has been closed for a couple of years? Is PF Charts using an older version right now, or should I look to reopen the bug with Victory?

I've already got a workaround in place for this issue on our dashboard, so that's not a problem. The reason I'd like to get this fixed is that this bug showed up in production, took a long time to figure out the root cause of and the same issue has cropped up for another dev working on a different area of our product who went through the same process.

@tlabaj thanks for the response, if possible I'd rather get this fixed so that people don't lose more time, or have more bugs show up in production.

alexcreasy avatar Oct 16 '24 16:10 alexcreasy

Like I suggested above, omit the component from the chart if there is no data. Alternatively, you can use data={[null]}.

If this does not work for you, please open an issue with Victory.

dlabrecq avatar Oct 21 '24 12:10 dlabrecq

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Dec 25 '24 11:12 github-actions[bot]

Since this is more a Victory issue and there are workarounds in the PF chart, I'll close this. Opening an issue with Victory may be the next best course of action as mentioned above, but if there is an issue on our end please let us know or open a followup issue.

thatblindgeye avatar Jan 30 '25 14:01 thatblindgeye