Replies: 1 comment
-
|
I'm also wondering why this seems to be so challenging. I'm converting a series of charts built in the old victory API to victory-xl and unless I'm missing something the only way I can see to have the points colored differently based on their y value is to render a separate scatter component for each color group. Is there a technical reason why CartersianChart couldn't include a prop to pass additional serializable properties from the data array down to children, and not just x and y values? I have a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use the original example of Scatter plot, and I have some code so that I render a specific color of the scatter indicator based on data values - if above X color is red, otherwise green.
However, I am having issues with getting the colors to work:
here is example
DataPointbeing sent to thechartData:so I should be able to use
style.coloras I prepare thechartDatafor use byCartesianChartthe
accfrom above looks like:As you can see the data looks good - if standing there is
standingColor, and if seated, there isseatedColor:{"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731955151997}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731955013759}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954966457}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954747870}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954696996}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954689111}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954681908}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954576066}, {"goalLine": 500, "posture": "seated", "seated": 0, "seatedColor": "#FF4444", "x": 1731954323897}, {"goalLine": 500, "posture": "standing", "standing": 620.8000000000042, "standingColor": "#FFD700", "x": 1730228181959}, {"goalLine": 500, "posture": "seated", "seated": 624.2000000000049, "seatedColor": "#FFD700", "x": 1730227966403}, {"goalLine": 500, "posture": "standing", "standing": 543.9999999999867, "standingColor": "#FFD700", "x": 1729712680106}, {"goalLine": 500, "posture": "seated", "seated": 344.599999999989, "seatedColor": "#FF4444", "x": 1729712466684}, {"goalLine": 500, "posture": "standing", "standing": 6.200000000000003, "standingColor": "#FF4444", "x": 1729711901807}, {"goalLine": 500, "posture": "seated", "seated": 138.80000000000067, "seatedColor": "#FF4444", "x": 1729711897679}, {"goalLine": 500, "posture": "standing", "standing": 128.20000000000127, "standingColor": "#FF4444", "x": 1729520553302}how come I can render
points.seated,but notpoints.seatedColor?I figured I could try to map the current point index to the original chartData and get the color, but there's no index or callback from
colorprop.Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions