forked from vjpgo's block: d3.js major minor tick style 3
xxxxxxxxxx
<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="https://d3js.org/d3.v2.min.js?2.10.0"></script>
<script>
var margin = {top: 100, right: 100, bottom: 100, left: 100},
width = 1000 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var x = d3.scale.linear()
.domain([0,6000])
.range([0, width]);
var xAxis = d3.svg.axis()
.scale(x)
.tickValues(x.domain().filter(function(i) { return (i % 2 ==0); }))
.orient("bottom");
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(xAxis);
</script>
Modified http://d3js.org/d3.v2.min.js?2.10.0 to a secure url
https://d3js.org/d3.v2.min.js?2.10.0