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

Message ListMessage List     Post MessagePost Message

  Put Image Above Bar Chart
Posted by Furqon on May-18-2011 12:16
Attachments:
Hi Peter, pls help.
Is it possible to put image legend above bar chart ?
For illustration pls see file/image attached

Thanks before
Furqon
icon_above_bar.JPG

  Re: Put Image Above Bar Chart
Posted by Furqon on May-18-2011 12:17
FYI, I'm using PHP
Thanks
Furqon wrote:

Hi Peter, pls help.
Is it possible to put image legend above bar chart ?
For illustration pls see file/image attached

Thanks before
Furqon

  Re: Put Image Above Bar Chart
Posted by Peter Kwan on May-18-2011 18:57
Hi Furqon,

You may use CDML to configure the label format to include an image. For example:

#assume image is called "abc.png" and is located in the same directory as the script
$imagePathName = dirname(__FILE__)."/abc.png");

$layer->setAggregateLabelFormat("<*img=$imagePathName*>\n{value}%");

Hope this can help.

Regards
Peter Kwan

  Re: Put Image Above Bar Chart
Posted by Furqon on May-19-2011 12:40
I'm using different image for each point, not just one image. should i put the image into array first ?
for example: $image=array("a.png","b.png",c.png","d.png");

And how do i pass it to CDML ?

  Re: Put Image Above Bar Chart
Posted by Peter Kwan on May-19-2011 18:23
Hi Furqon,

Yes. You can put the file names of the images in an array. The code will then be like:

You may use CDML to configure the label format to include an image. For example:

$layer->addExtraField($myImageArray);
$layer->setAggregateLabelFormat("<*img=" . dirname(__FILE__) . "/{field0}*>\n{value}%");

The {field0} above will be substituted with the values in your "extra field" array (just like the {value} will be substituted with the values in your data array).

Hope this can help.

Regards
Peter Kwan

  Re: Put Image Above Bar Chart
Posted by Furqon on May-20-2011 10:58
Thanks Peter.
It's great & work, you saved my day :)


Best Rgds
Furqon

  Re: Put Image Above Bar Chart
Posted by MarkZB on Jun-23-2018 19:20
Hi Peter

How would one add images at a specific location inside the bar? eg 20% from bar top

  Re: Put Image Above Bar Chart
Posted by Peter Kwan on Jun-26-2018 00:57
Hi MarkZB,

One method is to add a scatter layer with the data values being 80% of the bar values. you can then use images as scatter symbols to put the images at 20% from bar top. Note that you need to add the scatter layer first, followed by the bar layer, so as to make the scatter layer on top of the bar layer.

Regards
Peter Kwan

  Re: Put Image Above Bar Chart
Posted by MarkZB on Jun-26-2018 01:02
Thanks Peter. Another quick question...

Can images assigned via setAggregateLabelFormat, be clickable using setHTMLImageMap?

  Re: Put Image Above Bar Chart
Posted by Peter Kwan on Jun-26-2018 17:48
Hi MarkZB,

Unluckily, the text/image drawn with setAggregateLabelFormat are not clickable. If you need the image to be clickable, it is better to draw it with a scatter layer. The scatter symbols are clickable.

Regards
Peter Kwan