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][delicious bookmarklet].

What is it doing?

Amcharts provides all sorts of [great functionality][amcharts api], 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);

[Scout Reload]: javascript:(function(){$(‘#amstock’).get(0).setSettings(‘60falsetrue’);})() [delicious bookmarklet]: http://delicious.com/help/bookmarklets [amcharts api]: http://www.amcharts.com/docs/v.1/stock/settings/settings_reference

Posted Thursday, January 7 2010 (∞).

written by Eric Lindvall

I also appear on the internet on GitHub and Twitter as @lindvall and work hard to make Papertrail awesome.

themed by Adam Lloyd.