|
Multicolored line graph. |
Posted by Brian on Aug-01-2018 00:25 |
|
Hi,
Does anyone know if it possible to to have a single line graph where the line changes color depending on the value ranges that have been set in code?
Thanks
Brian. |
Re: Multicolored line graph. |
Posted by Brian on Aug-01-2018 20:49 |
|
Hi,
I may not have explained myself very well, I have attached an image of the time of chart I'm trying to achieve. Any advice would be greatly appreciated,
Thanks
Brian.
|
Re: Multicolored line graph. |
Posted by Brian on Aug-02-2018 00:57 |
|
Hi Peter,
I believe i have found a solution that's to a previous post on the forum.
I have pasted my code below for others who may need it/ for you to review if there is a better way to do this.
redLayer = c.addLineLayer2();
double[] data0Y = y0Values.ToArray();
int green = 0x00ff08;
int yellow = 0xfcfc00;
int red = 0xff0000;
int myLineColor = c.yZoneColor(8, green, c.yZoneColor(10, yellow, red));
redLayer.addDataSet(data0Y, myLineColor).setDataSymbol(Chart.GlassSphere2Shape, 11);
redLayer.setXData(data0X);
redLayer.setLineWidth(3); |
Re: Multicolored line graph. |
Posted by Peter Kwan on Aug-02-2018 02:44 |
|
Hi Brian,
Your method (nested y-zone colors) is exactly the one I would suggest.
In your code, the symbol would also change color. If you would like the symbol to have a single color, you can set the symbol color like:
redLayer.addDataSet(data0Y, myLineColor).setDataSymbol(Chart.GlassSphere2Shape, 11, 0x888888, 0x888888);
Regards
Peter Kwan |
|