Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

allows Line shapes to be color by colorScale value#182

Merged
ffigueroal merged 1 commit intomasterfrom
fix/line-colorScale
Jul 18, 2022
Merged

allows Line shapes to be color by colorScale value#182
ffigueroal merged 1 commit intomasterfrom
fix/line-colorScale

Conversation

@davelandry
Copy link
Copy Markdown
Member

Line shapes have a static colorAssign function in the default config, which overwrites the colorScale logic that is typically interited by the default shapeConfig.fill in the Viz class.

Removing this one line allows Lines to be colored using colorScale, with one caveat:

If users do not want the sum of all values in a Line to be used, then they must define a custom aggs function.

As an example, here is how you would color something using the max value (cc @AlanORB):

.config({
  aggs: {
    "Growth %": (arr, cb) => Math.max(...arr.map(cb))
  },
  colorScale: "Growth %",
})

@davelandry davelandry requested a review from ffigueroal July 15, 2022 22:45
@davelandry davelandry self-assigned this Jul 15, 2022
@ffigueroal ffigueroal merged commit 2359b54 into master Jul 18, 2022
@ffigueroal ffigueroal deleted the fix/line-colorScale branch July 18, 2022 19:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants