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

Message ListMessage List     Post MessagePost Message

  different color for each datalabel in a line chart
Posted by Jim on Sep-29-2014 21:17
Attachments:
Hello,

in this chart image how can I set a different color for each datalabel (for example 30 in red, 40 in green, 50 in blue, ...)?

I am using the php version.

Thank you
linechart_test.png

  Re: different color for each datalabel in a line chart
Posted by Peter Kwan on Sep-30-2014 02:52
Hi Jim,

You may use Layer.addCustomDataLabel. For example:

$layer = $c->addLineLayer2();
$layer->addDataSet($myData, 0x0000aa)->setDataSymbol(CircleSymbol, 15, 0x0000aa,
0x0000aa);

for ($i = 0; $i < count($myData); ++$i) {
   $color = ...... obtain the color of the data point ....;
   $layer->addCustomDataLabel(0, $i, "{value}", "arialbd.ttf", "10", $color);
}

Hope this can help.

Regards
Peter Kwan

  Re: different color for each datalabel in a line chart
Posted by Jim on Sep-30-2014 16:59
Thank you very much, this is exactly what I was looking for.

Best regards