Page 1 of 1

Dynamic fusion chart

Posted: Wed Oct 20, 2021 3:45 am
by aa73
Hello,

In my project, I use a slider, a text box and a fusion chart (angulargauge)

When I move the slider, I would like the value of the fusion chart to change.
In the OnChange property of the slider, I put this code :
changeElementValue ("TextBox1", get ("Slider1")); // to see the value of the slider

var res = get ("Slider1");
var test = "{\" chart \ ": {\" caption \ ": \" Project progress \ ", \" subcaption \ ": \" \ ", \" lowerLimit \ ": \" 0 \ ", \ "upperLimit \": \ "100 \", \ "lowerLimitDisplay \": \ "Start \", \ "upperLimitDisplay \": \ "End \", \ "showValue \": \ "1 \", \ "valueBelowPivot \ ": \" 1 \ ", \" theme \ ": \" fusion \ "}, \" colorRange \ ": {\" color \ ": [{\" minValue \ ": \" 0 \ ", \ "maxValue \": \ "50 \", \ "code \": \ "# e44a00 \"}, {\ "minValue \": \ "50 \", \ "maxValue \": \ "75 \", \ "code \": \ "# f8bd19 \"}, {\ "minValue \": \ "75 \", \ "maxValue \": \ "100 \", \ "code \": \ "# 6baa01 \ "}]}, \" dials \ ": {\" dial \ ": [{\" value \ ": \" ";
var test2 = "\"}]}} ";
var test3 = test + res + test2;
console.log (test3);
applyProperty ("Chart1", "chart json", test3);
applyProperty ("Chart1", "widget type", "chart");
The problem is, if I move the slider too fast, the chart displays "Loading Graph ...".

What property should I use to update the chart only when I have finished moving the slider?

Thanks for you answer

Re: Dynamic fusion chart

Posted: Wed Oct 20, 2021 4:07 am
by Scott Klement
The slider doesn't have any way to know when you are done moving it. You would have to determine your own logic that detects when you are done with the slider, there's nothing built-in. Sorry.

Have you considered using JavaScript's JSON.stringify() routine to build your JSON instead of manually building it in a character string? I think that'd make your code much easier to read.

Re: Dynamic fusion chart

Posted: Wed Oct 20, 2021 4:25 am
by aa73
Hi,

Thanks for your awnser.
I think I have no choice, i have to add a button to change the chart

I'm not a specialist of Javascript.
What is "JSON.stringify() routine" ?