Page 1 of 1

Build a chart with JSON from javascript

Posted: Tue Sep 05, 2017 6:14 am
by amanso
HI,

I want to fill a chart from the result of a javascript, but i have problems.

I build the JSON correctly with the javascript function and I have tried different ways to charge this JSON in the chart but always fail.

First way:
I binded a program field to chart json property, and i used the custom formatting and in the custom javascript function I wrote the name of my function. This could be the best solution, but when the function is launched the screen is reloading (this property is executed in the moment the screen is rewritten) and the input fields that i use in my javascript function are not available and I can't build my JSON.

Other way I tried was, in the moment i have the data needed to buld the JSON, I make it, and I save the JSON in an input field. In addition I put in the property chart JSON of the chart the code: script: get("formate") , being formate the id of the input with th JSON, but it's not working neither.

I expect somebody helps me to find a solution.

Re: Build a chart with JSON from javascript

Posted: Thu Sep 07, 2017 3:15 am
by amanso
I found a solution!!

The problem was in the order of creation of the elements in the screen . I had to reorder the elements in the tab elements in order to put the inputs I wanted to use before the element chart.Then the javascript function called to generate the JSON to the graf find the needed values.

Best regards.