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

Fixes bubble chart filtering issues #1025

Merged
merged 2 commits into from
Nov 11, 2015

Conversation

mtraynham
Copy link
Contributor

Bubble charts have a label, that is not always visible given a particular radius. It's hidden by setting opacity=0. Unfortunately this still allows you click the text, and filter the bubble. This is problematic as a user can select a bubble that may be close to another bubble and filter the wrong one, because the label was long or the bubbles overlap... Adding a style='display: none/block' update to the selection does work, but to prevent any interaction with the opacity working properly, it needs to happen after the transition. Thus, dc.afterTransition was added.

The other issue with bubble charts, small bubbles may be hidden behind large bubbles. Sorting the data descending by radius before hand, ensures that larger bubbles are first in the data and thus higher in the DOM, behind smaller bubbles. A call to d3.selection.order is required for them to properly be sorted.

@mtraynham
Copy link
Contributor Author

One thing I noticed... keyAccessor is a terrible function name for this chart. It would be nice to call it xAccessor, and actually have a keyAccessor that corresponds to d.key, instead of hardcoding it.

@gordonwoodhull
Copy link
Contributor

I definitely agree with the small bubbles change, and .dc.afterTransition is a welcome addition.

But wouldn't pointer-events: none be an easier way to make the labels non-clickable?

@mtraynham
Copy link
Contributor Author

Ahh, you know what, it probably would be.

@gordonwoodhull
Copy link
Contributor

Yep, that's one of those OO inheritance pitfalls. keyAccessor mostly makes sense for the other coordinate grid charts, but very little sense here. Especially horrible that, out of foolish consistency, there is no key accessor for this chart, as you point out.

I had to implement dc.afterTransition for dc.graph.js... Hmm.

@mtraynham
Copy link
Contributor Author

Updated with pointer-events instead.

Yeah, not sure what to do about that keyAccessor. I had to hack my own code's data function to loop the data and append a key field to every datum. Not terrible, unless the data from the server already has a key field, then I'm screwed...

@gordonwoodhull
Copy link
Contributor

I think we could fix it with a breaking change of xAccessor, as you suggest. Technically I guess a bubbleChart is not a coordinateGridMixin but something else. Or maybe all coordinateGridMixins should have an xAccessor, just usually defaulting to the the keyAccessor.

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Oct 14, 2015
@gordonwoodhull
Copy link
Contributor

I am making bubbleSortSize an option (defaulting to old non-sorted behavior) and merging for 2.0 beta 21

Thanks @mtraynham!

@gordonwoodhull gordonwoodhull merged commit 430d711 into dc-js:master Nov 11, 2015
gordonwoodhull added a commit that referenced this pull request Nov 11, 2015
@mtraynham mtraynham deleted the bubble_chart_updates branch November 12, 2015 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants