Skip to content

Instantly share code, notes, and snippets.

@d3indepth
Last active August 22, 2016 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3indepth/91a677b1246d2bfe28a6d27adf522d70 to your computer and use it in GitHub Desktop.
Save d3indepth/91a677b1246d2bfe28a6d27adf522d70 to your computer and use it in GitHub Desktop.
D3 axis
license: gpl-3.0
height: 200
border: no
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title>SVG Line Generator</title>
</head>
<style>
path {
fill: none;
stroke: #aaa;
}
</style>
<body>
<svg width="700" height="40">
<g class="axis" transform="translate(20, 0)" />
</svg>
<script src="//d3js.org/d3.v4.min.js"></script>
<script>
var scale = d3.scaleLinear().domain([0, 1000]).range([0, 600]);
var axis = d3.axisBottom().scale(scale);
d3.select('.axis')
.call(axis);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment