{"id":297,"date":"2008-08-30T22:12:35","date_gmt":"2008-08-30T22:12:35","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=297"},"modified":"2008-09-02T13:22:41","modified_gmt":"2008-09-02T13:22:41","slug":"currentcost-app-take-2","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=297","title":{"rendered":"CurrentCost app &#8230; take 2!"},"content":{"rendered":"<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/2812364402\/\" title=\"a Python CurrentCost app by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" align=left hspace=\"5\" vspace=\"10\" src=\"http:\/\/farm4.static.flickr.com\/3168\/2812364402_3606145fa3_m.jpg\" width=\"240\" height=\"180\" alt=\"a Python CurrentCost app\" \/><\/a>I&#8217;ve been <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=288\">talking about it<\/a> for a while, but I finally got around to spending some time working on a CurrentCost app. <\/p>\n<p>The <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=281\">original code<\/a> was written in C# using .NET 3.5, and I used WPF (Windows Presentation Foundation) to draw the graphs. For <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=288\">a number of reasons<\/a> this proved unpopular and I got a ton of emails saying how this was no good for them. So I decided to start again. <\/p>\n<p>The new app is written in Python &#8211; using wxPython and matplotlib to create the graphs. <\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/2811527759\/\" title=\"a Python CurrentCost app by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" hspace=\"5\" vspace=\"10\" align=\"right\" src=\"http:\/\/farm4.static.flickr.com\/3095\/2811527759_4b5c3b0353_m.jpg\" width=\"240\" height=\"180\" alt=\"a Python CurrentCost app\" \/><\/a>Using py2exe, I&#8217;ve been able to compile the whole thing (combining my script with a Python interpreter and a copy of all of the third-party libraries I&#8217;ve used) into a Windows executable that will (<em>hopefully!<\/em>) run on any Windows computer, without needing installing or requiring any pre-requisites.<\/p>\n<p>I can also make the Python script itself available, making it something that Linux users could run as well. This means I get the low-overhead Windows experience I wanted, together with the ability to make it cross-platform. Neat!<\/p>\n<p>I&#8217;ve been able to produce some more interactive graphs &#8211; the graphs in the new app can be zoomed in and out, panned, moved around, printed, and exported to images. As the amount of data in the app builds up, I can see this becoming very useful. <\/p>\n<p><!--more-->For example, if you&#8217;ve got daily CurrentCost readings for a several months, you can either zoom out to see all your data, or zoom in to focus on a particular month of interest. Then click-and-drag on the graph to pan around. <\/p>\n<p>I&#8217;ve also tried to improve the way I label the axes, as this was something <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=288\">a number of people found unclear with my first attempt<\/a>. For example, when looking at hourly data, vertical grid lines are used to mark out days, and the start of each day is marked with the date on the x-axis. (<em>It makes more sense if you see it&#8230; honest!<\/em>)<\/p>\n<p>It&#8217;s the product a couple of days&#8217; work, so it&#8217;s still very rough around the edges. There&#8217;s virtually no error-handling, the graphs are still a little clunky, and I&#8217;m convinced that I&#8217;m not reading the hourly data quite right (the data is <a href=\"http:\/\/cumbers.wordpress.com\/2008\/05\/07\/breakdown-of-currentcost-xml-output\/\" target=\"_blank\">received from the CurrentCost meter in a confusingly-labelled way<\/a> giving relative times, and I think I&#8217;m translating it into actual times incorrectly). <\/p>\n<p>But it&#8217;s a start, and I&#8217;m already quite pleased with it. Feedback is naturally very welcome&#8230; but bear in mind that this should only be considered a very, very early beta!<\/p>\n<p><a href=\"http:\/\/cid-14811d3c96ccaad2.skydrive.live.com\/self.aspx\/Public\/currentcost.zip\" target=\"_blank\">Download it here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been talking about it for a while, but I finally got around to spending some time working on a CurrentCost app. The original code was written in C# using .NET 3.5, and I used WPF (Windows Presentation Foundation) to draw the graphs. For a number of reasons this proved unpopular and I got a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[194,267,268,212],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-code","tag-currentcost","tag-matplotlib","tag-py2exe","tag-python"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=297"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/297\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}