Skip to content

Instantly share code, notes, and snippets.

@kristw
Last active October 17, 2016 13:50
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kristw/09d462027bb50e80cec0c53c0856e663 to your computer and use it in GitHub Desktop.
Using d3Kit to scaffold <svg>
license: mit

Create a scaffold from d3Kit SvgChart.

<!DOCTYPE html>
<title>blockup</title>
<link href='style.css' rel='stylesheet' />
<body>
<div id="chart"></div>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://rawgit.com/twitter/d3kit/v3/dist/d3kit.min.js"></script>
<script src='main.js'></script>
</body>
var chart = new d3Kit.SvgChart('#chart', {
initialWidth: 720,
initialHeight: 500,
margin: { top: 30, right: 30, bottom: 30, left: 30 },
offset: { x: 0.5, y: 0.5 } // add little offset for sharp-edge rendering
});
chart.rootG.append('circle')
.attr('cx', 40)
.attr('cy', 40)
.attr('r', 30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment