Skip to content

Instantly share code, notes, and snippets.

Created April 3, 2016 04:07
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 anonymous/b03978a667bb96a7cf81d8ad8c5c68f6 to your computer and use it in GitHub Desktop.
Save anonymous/b03978a667bb96a7cf81d8ad8c5c68f6 to your computer and use it in GitHub Desktop.
fresh block
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
.axis path, .axis line { fill: none; stroke: black; }
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see!
var svg = d3.select("body")
.append("svg")
.attr("width", 950)
.attr("height", 500);
var scale = d3.scale.linear().domain([0, 10]).range([0, 900]);
var axis = d3.svg.axis().scale(scale);
var g = svg.append("g").attr("transform", "translate(15, 200)");
g.attr("class", "axis");
g.call(axis);
d3.selectAll(".tick text").on("click", function() {
});
// function doclick() {
// console.log(scale.domain()[1] - scale.domain()[0] );
// g.call(axis);
// }
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment