Skip to content

VisualMap: compute colors depending on values #15926

@KrzysztofMadejski

Description

@KrzysztofMadejski

What problem does this feature solve?

Sometimes I do not know all the values that will come from the backend. Still, I'd like specific values/categories to have stable colors no matter how many or in which order will be retrieved.

Currently I do have defined colors for a few values and for the rest I'm hashing the values and generating unique color codes, but I have to do it by generating chart/series.color property based on the data. I'd prefer to have a native way of doing it in ECharts.

What does the proposed API look like?

Introduce third way of mapping next to 'Linear Mapping' and 'Table Mapping'. It could be called 'Functional Mapping'.

Each of the visual channels (color, symbol, etc.) could take a function apart from an array or a map. Implementation would be very similar to Table Mapping, but instead of:

channel[value]

would do

channel(value)

Seems like a relatively easy change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enThis issue is in Englishnew-featurestaleInactive for a long time. Will be closed in 7 days.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions