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

tooltip on stacked bar chart #1087

Closed
alsguimaraes opened this issue Jan 10, 2016 · 3 comments
Closed

tooltip on stacked bar chart #1087

alsguimaraes opened this issue Jan 10, 2016 · 3 comments

Comments

@alsguimaraes
Copy link

Congratulations on such great software!

There seems to be a bug on the stacked bar chart tooltip.
Note the basic example on the dc.js page.

http://dc-js.github.io/dc.js/examples/stacked-bar.html

The selection of a bar on each stack always shows the value for the first group.
I could not find a workaround, as I do not know how to identify on the tooltip function which stack is being highlighted/selected.
For now, I forced the tooltip function to show all values. But this is still not ideal, as only one stack is selected.

-Andre

@alan-unravel
Copy link
Contributor

The reason that happens is that the separate stacks all use the same key and get the title from the chart group and not the stacks. You can probably fix it using a renderlet that selects each stack and creates the titles accordingly for each stack.

@gordonwoodhull
Copy link
Contributor

You can use this.layer to determine the current stack, but that's an accident of the implementation using dc.pluck. Or you can set individual title functions for each stack using the specialized version of .title() in the stack mixin.

@gordonwoodhull
Copy link
Contributor

I'm fixing the example by using this.layer, which is perhaps cheating but at least it works.

In a way this is an instance of the inconsistency in #703 - in a lot of cases it's more useful to have the "outer datum" rather than just the data from the group. I believe this is why some charts supply one and some supply the other. I consider this problem a vote for the outer datum.

gordonwoodhull added a commit that referenced this issue Jan 11, 2016
fixes #1087, at least for now
"outer datum" is probably the proper solution here
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

No branches or pull requests

3 participants