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

Two 'bar' traces are not showing with empty data #1310

Closed
sandertar opened this issue Jan 18, 2017 · 2 comments · Fixed by #1369
Closed

Two 'bar' traces are not showing with empty data #1310

sandertar opened this issue Jan 18, 2017 · 2 comments · Fixed by #1369

Comments

@sandertar
Copy link

sandertar commented Jan 18, 2017

Hi! I try to create two time series with type 'bar'.
One trace didn't contain any data, but this one should be shown in legend. To make this trace visible in legend, I have set x: [null] and y: [null];
But in this case both series are not displaying.
https://codepen.io/sandertar/pen/VPmOdK
Is there any other way to make label visible in legend for trace without data?

@sandertar sandertar changed the title Two 'bar' trace are not showing with empty data Two 'bar' traces are not showing with empty data Jan 18, 2017
@etpinard
Copy link
Contributor

etpinard commented Jan 18, 2017

Thanks for writing in. Your codepen points a few separate issues.

First, https://codepen.io/etpinard/pen/xggwYq is probably the best you can do with the current version. You might not like that the trace 1 legend item is semi-transparent, our apologies 😃

Looks like there's a bug with how the null trace interacts with other the trace to compute the bar widths. This bug should be easy to fix.

Moreover, I believe that something like

trace = {
  visible: true,
  x: [],
  y: []
}

where the user explicitly set visible: true should appear in the legend. At the moment, traces with x.length === 0 and y.length === 0 are taken to be visible: false no matter what the users inputs. Modifying this logic would be a much longer and harder project; I can't guarantee it's going to happen.

@sandertar
Copy link
Author

Ok, thanks

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

Successfully merging a pull request may close this issue.

2 participants