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

Message ListMessage List     Post MessagePost Message

  selective label points
Posted by Leo on Jun-12-2012 09:14
Attachments:
Hello, Peter,

1. how to get those selective label points outputted like the ones "red circled" in the
sample chart? I am looking for high, low, beginning and end points like that..

2. how to make a portion of the line dotted, as indicated by the red arrow?

Thanks..

Code (the 5-year chart is the output):

~~~
#!/usr/bin/perl
use perlchartdir;

my $data = [DATAPOINTS];
my $labels = [LABELPOINTS];
my $c = new XYChart(600, 200);
$c->setPlotArea(-1, -1, 600, 200, 0xdddddd, 0xdddddd, 0xdddddd, 0xdddddd);
$layer = $c->addSplineLayer($data, 0x330099);
$layer->setLineWidth(15);
$c->xAxis()->setLabels($labels);
$mark = $c->yAxis()->addMark(0, 0xff0000, "0");

$c->yAxis->setAutoScale(0.2, 0.2); #ok

$mark->setLineWidth(3);
$c->addInterLineLayer($layer->getLine(), $mark->getLine(),$perlchartdir::Transparent,
0xff0000);

$c->addText(530, 110, "1_CMPSYMBOL", "arialbd.ttf", 30, 0x000000,
$perlchartdir::Bottom, 0, 0);

$c->makeChart("1_PNG")
~~~
peter8.png
peter9.png

  Re: selective label points
Posted by Peter Kwan on Jun-13-2012 02:15
Hi Leo,

1. You may use Layer.addCustomDataLabel to add labels to any points you like. For example:

$layer->addCustomDataLabel(0, $arrayIndexOfHighestPoint, $data->[$arrayIndexOfHighestPoint], "arial.ttf", 8);

2. You may use an x-zone color as the line color. See the sample code "X Zone Coloring" (you may look up for "X Zone Coloring" from the ChartDirector documentation index).

Hope this can help.

Regards
Peter Kwan