update updates the gauge at intervals, without reloading the web page. This makes it possible to display gauges with live updates, change the gauge's look over time for emphasis, or create a slideshow from different gauges.
url: Relative or absolute URL of an XML source to get the update from
delay: The delay in seconds before requesting the update. The actual interval between updates is this delay, plus the time it takes to request and receive the next update. Depending on the connection speed, the actual interval might be several seconds longer than this delay. Desktop applications using this tool could use short delays in fractions of a second. The default is zero
delay_type: Determines how updates affect the current animation. Valid values are:
1: Start the delay from the time the gauge is loaded, but don't update the gauge until the current animation is over. This is the default delay_type
2: Start the delay from the time the gauge is loaded, and update the gauge even if the current animation isn't over
3: Start the delay from the end of the animation
stop_sound: Determines whether to stop previous sounds with this update or not. The default is false (don't stop previous sounds)
timeout: The number of seconds to wait before loading times out. The default is 30 seconds
retry: The number of times to try loading the update script before displaying an error message. The default is 0 (don't retry)
The update source should contain the code to redraw the entire gauge, including the parts that don't change. Redraw the gauge in exactly the same way a new gauge is created.
To update the pointers' positions, redraw the entire gauge, and make the new pointers start from their last positions. See the example below.
To pass the last positions to the update script, use variables in the query part of the update URL:
To update a gauge, plus schedule for the following update, use update again in the update script. See the example below.
Some browsers use cached updates instead of calling the update source repeatedly. This results in seeing only a few fresh updates. To avoid this problem, append the precise time or a random number to the update URL to keep it new:
In this example, the script that updates the gauge is independent from the code that generates the initial gauge. However, the same update script can be called to both generate the initial gauge and to continue updating it.