Quick tip for up-to-date Scout graphs
One of the things that’s always made me sad when using Scout has been having to refresh the page to reload the graphs.
Fortunately amcharts, the charting engine used by Scout, has the ability to do refreshing.
Here’s a nice little bookmarklet to make the Scout graphs refresh every 60 seconds.
Drag this link: Scout Reload
To install the bookmarklet, drag the “Scout Reload” link to your bookmark bar.
To use it, click on the bookmarklet when you are on a Scout graph page.
For more hints on how to install bookmarklets, you can see how to install the Delicious bookmarklet here.
What is it doing?
Amcharts provides all sorts of great functionality, including a simple refresh mechanism.
What we do is update the XML configuration via javascript with this chunk:
<settings>
<data_reloading>
<interval>60</interval>
<show_preloader>false</show_preloader>
<reset_period>true</reset_period>
</data_reloading>
</settings>
To send that chunk of XML to the chart is very strait forward. We just get a reference to the DOM object that is the chart and call setSettings
on it, passing it the XML we want:
$("#amstock").get(0).setSettings(xml_settings_string);