Monday, June 27, 2011

Linux vs Mac usage share pie chart - and how to make one with Google Docs

I'm a great fan of Google Docs and have been using the spreadsheet function ImportHtml a lot. Just playing around here is two usage share pie charts drawn up from data at Wikipedia:







If the data at Wikipedia is updated, so is my chart without me doing anything. If the page and table at Wikipedia is changed too much my chart is wrecked.

Simply put the formula "=ImportHtml("web address with your data","table","number of table to import")" in a cell and your desired table is copied to the spreadsheet. First table on the web page you are importing from is counted as 0 (the Usage share of operating systems page has my required data in tables 0 and 5). Obviously, it's possible to manipulate the data once it's inside the spreadsheet - in my case I simply copied the values of the cells I needed to a little convenient area. Mark the area with the data you wish to display then click the 'Charts' button (between 'Functions' and 'Filter'). Try to have the dialog window cooperate to draw up the chart needed then select 'Publish chart' from the drop down inside the chart box. I'm not entirely happy with the share data being converted to relative percentages (unfortunately Microsoft OSs do claim some 86%) - any tips on changing that?