Skip to content

Instantly share code, notes, and snippets.

@RobinL
Created March 20, 2013 19:10
Show Gist options
  • Save RobinL/5207532 to your computer and use it in GitHub Desktop.
Save RobinL/5207532 to your computer and use it in GitHub Desktop.
Axis tick marks
{"description":"Axis tick marks","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01}
svg = d3.select("svg")
var myScale = d3.scale.linear()
.domain([0,100])
.range([0,400]);
var ticks = [0,50,60,100];
var myAxis = d3.svg.axis()
.scale(myScale)
.tickValues(ticks);
svg.append("g")
.attr("class", "axis")
.call(myAxis)
.attr("transform","translate(100,100)");
path {
fill: none;
stroke: black;
stroke-width: 1px;
shape-rendering: crispEdges;
}
line {
fill: none;
stroke: black;
stroke-width: 1px;
shape-rendering: crispEdges;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment