Answer the question
In order to leave comments, you need to log in
How to enter values from api into Highcharts?
Dear users.
Tell me, please, how can I enter and correctly process the data received from api in json format, namely the value of the string "online" and how to build a graph using this value?
If you can, please attach your solution. Thanks in advance!!
API value: https://mcapi.ca/query/play.minesuperior.com/info (exactly the online line)
Answer the question
In order to leave comments, you need to log in
I can hint
var json = [{
"key": "Apples",
"value": "4"
}, {
"key": "Pears",
"value": "7"
}, {
"key": "Bananas",
"value": "9"
}];
var processed_json = new Array();
$.map(json, function(obj, i) {
processed_json.push([obj.key, parseInt(obj.value)]);
});
if (processed_json.length != 0) {
loadJson();
}
function loadJson() {
$('#container').highcharts({
chart: {
type: 'column'
},
xAxis: {
type: "category"
},
series: [{
data: processed_json
}]
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question