I currently have a dataset and I'd like to split the color of the line it produces at a certain point (before the point is green, after is red, for example). Is there any way to do this or would I have to render two separate lines onto the graph?
Asked
Active
Viewed 470 times
2
-
this might be helpful to you , please check http://stackoverflow.com/questions/28159595/chartjs-different-color-per-data-point – komal May 15 '17 at 20:23
-
1that is related to the point color, whereas I am interested in changing the color of the line between the points – user2036108 May 15 '17 at 20:24
1 Answers
0
This is currently not possible (in version 2.9.4). I checked the code in the GitHub repository to verify this: https://github.com/chartjs/Chart.js/blob/v2.9.4/src/elements/element.line.js
In the draw
method the color to draw the lines is set only once, without a way to use different colors for different line segments.
The master branch (containing 3.0.0 beta code) also has no way to specify different colors for different line segments.

vividos
- 6,468
- 9
- 43
- 53