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

Message ListMessage List     Post MessagePost Message

  Financial chart with shaded area
Posted by Joe McEnaney on Jun-06-2012 11:13
Hello,

Could you point me in the right direction on the API. I have a closing line financial chart
and wish to shade under the line to create a mountain effect.  I'm using PHP and ASP if
that makes a difference.  Also, is it possible to specify two colours to create a gradient?

Excellent software and I am in awe of the number of languages you support. Looking
forward to the next version.

Joe

  Re: Financial chart with shaded area
Posted by Peter Kwan on Jun-07-2012 00:57
Hi Joe,

For "financial chart", are you using the FinanceChart object and use addCloseLine to add the clsoing line, or using an XYChart object and just draw it as a regular line chart?

In any case, you may consider to add an area layer using the close data. For example, in PHP 5, suppose $c is the FinanceChart object, it is like:

#add the main chart and the close line
$m = $c->addMainChart(....);
$c->addCloseLine(.....);

$m->addAreaLayer($closeData, 0x80ffcccc)->setBorderColor(Transparent);

If you would like to use "gradeints", you can change the 0x7fffcccc above with a gradient color created using BaseChart.linearGradientColor. For example, assuming you would like a vertical gradient, it is like:

$myColor = $m->linearGradientColor(0, $m->getPlotArea()->getTopY(), 0, $m->getPlotArea()->getTopY() + $m->getPlotArea()->getHeight(), 0x800000ff, 0x80ffffff);

$m->addAreaLayer($closeData, $myColor)->setBorderColor(Transparent);

Hope this can help.

Regards
Peter Kwan

  Re: Financial chart with shaded area
Posted by Joe McEnaney on Jun-07-2012 01:37
Thanks very much Peter, I'll try that out. I'm using the Finance Chart.

Separate issue and more of a comment than a problem - I've noticed it's difficult to create
nice thumbnail charts using the Finance Chart. Often this is due to the whitespace padding
on the left hand side of the chart image (reserved for the Y axis I guess).  Perhaps a
future update could look at ways to help with this.

Overall, love the product.

best

Joe

  Re: Financial chart with shaded area
Posted by Peter Kwan on Jun-07-2012 23:44
Hi Joe,

You can configure the margins by using FinanceChart.setMargins (you can set them to zero if you like). For example:

$c->setMargins(0, 0, 0, 0);

You may also create a larger chart, then use DrawArea.resize to graphically resize it to a smaller image. For example:

$c->makeChart3()->resize(200, 200);

Hope this can help.

Regards
Peter Kwan