javascript - Use Highcharts-ng with JSON -
To display the chart, Y uses strategic methods:
var Myapp = angular module ('map', ["hicharart-ng"]); Myapp.controller ('myctrl', function ($ scope) {$ scope.highchartsNG = {option: {chart: {type: 'bar'}}, series: [[data: [10, 15, 12, 8, 7] ]}], Title: {Text: 'Hello'}, Loading: Incorrect}}); & Gt;
But I want to load the data from a remote Jason.
I tried to use the method described in the official document, but it does not work with the angle. I am using Highchurch-NG, but I do not know how to load remote JSON files.
I am researching how to use $ http.get, but still how do I use it?
Thank you!
Replace the data in your chart within a variable:
< Code> var chart data [=]; [...] Series: [{Data: chartdata}], [...]
Then you can use the $ http-service as follows:
$ http.get ('/ PATH / TO / MY / JSON') .success (function (jsonData) {// if you need some remodeling of jsonData, otherwise give it on the chart: chartData = jsonData ;}
$ http
-Eag works that the promise of service is based on - this means that you request within .success and
.error
-function. It was explained in very good.
Comments
Post a Comment