Connections in electoral data – D3 and VBA follow on from oUseful post

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

I already have all the components – scraperwiki to Excel and creating d3.js force diagrams from Excel. So I just needed a couple of lines of code to pull it all together.

 

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.

 

Example

You can find the code by downloading the cDataSet.xlsm workbook from Excel liberation. It’s in the scraperWiki module,  the supportElection and d3allparameters tab.
About brucemcp 223 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


four × one =