Skip to content

Instantly share code, notes, and snippets.

@vjpgo
Created February 1, 2013 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vjpgo/4689130 to your computer and use it in GitHub Desktop.
Save vjpgo/4689130 to your computer and use it in GitHub Desktop.
d3.js major minor tick style 3
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.axis text {
font: 10px sans-serif;
}
.axis path {
fill: none;
stroke: #000;
stroke-width: 2.5px;
shape-rendering: crispEdges;
}
.axis line {
fill: none;
stroke: green;
stroke-width: 1.6px;
}
.axis .minor {
stroke: red;
stroke-width: 0.4px;
}
</style>
<body>
<script src="http://d3js.org/d3.v2.min.js?2.10.0"></script>
<script>
var margin = {top: 100, right: 100, bottom: 100, left: 100},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var x = d3.time.scale()
.domain([new Date, new Date])
.nice(d3.time.week)
.range([0, width]);
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
svg.append("g")
.attr("class", "x axis")
.call(d3.svg.axis().scale(x).orient("bottom").ticks(16).tickSubdivide(3).tickSize(-60, -60, 0));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment