This topic is locked
[SOLVED]

Dynamic Scale for Chart on Dashboard

10/29/2025 11:42:35
PHPRunner General questions
D
druck281 author

On my dashboard, I have a master list element with our budget cycles and the starting and remaining balance. In another element, I have a gauge chart to represent the selected budget cycle. The chart looks great and the needle correctly updates as I click on the different records in master list but I cannot figure out how to change the scale on the chart to go from 0 to the StartingBalance. If I can get the code into the ChartModify event, I already have the placeholder for it but how do I get other fields from the selected master record into the ChartModify event? I have a JS variable in the ChartModify event for 'strartingBudget' and when I hardcode '110000' into it, everything works great but I want to find a way to pass the selected starting budget into that variable. Any ideas?

Thanks!

Screenshot 2025-10-29 113818.png
D
druck281 author 10/29/2025

BTW...Credit where credit is due, the ChartModify code that I have on my Gauge came from an older blog post from RBrogen. I made a couple of tweaks but the whole base came from their code.
https://asprunner.com/forums/topic/28039-gauge-chart-label

Sergey Kornilov admin 10/30/2025

You can calculate this value in your PHP code, i.e. in BeforeDisplay event and then pass it to ChartModify event using proxy parameter. More info in the manual:
https://xlinesoft.com/phprunner/docs/chartmodify.htm

D
druck281 author 10/31/2025

Thanks Sergey! I already have the value calculated but I was looking for something like the $values array in the BeforeDisplay event and that isn't there on the Chart Page. After a little more thought, you did lead me to realize I needed the Master Record, not the Current Record. For anyone else trying the same thing...

ChartPage - Before Display

$data=$pageObject->getMasterRecord();
$pageObject->setProxyValue("startingBudget",$data["StartingBudget"];

In the ChartModify Event

window.proxy=proxy;
var startingBudget=Number(proxy.startingBudget);
...

Working great now...Much appreciated!