Answer the question
In order to leave comments, you need to log in
Charts in highcharts display data?
Hello.
I am building a chart in highcharts. Almost everything works out. And I can read the json format and display a specific value, but the graph is not built. I reviewed a bunch of examples, it almost turns out that it’s not enough just to display the data on the chart.
$(function () {
var data12 = '[{"0":{"fl":"266"},"1":{"freelance":"1"},"2":{"freelancejob":"3"},"3":{"weblancer":"38"},"col_day":"308","day_budjet":"2864769","col_mount":"5185","day_budjet_mount":"21541027","chart_arr_fl":["30","968","1372","608","820","266"],"chart_arr_freelance":["6","7","3","19","54","1"],"chart_arr_freelancejob":["45","8","11","4","13","3"],"chart_arr_freelansim":["25","39","19","5","11"],"chart_arr_weblancer":["80","199","252","120","159","38"]}]';
// $('#btn').click(function(){
var val1,
val2,
splitted,
options;
var seriesData = [],
data = JSON.parse(data12);
console.log(data);
for (var i = 0; i < data.length; i++) {
//alert( 'Вам сообщение ' + splitted[i] );
seriesData.push(data[i].chart_arr_fl);
}
alert(seriesData);
options = {
series: [{
name: 'Browser share',
data: seriesData
}]
};
$('#container').highcharts(options);
});
Answer the question
In order to leave comments, you need to log in
The data array must contain numbers, and you have string representations.
Feel the difference:
["30", "968", "1372", "608", "820", "266"]
[30, 968, 1372, 608, 820, 266]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question