Scatterplot node colors per object key - possible? #1961
Unanswered
chris-at-lemon
asked this question in
Q&A
Replies: 1 comment
-
Hi @chris-at-lemon. The scatterplot can display multiple series, see here for an example. In your case, you could split your data into two series, one for "sold" items and another for the rest. The colors would be assigned by series id in the usual way. An advantage of this approach is that the chart could automatically create a legend to explain what the colors stand for. I see you are using a custom layer in the sandbox to draw a line. That would still work, and you can consider drawing lines from each series separately or from the pooled data, depending on your use case. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
Scatterpplot doesn't seem to return anything from the color object but serieId string:
colors={(colorObj) => console.log(colorObj)} // serieId: "someString"
I wanted to color nodes respective to one of the keys in th data objects I am charting.
You can see a sample here:
https://codesandbox.io/s/scatterplot-custom-layer-iqb2ox
I thought I could use a function in the color, sth like this:
color={(node) => node.status === 'sold' ? 'red' : 'green'}
... but it seems there's nothing I can hook into.
Is there something I'm missing?
Thanks for any tips on how I could achieve this.
Chris
Beta Was this translation helpful? Give feedback.
All reactions