I have highcharts graphics. When I create my page I show empty graphics (I don't set data attribute and there is only titles of graphics, inside of them is empty.) I get data from server asynchronously and call
setData()
function at callback. However user sees an empty page and I want to show a loading image for them. This: http://api.highcharts.com/highcharts#loading doesn't work for me.
Any ideas?
To determine that chart is fully loaded you can use load event, because load event is invoked when all elements are drown (API reference https://api.highcharts.com/highcharts/chart.events.load). However when you are using series animation this runs in a timeout, then load event is invoked before animation will finish.
To show 'no data' message on a pie chart, you need to remove data from a chart. Also, the 'no data' feature requires the file no-data-to-display. js to be loaded in the page. If you want to show some kind of info when data is hidden, you can add custom text with Chart.
The plotOptions is a wrapper object for config objects for each series type. The config objects for each series can also be overridden for each series item as given in the series array. Configuration options for the series are given in three levels. Options for all series in a chart are given in the plotOptions.
Traditionally Highcharts or Highstock graphs runs in the browser on the client side. However in some cases it could be preferred to run on the server or in a way interacting with server side applications.
I did it work as explained at given URL:
function updateGraphic(url, chartName) {
chartName.showLoading();
$.getJSON(url, function(data){
chartName.series[0].setData(data);
chartName.hideLoading();
});
}
"Loading.." word seems too amateur. Use that trick instead
var chart = new Highcharts.Chart(options);
chart.showLoading('<img src="/images/spinner.gif">');
$.getJSON(url, function(data){
//load data to chart
chart.hideLoading();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With