Created
February 1, 2013 04:04
-
-
Save vjpgo/4689107 to your computer and use it in GitHub Desktop.
d3.js major minor tick style 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.axis text { | |
font: 10px sans-serif; | |
} | |
.axis path { | |
fill: none; | |
stroke: #000; | |
stroke-width: 1.5; | |
shape-rendering: crispEdges; | |
} | |
.axis line { | |
fill: none; | |
stroke: green; | |
stroke-width: 1.0; | |
} | |
.axis .minor { | |
stroke: red; | |
stroke-width: 0.6; | |
} | |
</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