Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing legend keys on bar charts with zero data values #219

Closed

Conversation

martinalexrolph
Copy link

Fix for #111 and #218 (duplicate).

See #218 for a detailed explanation of the issue and approach but the summary is that by filtering out zero-height bars before generating the legend, if a bar doesn't show in the first group of bars (because it has a value at or close to zero) it doesn't appear in the legend. To fix, remove this filter and add filtering just before the graphs are rendered.

I think this approach is better than #128 because with that method it appears that if a key has value 0 across the whole range covered by the graph, it will not appear in the legend. In our use case this is quite common as you can set the date range of the graph and some of the keys may have no data in them for certain periods of time. The key should still appear in the legend so it is clear that the value is zero, rather than just not included in the graph.

@taschetto
Copy link

@plouc is there a workaround while this PR isn't merged?

@plouc
Copy link
Owner

plouc commented Dec 2, 2018

Fixed by #362, it doesn't cover the case where all values are 0, but I'm not sure we should show the legend as nothing will correspond in the chart.

@plouc plouc closed this Dec 2, 2018
@AntonPuko
Copy link

@plouc Hi.
I want to make a real time chart that looks like this
image
so, some or all values can be missed in the first data array item. But it obviously that in my case the legend should be shown all the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants