Home forums Using CanvasJS Live updating chart from JSON

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Bivek Singh 2 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14275

    jonasbui1476
    Member

    Hello guys,
    Here my current script to get updating value from JSON:
    jsFiddle

    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.
    Thanks

    • This topic was modified 2 months, 2 weeks ago by  jonasbui1476.
    #14298

    Bivek Singh
    Moderator

    @jonasbui1476

    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.

    ——
    Bivek Singh

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.