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

Message ListMessage List     Post MessagePost Message

  yZoneColor confusion
Posted by knewby on May-20-2011 04:18
Hi Peter -

I am trying to change the color of a line ($TripleSpotMin) to red when it's value is below the Spec (Min) line ($CoatWeightMin).  I'm using yZoneColor to do this, but it's not working.  I don't know what I'm doing wrong.  Any help is greatly appreciated!

$lineLayer2 = $c->addLineLayer();

# For Triple Spot Min Line: Red line (0xff0000) if < Spec Min and Blue line (0x0066cc) if > Spec Min
$lineLayer2->addDataSet($TripleSpotMin, $lineLayer2->yZoneColor($CoatWeightMin, 0xff0000, 0x0066cc), "Triple Spot Min");

$lineLayer2->setLineWidth(2);

So in this example, all of the line portions below 40 should be colored red...

  Re: yZoneColor confusion
Posted by knewby on May-20-2011 04:23
Attachments:
Sorry - forgot the chart pic for this question.
coatweight.GIF

  Re: yZoneColor confusion
Posted by Peter Kwan on May-21-2011 00:24
Hi knewby,

According to your code, the line color should depend in $CoatWeightMin. As I do not know what is $CoatWeightMin, it is hard to know if the chart you got is correct or incorrect.

To trouble-shoot the problem, may be you can modify your code to:

$lineLayer2->addDataSet($TripleSpotMin, $lineLayer2->yZoneColor(40, 0xff0000, 0x0066cc), "Triple Spot Min");

If the above code works (which has the y-zone hard coded to 40), that means your charting code is correct. If the y-zone color in your real code is not at the expected position, it is likely $CoatWeightMin is incorrect.

Hope this can help.

Regards
Peter Kwan

  Re: yZoneColor confusion
Posted by knewby on May-21-2011 04:48
Yes that helps Peter - It works with a constant of 40.  Thank you.

But $CoatWeightMin is an array of varying values - it is the red line on the chart.

$lineLayer = $c->addLineLayer();
$lineLayer->addDataSet($CoatWeightMin, 0xff0000, "Spec (Min)");

I was hoping that I could change the color of the $TripleSpotMin line when any of the $TripleSpotMin points fall below the corresponding points on the $CoatWeightMin line.  I don't know how to do this.

Thank you so much for your help!

  Re: yZoneColor confusion
Posted by Peter Kwan on May-22-2011 13:09
Hi knewby,

Unluckily, ChartDirector cannot change the color of a line based on whether it is above or below another line. It can only fill the region between 2 lines using different colors depending on which line is above the other line. (See the sample code "Line Comparison".)

Regards
Peter Kwan

  Re: yZoneColor confusion
Posted by knewby on May-23-2011 23:37
Peter -

Yay!!!!  The Line Comparison sample code was perfect!  Thank you again for your patience and advice!!!!

knewby