Charts yAxisMinValue - how to change at run time

This public forum is for user-to-user discussions of PHP Report Maker. Note that this is not support forum.

Charts yAxisMinValue - how to change at run time

Postby servgas » Sat Jul 01, 2017 1:05 am

hi, please i have this instruction inside of the Chart Rendered function.

$doc->documentElement->setAttribute('yAxisMinValue', 70)

it is a static value of 70, for a LINE 2D CHART.

How can i change depending on the value of a field. lets set the field is called minimum.

thank you

code:
function Chart_Rendered(&$chartxml) {

$doc = $this->XmlDoc;
$doc->documentElement->setAttribute('subCaption', 'TIME');
$doc->documentElement->setAttribute('caption', 'WEIGHT CONTROL');
$doc->documentElement->setAttribute('yaxisname', 'WEIGHTS');
$doc->documentElement->setAttribute('xaxisname', 'TIME');
$doc->documentElement->setAttribute('yAxisMinValue', 70);
;
$chartxml = $doc->saveXML();
servgas
 
Posts: 54
Joined: Mon Jan 14, 2013 9:30 pm

Re: Charts yAxisMinValue - how to change at run time

Postby arbei » Wed Jul 05, 2017 1:42 pm

If you need to retrieve the field value from the table, you can use ewr_ExecuteScalar(<SQL>) to get it from the table.

Then you can assign it to the $chartxml in Chart_Rendered Server Event.

For example:
$min = ewr_ExecuteScalar("SELECT mininum FROM <TABLE> WHERE <Condition>");
$doc->documentElement->setAttribute('yAxisMinValue', $min);

Please refer to help file topic: "Server Events and Client Scripts" -> "Some Global Functions" for more information.
arbei
 
Posts: 1491
Joined: Wed Sep 09, 2015 10:13 am


Return to General Discussion (PHP Report Maker)