Use settimeout to auto-refresh chart?

#1

I have a chart in Highcharts that loads data from an ajax call. All fine, except I would like it to reload every 10 seconds?
Here's the main part of the js:

$(function() {

   $.getJSON('mychart.php', function(arr)
   {

		chart = new Highcharts.Chart({
			chart: {
                            renderTo: 'container',
			defaultSeriesType: 'area',
			zoomType: 'x',
			spacingTop: 2,
			spacingRight: 10,
			spacingLeft: 2,
			spacingBottom: 10
                     },

... and so on ....

#2

Hi
You can add the Highcharts.Chart into a function, then call the function with setInterval('function_name()', 10000).

function function_name() {
$.getJSON('mychart.php', function(arr)
{

chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'area',
zoomType: 'x',
spacingTop: 2,
spacingRight: 10,
spacingLeft: 2,
spacingBottom: 10
},

//... and so on ....
}

function_name();
setInterval('function_name()', 10000);
closed #3