Lamya Lam
Lamya Lam

Reputation: 33

giving a local json file for line chart

I want to create a line chart with some data from a json file, I'm working with Highcharts for that.

In the url for the json file I find something like that : https://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?

I downloaded the json file and then I put it locally, when I give in the url the local json I dont see the chart.

How can I solve that ?

this is the full example in jsfiddle :

jsFiddle

Upvotes: 0

Views: 277

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You need to have a webserver, because browsers block run files from local file system, due to security reasons.

Upvotes: 0

Airwind711
Airwind711

Reputation: 120

The data is in the format of .php you need to parse that into actual JSON by using json_encode or use $.ajax instead of $.getJSON along-with CORS and Using Apache as an internal server.

Upvotes: 1

Related Questions