Skip to content

classes() and domain() order depedendent #371

@EliotRagueneau

Description

@EliotRagueneau

Hi,

I noticed a bug on version 3.1.2 which was hard to understand because of the order I called the function, I don't think that should be the case.

      console.log(chroma.scale(['black', 'white']).domain([-2,2]).classes(5).colors(5, 'hex')) 
# ['#000000', '#404040', '#808080', '#bfbfbf', '#ffffff']
      console.log(chroma.scale(['black', 'white']).classes(5).domain([-2,2]).colors(5, 'hex'))
# ['#000000', '#000000', '#000000', '#ffffff', '#ffffff']

The same goes when manually picking colors on the range with scale(x): if the .classes() function is called before the .domain(), the results are completely different and, in my case, no longer respect the number of classes (goes from 5 to 2).

It might be related to #329 but I'm not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions