|
How to show peaks/lows |
Posted by icasper on Feb-27-2012 09:04 |
|
Hi, Please see attached.
How can I show the same using ChartDirector. I would appreciate, if you can give a PHP based example.
Thanks...
|
Re: How to show peaks/lows |
Posted by Peter Kwan on Feb-28-2012 02:07 |
|
Hi icasper,
To show the peaks/lows similar to the chart you attached, you would need to determine what are the peaks/lows. (The "peaks/lows" in the chart you attached seems strange. For example, it can have two consecutive "lows" without a "peak" in between. Anyway, there must be an algorithm that can produce these strange positions.)
After your code have defined what are the lows, you can put it in an array similar to the low price array. You just need to replace all the values that are not lows with NoValue, and keep the values that you think are lows. Then you can use:
$myLowsLayer = $myMainPriceChart->addLineLayer($myLowsArray, Transparent);
$t = $myLowsLayer->setDataLabelStyle("arial.ttf", 8);
$t->setAlignment(Top);
$t->setBackground(0xffffff, 0x000000);
$t->setPos(0, 10);
The same method can be used to label the peaks.
Hope this can help.
Regards
Peter Kwan |
|