An implementation of d3-cartogram in D3.js version 2. Based on Maggie Lee's block of Georgia counties, which was based on Jeff Fletcher's tutorial. The algorithm used to construct the cartogram is by James A. Dougenik, Nicholas R. Chrisman, and Duane R. Niemeyer.
xxxxxxxxxx
<head>
<meta charset="utf-8">
</head>
<body>
<div id="legendholder">
<button id="click_to_run" onclick="do_update()">View by Population</button>
<button id="click_to_normal" onclick="do_normal()">View Normal</button>
</div>
<div id="map-wrapper"></div>
<script src="https://d3js.org/d3.v2.min.js"></script>
<script src="topojson.js"></script>
<script src="cartogram.js"></script>
<script src="scripts.js"></script>
</body>
</html>
https://d3js.org/d3.v2.min.js