Giter Site home page Giter Site logo

Comments (6)

gordonwoodhull avatar gordonwoodhull commented on May 19, 2024

Thanks for filing this, @lipingyang-geoai!

It looks like it may be confused between alphabetical and numeric order... notice that the colors are contiguous e.g. from 1,10 to 1,19 on the chart (slice 2-11 clockwise from the top), but have gaps where alphabetic and numeric order disagree.

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.

image

from dc.js.

lipingyang-geoai avatar lipingyang-geoai commented on May 19, 2024

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.

from dc.js.

gordonwoodhull avatar gordonwoodhull commented on May 19, 2024

Whoops, meant to look at the last week. Will try to look tomorrow!

Should not be complicated, probably a scale configured wrong or something.

from dc.js.

lipingyang-geoai avatar lipingyang-geoai commented on May 19, 2024

sounds great. look forward to your suggestions!

from dc.js.

gordonwoodhull avatar gordonwoodhull commented on May 19, 2024

I haven't dug into the exact cause here, but it looks like you can get consistent colors by making sure the colorAccessor for the sunburst chart uses the last part of the key:

        .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:

this.colorAccessor(d => this.keyAccessor()(d));

However, there may be a cleaner fix, so let's leave this open in case someone wants to investigate why this is happening.

from dc.js.

lipingyang-geoai avatar lipingyang-geoai commented on May 19, 2024

@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!

from dc.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.