-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Sync highlight between multiple bar charts #682
base: master
Are you sure you want to change the base?
Conversation
@gordonwoodhull what do you think of this approach? |
if (!arguments.length) return _syncGroup; | ||
//TODO Check if it isn't already added | ||
_syncGroup = _; | ||
_syncGroup.push(_chart); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In current implementation, user needs to send an array, but maybe will be better if they just send a string and we could have central registry for this groups.
Hi Wladimir, I've tried your patch - since I'm using row chart, and not bar chart, I had to manually apply the same changes to row chart code. It worked fine! On nit was that I had to use
in the onClick method, with Also, maybe this behaviour should be automatic? I.e. should not all charts using the same dimension be part of the same sync group automatically? |
Yeah, I think this is very close to the right solution. Note that the same problem arises with composite charts, which are another form of charts sharing the same dimension. See #390 and linked issues. As to @vprus's question whether the behavior should be automatic: that sounds reasonable (as long as there is a way to opt out). However, off the top of my head, I can't think how to implement it, because dc.js doesn't maintain a directory of dimensions and their associated charts. A hacky way would be to actually annotate the dimension object, but that's pretty weird and would undoubtably cause problems for people who are stubbing out crossfilter with some other backend. |
Sorry for the slow reply. I've started reviewing this. I don't know what it is about the dc.js zeitgeist, but once someone asks for a feature, everyone is asking for it. Some comments:
|
WIP
Demo plunker
Related to #681