One of the data logging services I use, Pachube, was rechristened as Cosm many months ago: a name that’s decidedly easier to pronounce, if only slightly easier to comprehend. The new name and website design was making my Pachube Google Gadget look increasingly out of date, so I felt it’s well past time to redesign the gadget.
In addition to incorporating the new Cosm name and API, I’ve added a number of enhancements:
- Multiple datastreams per graph.
- Display datastreams with 2 different scales: left-axis and right-axis (e.g. temperature and humidity in the same graph)
- Mouse-over popups displaying the exact time and value of a datapoint
- Last, but not least, graph colors other than hot pink!
The gadget’s Settings dialog is shown below.
As a quickstart, you can just fill in the Feed ID field — everything else will work with default settings.
By default, the gadget will display 2 datastreams per chart, one plotted on the left axis and one on the right, for up to 3 charts. The default time frame is 1 day.
The default configuration is unlikely to be optimal for you — at a minimum, you’ll probably want to change to your local timezone and increase the gadget size to display all of the charts.
Here’s the full list of settings:
Feed ID – The numeric ID of a Cosm feed. The feed needs to be public, even if it’s your own feed, since the API key used by the Gadget can only access public feeds.
Incidentally, Cosm’s current layout makes the feed ID a little hard to find. It’s the last part of the feed’s URL, as shown in the screenshot below.
Chart 1 Datastreams – You can add as many datastreams as you like to each chart. Datastreams entered in this particular field will be plotted using the left axis of the 1st chart.
Just type in the datastream ID, then click the Add button. Each datastream you add will be listed under the field, as shown below. You can click on the X button to remove the datastream from the chart.
Chart 1 Right Axis – Datastreams entered here will be plotted using the right axis of the 1st chart. This field, and the other “right axis” fields are optional – if left blank, all datastreams in the chart will be plotted on the left axis only, freeing up a bit more space for the chart contents.
Adding a datastream to the right axis makes sense only if it is a completely different kind of measurement from the datastreams on the left axis (e.g. humidity on the right axis and temperature on the left axis), or if some datastreams have a significantly different range of values than others (e.g. Apple stock price vs. Microsoft stock price).
The screenshots below show the difference between plotting all of the data on the left axis, as opposed to making use of the right axis.
Personally, I prefer plotting different types of data in completely different charts. If you need more than 3 charts, you can use multiple instances of the gadget.
Chart 2 and Chart 3 fields – The same as the above 2 fields, but for the second and third charts. These are optional: you can have just 1 or 2 charts if you like.
Time Span and Time Span Units – The time range to be displayed in the charts. Units are hours, days, weeks and months, and the Time Span can be any numeric value (e.g. 12 hours, or 10 days, or 3 months).
Note that Cosm currently “throttles” the API which retrieve datapoints to 100 values at a time: as a result, the datapoints will be evenly spaced over time so that only a maximum of 100 are used in the graph. The longer the time interval, the more widely spaced the datapoints will be.
Gadget Height – The default height of 240 fits only a single chart: you have to scroll to see the others. You can change this setting to make multiple charts visible. Note that the height of each chart itself is fixed in the normal gadget view, but you can get a larger chart by maximizing the gadget.
Time zone – Cosm provides a large and somewhat eclectic list of time zones to select from: this affects the times that appear on the X axis of the chart.
Mouse-over Tooltip – Positioning the mouse over any part of a graph will display a tooltip displaying the time and value of the datapoint. The time uses the time zone selected in the Settings dialog
Maximized View – Any gadget in iGoogle can be maximized using the dropdown menu. This displays a much more conveniently sized version of the charts.
The gadget works (for me) in Chrome, Firefox and Internet Explorer. Being based on Google technology, it renders the graphs fastest in Chrome. Firefox is almost as fast, and the appearance of the chart is pretty much identical to Chrome.
Error Codes: Cosm returns an error code when it is unable to return the data point values. The most common error codes are:
- 404 – The feed ID doesn’t exist, or isn’t public. The gadget doesn’t support private feeds, even your own.
- 405 – This is an intermittent error that occurs when Cosm isn’t able to retrieve your datapoints fast enough: basically a timeout. I don’t think longer timespans will cause this error (i.e. a month of results takes about as long to retrieve as a day of results), but a large # of datastreams in a gadget will make this error more likely. If you find it happens too often, try splitting the datastreams between multiple instances of the gadget: you can add as many copies of the gadget as you like to iGoogle.
Data Not Updating – The gadget will automatically refresh from time to time — using some inscrutable timetable controlled by Google — but you can manually refresh it using the browser refresh button. However, Google automatically caches the data returned by the gadget, and the cache time for this gadget is set for 5 minutes. This means that refreshing the browser more frequently than 5 minutes probably won’t display new results.
I wasn’t certain that Cosm would be fast enough to handle this new design of the gadget, where it needs to return 100s of individual datapoints rather than a prerendered graph, but I’m satisfied with the performance. It’s proven to be similar in response time to the Nimbits gadget: slightly slower than the prerendered graph, but generally just a few seconds to display a chart.
Hopefully both Cosm and Nimbits will continue to thrive — I’ll certainly continue to use both.
The future of Google Gadgets is, on the other hand, rather murky. Google hasn’t relented on its planned November 1 2013 shutdown of iGoogle, where the vast majority of users run their gadgets. There doesn’t appear to be any plan to phase out the Gadget API, but there’s no clear option for hosting Google Gadgets after November 1.
I expect Google will step up with a solution, perhaps as part of their slick Google Now interface, but their indifference to users concerns thus far is
If you have any suggestions or notice any bugs in my Cosm or Nimbits gadget, please leave a comment below or send me an e-mail.