|
yZoneColor with area-fill |
Posted by Tobias Reu on May-31-2013 18:45 |
|
Hi Peter,
I have a finance-chart like the one below:
# add a line-layer
my $layer = $mainChart->addLineLayer2();
# create the y-zone-color on the day-before-value
my $color = $layer->yZoneColor(
$yesterdayPrice,
0xFF0000,
0x00FF00,
);
# add the close-line
$o_financeChart->addCloseLine($color);
# add the yesterday-price
$yAxis->addMark($yesterdayPrice);
Now my question:
Is it possible to fill the area between the bottom of the plot-area and the close-line:
- in red, if the close-price ist less than the yesterday-price
- in green, if the close-price is higher than the yesterday-price
Or shortly: If the close-line is red, fill down to the bottom in red else fill in green.
Thanks
Tobi
|
Re: yZoneColor with area-fill |
Posted by Peter Kwan on Jun-01-2013 03:57 |
|
Hi Tobias,
Yes. One method is to add an area layer. For example:
my $color = ($$closeData[$#$closeData] >= $yesterdayPrice) ? 0x00FF00, 0xFF0000;
$mainChart->addAreaLayer($closeData, $color)->setBorderColor($perlchartdir::Transparent);
Hope this can help.
Regards
Peter Kwan |
Re: yZoneColor with area-fill |
Posted by Tobias Reu on Jun-03-2013 17:12 |
|
Hi Peter,
not really. With this solution the whole chart is filled red, but it should be filled green, when the close-line is higher than the yesterday-price - like the example below...
Tobi
|
Re: yZoneColor with area-fill |
Posted by Peter Kwan on Jun-04-2013 03:42 |
|
Hi Tobias,
Unluckily, I cannot think of a way to fill the chart like what you mentioned.
If the filling is between the price line and the "last close" price (the mark line), then it can be done with an "InterLineLayer" easily. The "InterLineLayer" can compare the price line with the mark line and fill the region in between.
Regards
Peter Kwan |
|