Home › forums › Using CanvasJS › Live updating chart from JSON
Tagged: JSON, live update
Here my current script to get updating value from JSON:
So after 20s, the page will reload 1 time to get the value from JSON. It was working fine if the JSON was generated within 20s but with >20s the chart can not be generated. I tried to use jQuery.isEmptyObject to verify if JSON empty and reload chart but no working. Am I missing or doing wrong somewhere.
jQuery.isEmptyObject is used to check if the object is empty and doesn’t contain any properties. The JSON that you provided is actually an array of objects. So, you can check the length of an array to check if the JSON file that you obtained is empty or not.
Here is an updated jsFiddle for same.
You must be logged in to reply to this topic.