Yesterday I showed how to do some data wrangling in VBA and Google Apps Script that Tony Hirst on his oUseful blog had done using scraperwiki, Open refine plus various APIs. Today he posted a quick analysis using gephi and scraperwiki on which candidates supported each other in a local Election.
Here’s how to do the same thing using VBA and D3.js.
The whole thing
Public Sub ousefulSupportMashup()
' thanks to tony hirst for the data and method.
Dim worksheetName As String, scraperName As String, sqlString As String
worksheetName = "supportElection"
scraperName = "iw_poll_notices_scrape"
' candidates that support each other
sqlString = _
"select * from support where support in (select candinit from support)"
' get data from Tony's scraperwiki and populate sheet -
' this time from the support table
scraperWikiStuff scraperName, worksheetName, sqlString
' do a force d3.js diagram
d3ForceDo worksheetName, "election force options", "election force fields"
and here’s the result
You can see it live here
.. created from this data (candidates who supported other candidates) retrieved from scraperwiki
oh .. and of course we need to tweak a few parameters, as described in d3.js force diagrams from Excel.