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

Message ListMessage List     Post MessagePost Message

  show symbol for AreaLayer with 1 datapoint
Posted by ddoyle on Feb-04-2020 03:53
If I add an AreaLayer and there is only a single datapoint, nothing shows up.

When I solved this for a line layer, I was able to do so with (php version, pulling out snippets of code from a large file):

$l = $c->addLineLayer2();
$d = $l->addDataSet($y_data, $color, $legend);
if ($n_pts == 1){
    $d->setDataSymbol(CircleShape, 7, -1, 0xffffff, 5);
}

However, I can't find the equivalent for an AreaLayer.  It sounds like I am supposed to add a ScatterLayer to accomplish this.  So, I tried:

$l = $c->addAreaLayer($y_data, $color, $legend);

if ($n_points == 1){
   $lscatter = $c->addScatterLayer(array(), array(), "",CircleShape, 7, -1, 0xffffff, 5);
}

But this doesn't seem to do anything.  I assume I need to add my data into the area where it says array(), array(), but while I know the y-values, the x-values are whereever ChartDirector put them to make this a line chart, so I don't know what to fill in.

  Re: show symbol for AreaLayer with 1 datapoint
Posted by Peter Kwan on Feb-04-2020 15:27
Hi ddoyle,

At least two points are required for a line, and it also applies for the area chart.

To add a symbol in the case of one point, if you do not use x-values, you can use array() as the x-values in addScatterLayer, like:

$c->addScatterLayer(array(), $y_data, "",CircleShape, 7, -1, 0xffffff, 5);

Alternatively, you can just add a line layer when there is only one data point (since you already have the line layer code working for one data point).

Hope this can help.

Regards
Peter Kwan