-
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
Append choropleth titles by default #1080
Conversation
Thanks @ferblape. By "resilient", you mean the titles are currently disappearing, or not getting updated? |
I meant not getting updated. |
I've encountered this before, the code should be
https://bost.ocks.org/mike/nest/ Using |
I looked into this as part of #1239 and added tests for the case where new data objects are supplied for each redraw in aa27858. I don't get it. It's not using data binding for the title! Here is the current source: regionG.selectAll('title').text(function (d) {
var key = getKey(layerIndex, d);
var value = data[key];
return _chart.title()({key: key, value: value});
}); dc.js/src/geo-choropleth-chart.js Lines 158 to 162 in 3168274
So if anyone can please tell me how the above code does not replace the titles with the current data, I am quite frustrated by this and would desire an explanation. The only thing I can see might not be replaced is the key from the geoJson data, certainly not the value from the crossfilter data. But this chart does not support replacing the geoJson data with a redraw, you must render again. So I would think there would be a lot more broken than just the titles in that case. @ferblape, is there any chance you can provide an example (e.g. a block or a fiddle) where titles fail to update? I really need a test for this, to make sure we are doing the right thing. |
Of course @gordonwoodhull, I'll check the old code and create a block. |
Sorry for the delay, these dates are a bit complicated. Thing is that after investigating a bit I've found that the problem was in my code. It's very hard to explain, and I can't create a blocks because the setup it's a bit complicated, and the information we are visualizing is sensitive. But, as a summary, I was using tipsy.js to display nice tooltips, and I was replacing the attribute title by an element original-title, because otherwise I had two titles, the one from tipsy and the one native from the browser. That was causing something strange that I can't reproduce, but, if I remove tipsy.js and I use the standar Please, fell free to close and ignore this PR. If you want to test it yourself maybe we could find a way for you to view it in my laptop. So sorry for the mess, and thanks for the interest! |
Thanks for your response, @ferblape! That's a big relief because I was afraid there was still another level of complication in these data joins that I didn't know about. The way the choropleth binds data is odd, and IMO somewhat backwards, but in this case it should avoid the problem that @mtraynham has pointed out in many other charts. Other folks have run into trouble adding d3-tip to choropleths, and there we determined that the problem was this strange data binding, which makes the map data available but not the reduced crossfilter(ish) data. |
This PR tries to make the creation of the titles in choropleth graphs more resilient.
I have just copied how titles are built in other graphs, such as rowCharts.