You must be logged in to post your query.
Home › Forums › Chart Support › Creating a chart from a JSON file
Tagged: JSON JavaScript
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.
@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.
— Ananya Deka, Team CanvasJS
You must be logged in to reply to this topic. Login/Register