A D3 module to support the creation of London Squared cartograms.
Getting started
The quickest way to get started with the London Squared D3 module is by including the module in your page with a script tag (you’ll also need to include D3). Just put the following tags into your HTML document and you’re ready to go…
<script src="https://d3js.org/d3.v5.min.js">
</script>
<script src="https://unpkg.com/@aftertheflood/londonsquared/dist/index.js">
</script>
If you’re using webpack or something similar to compile your code you can install the package via npm.
npm install --save @aftertheflood/londonsquared
For next steps you could either read the API documentation, dive into some of the code examples or explore some interactive Observable notebooks.
A note about data requirements
With the London Squared module Data is bound to shapes by the boroughs’ standard ONS code so in order to bind your data to the layout you’ll need to include those codes, by default you can include a property in each borough’s data called code and the layout should find that, if this isn’t possible or convenient then you can specify an accessor function.
Developing
For local development work on the London Squared module you should have NodeJS and npm installed. You can use these npm scripts
npm run build
uses webpack to compile the code in the src directory outputting to the dist directory.npm run serve
runs browser-sync on the site directory.