Home Forums Chart Support Creating a chart from a JSON file

Creating a chart from a JSON file

Viewing 2 posts - 1 through 2 (of 2 total)
  • #44690

    I’ve searched for an answer but all the answers I’ve found are for API’s. I am not using an API but a JSON file.

    My question is, how do I load a JSON value into a chart?

    I did test the format of the JSON value by copying the array with objects into the dataPoints of the js file and it worked as intended.

    #44692

    @murrayr,

    Due to security measures, web browsers impose restrictions on reading local files & cross-origin requests. To work around this, one effective approach is to serve your JSON file from a local web server or utilize a CORS-enabled JSON hosting service like npoint.io. By doing so, you enable your web application to fetch data seamlessly without encountering the cross-origin limitations. Please take a look at this JSFiddle for an example of the same.

    Column chart with data from JSON file


    Ananya Deka,
    Team CanvasJS

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

You must be logged in to reply to this topic.