ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Line color based on +/- zero?
Posted by Steve on Sep-10-2021 02:38
I have a line chart that plots positive and negative values over time. Is there some way to color the line based on whether values are positive or negative?

I saw the example for a multi-color line chart https://www.advsofteng.com/doc/cdperl.htm#multicolorline.htm But that seems to assign colors to line segments.  That's not exactly what I want because a given segment might cross from + to - or vice versa.

  Re: Line color based on +/- zero?
Posted by Peter Kwan on Sep-11-2021 03:03
Hi Steve,

You can use a y-zone color as the line color:

$myLineColor = $c->yZoneColor(0, 0xff0000, 0x00cc00);
$c->addLineLayer($myData, $myLineColor);

See:

https://www.advsofteng.com/doc/cdperl.htm#XYChart.yZoneColor.htm

Regards
Peter Kwan