d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Help With Javascript Charting Library(highcharts) > How To Reload The Graph To Update Data
Add Reply New Topic New Poll
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 15 2014 12:52pm
Id like to update the data I have being displayed to show different numbers about every 5 seconds.
So it will show numbers for January, after 5 seconds it will go to February and so on.

How can I reload the chart to do this?

help will definitely be compensated with fg

thank you.
Member
Posts: 2,754
Joined: Nov 26 2007
Gold: 1,339.81
Sep 15 2014 01:15pm
call
Code
setTimeout(yourFunction, 5000);
at the end of
Code
yourFunction


ex,

Code
function refreshData(){
//Do something exciting
setTimeout(refreshData,5000);
};
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Sep 16 2014 11:34am
Quote (labatymo @ Sep 15 2014 07:15pm)
call
Code
setTimeout(yourFunction, 5000);
at the end of
Code
yourFunction


ex,

Code
function refreshData(){
//Do something exciting
setTimeout(refreshData,5000);
};


Thank you, I will try this out,
so I would include this after I call the function to draw the charts?
how will it get the new data?

Code
$(function () {
$('#container').highcharts({
chart: {
type: 'column',
},
title: {
text: 'January'
},
xAxis: {
categories:
['1', '2','3','4','5']
},
yAxis: {
title: {
text: 'Numbers for the month'
}
},
series: [{
name: 'January',
data: [ 10, 24, 2,5,11],
}]
});

});
[B]setTimeout(yourFunction, 5000);[/B]???


thank you
any help is appreciated
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 16 2014 06:02pm
Quote (mcfighter @ Sep 16 2014 01:34pm)
Thank you, I will try this out,
so I would include this after I call the function to draw the charts?

setTimeout just executes code every xxx milliseconds. either do an initial load then set timeout, or let your timeout do everything. depends on if you want a slight delay before it first loads.
Quote

how will it get the new data?


that's something only you can answer.....
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll