I have started to implement a column chart at Highcharts.(http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/combo/ column chart part of it)
I set series as like that:
...
series : []
...
And I return sth like that from server:
[ {
"name" : "4346",
"data" : [ 3010840179 ],
"type" : "column"
}, {
"name" : "20232",
"data" : [ 2135308977 ],
"type" : "column"
} ]
When I copy that value and set series at first it renders graphic. However I don’t what will return from server(how many elements etc.) and I try that:
chart.series = data; //chart is my chart variable's name, data is the returning JSON String from server.
However nothing happens at chart, I know it is not a valid usage. What should I do to set series variable of chart at once?
PS 1: I try to set data at my callback function at $.getJSON()
PS 2: chart.series[n].setData(); is not for me. I have both data and names of every elements from server. I want to set whole series variable of chart at once.
EDIT 1: http://jsfiddle.net/HD6CY/ this is what I want to achieve.
EDIT 3: I want to create a chart with series : [] and after I get data from server(it takes long time) I want to set it to my chart’s seres variable. I don’t want to block my chart to be created if waits to get data, I want to build empty and after that I will set it. I will show a loading text at screen so there will be something instead of a null page even it doesn’t have anything to show at beginning.
Check about
addSeries.After build an empty chart, do the following.
DEMO
Reference