-
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
dc sunburst chart -- color of legend and the chart does NOT match #1864
Comments
Thanks for filing this, @lipingyang-geoai! It looks like EDIT: numeric order would make the colors contiguous, and make more sense for this example, but it is the multikeys that cause the legend to differ from the chart. |
Thanks, Gordon @gordonwoodhull, still not able to figure this out. I checked all three sunburst examples on the dc.js examples page, seem all sunburst chart has the same issue, the color scheme of the legend does not match that of the chart. Is that the way it should be?? Thanks. |
Whoops, meant to look at the last week. Will try to look tomorrow! Should not be complicated, probably a scale configured wrong or something. |
sounds great. look forward to your suggestions! |
I haven't dug into the exact cause here, but it looks like you can get consistent colors by making sure the .colorAccessor(d => {
var key = d.key;
if(Array.isArray(key))
key = key[key.length-1];
return key;
}) I am not sure why it is sometimes getting called with a scalar number and sometimes with the multikey array. This probably has something to do with the problem! I quickly tried pasting the above code into the other three sunburst examples, and it seems to fix them. Presumably it could be changed in the sunburst constructor, which currently uses the key accessor for the color accessor: dc.js/src/charts/sunburst-chart.js Line 66 in 0412000
However, there may be a cleaner fix, so let's leave this open in case someone wants to investigate why this is happening. |
@gordonwoodhull Thank you so much, Gordon, You ROCK! it works! Ok, I will leave this issue open. But Thank you so much again! Very best! |
In the dc sunburst chart (see this example https://dc-js.github.io/dc.js/examples/sunburst.html), the color of the legend seems does not match the color of the sunburst chart. Any hints and suggestions to make the color scheme match? otherwise it is misleading and confusing. thanks.
The text was updated successfully, but these errors were encountered: