|
How to pass additional variable(s) with $imageMap = $c1->getHTMLImageMap in PHP? |
Posted by Vincent Chang on Jun-29-2018 06:57 |
|
Hi,
I have a drill down graphics with $imageMap = $c1->getHTMLImageMap("level1.php", "", "title='{label}'"). Is there a way to pass variables/values from my current PHP (level.php) to level1.php like {label} for example? This way I will be able to reuse the same PHP with different input variables while click on the drill down area.
Thanks
Vincent |
Re: How to pass additional variable(s) with $imageMap = $c1->getHTMLImageMap in PHP? |
Posted by Peter Kwan on Jun-30-2018 00:05 |
|
Hi Vincent,
The sample code that comes with ChartDirector is already passing the {label} as the parameter "xLabel". See:
http://www.advsofteng.com/doc/cdphp.htm#simpleclickable.htm
In the sample code, you can see the {label} is in "clickbar.php" is passed to the page that handles the click "clickline.php". That's how the "clickline.php" knows which bar is clicked.
If you want to add some extra variables not related to the chart, the code depends on the nature of your variable. If your variable is the same for everything in chart, you can just add it as part of the URL:
imageMap = $c1->getHTMLImageMap("level1.php?myVariable=$xxx", "", "title='{label}'");
If the variables depend on which part of the chart is clicked, you can add them as extra fields (see Layer.addExtraField), and then include them in the URL using {field0}, {dsField0} or {dsdiField0}, depending on how the values bind to the data on the chart. For example:
$layer->addExtraField($anArrayOfValues);
imageMap = $c1->getHTMLImageMap("level1.php?myVariable={field0}", "", "title='{label}'");
See:
http://www.advsofteng.com/doc/cdphp.htm#Layer.addExtraField.htm
http://www.advsofteng.com/doc/cdphp.htm#Layer.addExtraField2.htm
http://www.advsofteng.com/doc/cdphp.htm#paramsub.htm
Regards
Peter Kwan |
Re: How to pass additional variable(s) with $imageMap = $c1->getHTMLImageMap in PHP? |
Posted by Vincent Chang on Jun-30-2018 08:59 |
|
Hi Peter,
Thank you for the info.
Vincent |
|