Page 1 of 1
Change line color in a line chart
Posted: Mon Sep 10, 2012 6:18 pm
by 17763433
Dear friends,
I need to change the line color of a line chart based on a condition,
In one part blue and the other red.
As in the example file "chart.jpg."
Someone can tell me how can I do this?
Att
Osvano.
Re: Change line color in a line chart
Posted: Tue Sep 11, 2012 7:25 pm
by 17763433
Can anyone help me??
Sincerely,
Osvano
Re: Change line color in a line chart
Posted: Wed Sep 12, 2012 1:45 am
by 16461616
It looks to me like you cannot reproduce your example chart using a single Line series in the TeeChart. You can make your series' pointers visible and have a condition-based color for each pointer. Alternatively you can use a new Line series for each contiguous stretch of color that you want to display.
Good luck,
Rob Cooke
Re: Change line color in a line chart
Posted: Thu Sep 13, 2012 8:51 pm
by 17763433
Hello Rob Cooke
First, thank you for ideas.
When you say
"You can make your series' pointers visible and have a condition-based color for each pointer" would be done like this?
You have to send me an example?
I thank your attention,
Osvano.
Re: Change line color in a line chart
Posted: Fri Sep 14, 2012 2:32 am
by 16461616
Something like the code below. This isn't particularly well-documented, but your question was interesting to me so I spent a little time looking through teechart.js to see what was available.
Code: Select all
var Y = [{ array of series values } ];
var X = [{ array of series x-axis values } ];
var c = [{ array of HTML color values, one for each point in the series (ex. "#FF0000" ) } ];
var cht = new Tee.Chart("canvasID");
var srs = new Tee.Line();
srs.data.values = Y;
srs.data.x = X;
srs.palette.colors = c;
srs.colorEach = "yes";
srs.pointer.visible = true;
cht.addSeries(srs);