Current Cost Charting fun

Meter with Current Cost clamp fitted Current Cost display

Nick has already written a nice introduction to using the Google Chart API for drawing charts of household power consumption over time. I’ve been playing with some other parts of the API as part of setting up a web-based dashboard so Rachel and I can keep an eye on our house’s power (as monitored by the Current Cost meter) from the living room computer and our own laptops.

First, I also started playing with what Google describes as Google-o-meters. For example, a basic dial can be created like this

http://chart.apis.google.com/chart?chs=200x120
&cht=gom
&chd=t:50
&chl=label

For power readings, I’d prefer to have the colours go from green through yellow to red, and since the colour argument takes an optional 4th component for opacity (00-ff), let’s try making it semitransparent too.

http://chart.apis.google.com/chart
?chs=200x120
&cht=gom
&chco=00ff0099,ffff0099,ff000099
&chd=t:62
&chl=1.24%20KW

For temperatures, something like this might be quite nice.

http://chart.apis.google.com/chart
?chs=200x120
&cht=gom
&chco=0000ff99,ffffff99,ff000099
&chd=t:75
&chl=22%C2%B0C

I’ve been spending some time thinking about alternatives to line graphs (or sparklines) for plotting daily power consumption. I’m really liking the radar chart option. These look a bit like this.

http://chart.apis.google.com/chart
?cht=r
&chs=200x200
&chd=t:20,40,80,40,20,30
&chco=FF0000
&chxt=x
&chxl=0:|0|1|2|3|4
&chm=B,FF000040,0,1,0

(using cht=r for straight lines, and again with the same data but using curved lines, thanks to cht=rs)

It seems quite well suited to rendering 24 hours of power consumption. Like so.

http://chart.apis.google.com/chart
?cht=r (and rs for splines)
&chs=300x300
&chd=s:QKKHHHHIG9JwpHIXddcbUMRUQ (using simple encoding)
&chco=FF0000
&chxt=x
&chxl=0:|0|1|2|3|4|5|6|7|8|9|10|11|12|[etc...] (labels)
&chm=B,FF000040,0,1,0|h,00004444,0,0.5,1|h,00004444,0,1,1 (rings at 50 and 100%)

That was a Saturday. Can you tel when we got up and switched on the (power-hungry) electric shower? On a weekday, that initial spike comes a bit earlier.

Even better, I can overlay the daily plots from a whole week in one chart. Using semi-transparent shading helps create a sort of heat-map thingy, thusly.

http://chart.apis.google.com/chart
?cht=rs
&chs=300x300
&chd=s:CBBBBBBBBDXcCBCCXQFFFGEDC,CCBBBBCbTZMCECCCTORRFFFCB, [...] (one per series)
&chxt=x
&chxl=0:|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23
&chm=B,FF000066,0,1,0|B,FF000066,1,2,0|[etc, shading for each series]|h,00004444,0,0.5,1|h,00004444,0,1,1

It looks as though most of our power is spent in the mornings, largely due to the electric shower.

Update: Nick’s done some great work which goes way beyond this…

17 replies on “Current Cost Charting fun”

  1. With a standard line chart I can compare by eye the area under the line to compare the kWh used by a given spike.

    I don’t think I can do this on a radar chart as the area under the line is not proportional to use, so tall spikes cover a disproportionally large area.

    So for displaying information to people, given that many people will naturally read a chart by comparing the area under the line, I’m a little worried that they de-emphasise the cost of long running low level use.

    That said, I do think that this chart would be really good for recognising patterns as it creates recognisable shapes and can represents time as the continuum it is, rather than something that starts and stops at 00:00.

  2. Hi David

    Do you find the disproportionatly large area (or is it indirectly proportional?) under a spike offputting? Would it be less misleading if the chart wasn’t shaded?

    I think the trend of the line is valuable, even if the area underneath it isn’t as meaningful as it would be on an x/y plot. I should have pointed out that the readings are being summed (or could be averaged, but summed it nice), at one hour intervals. If it was plotting one reading per minute, the area under the line would probably more relevant. With that coarse-grained data you’re not seeing comparisons between short-and-fat or tall-and-skinny spikes anyway, the data is already trended into hourly readings. (And I were taking the area seriously I should be using straight lines rather than spline curve smoothing too).

    I think these graphs are a reasonable way to show a pattern of usage. At least, their clock-ness makes it very easy to use them to spot temporal patterns. Even better than overlaying a week’s worth of data onto one chart seems to be laying seven of them side by side in a row. Once I have a grid of a few weeks, I expect to be able to see patterns in the columns. We always get up later on Saturday, for one thing. Perhaps seeing the overlaid total for a week (at the end of each row) and same day-of-the-week across many weeks (at the bottom of each column) will be interesting. Lots to play with, anyway.

  3. Hey Roo, I’m in absolute agreement that it’s a good way to show patterns and do comparisons between 24 hour periods – the interesting shapes and the pseudo clock form see to it. I’m intrigued how many types of days exist and can be identified (weekday/weekend/WAH day…) and how early in the day it can be done and I think these style of charts could help with that.

    When I was first looking at the 24hr chart above, I wasn’t comparing across days, but between the hours, and it was only a while later that I realised that I hadn’t correctly understood the relationship between the power used for the shower vs the power used overnight.

    Given that you were summing not averaging and the resultant sample rate is 1/hr, I still wasn’t understanding it correctly ;-) and area really isn’t relevant – it’s all about the distance along each hourly axis.

    To your questions: Now that I understand that area is meaningless because of the data point being plotted, it’s not as offputting. While the shading may have helped my confusion, I think it helps when doing the overlays of multiple days – colour mixing comes to mind as a something to investigate.

    Lots of things to play with indeed!

  4. Following on from David’s interesting observation, why not plot the square root of the power consumption on the radial axis?

    The spikes would be less exaggerated, but you would still have the “clockiness” and the area would be proportional to the energy consumption.

  5. And this is the reason I blog. Cleverer people than me read it and take the time to make suggestions I’d never have thought of on my own.

    Thanks Joe (and David). I’ll try that.

Comments are closed.