Home › forums › Using CanvasJS › can line chart – a coloured snake based on dataVariable
Tagged: colour, Line, variable
This topic contains 1 reply, has 2 voices, and was last updated by Suyash Singh 2 years, 7 months ago.
i need to know how to make each x-length of a line chart (not the whole line) change colour based on a value.
So the output would look line a normal line chart (a single ‘snake’) but with gradation of colour along the snake based on a data variable
– say i have data values: x, y and z
– the x and y data makes a normal line chart, no problem.
– the z data should control the COLOUR of the line for that little bit of the line.
– so say z can go from -5 to +5 then this would be represented in the chart by colour going from, say, red to green
– it would be shown only in that particular segment (i.e. for that X value until the next X value) of the same single x-y line
is it possible to override a charts lineColour ‘locally’, like this?
Please check this jsfiddle.
You must be logged in to reply to this topic.