Commit fc5df107 authored by Mike Bostock's avatar Mike Bostock
Browse files

Remove axis examples.

Replaced by <http://bl.ocks.org/4349486>, among others.
parent 57308ff1
<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../d3.js"></script>
<style>
body {
font: 10px sans-serif;
}
line, path {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.minor :not(.minor) {
display: none;
}
</style>
<body>
<script>
var margin = {top: 10, right: 10, bottom: 20, left: 10},
width = 960 - margin.right - margin.left,
height = 80 - margin.top - margin.bottom;
var x = d3.scale.linear()
.domain([.05, .95])
.range([0, width]);
var y = d3.scale.linear()
.range([0, height]);
var svg = d3.select("body").append("svg")
.attr("width", width + margin.right + margin.left)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
svg.append("g")
.attr("class", "x minor")
.attr("transform", "translate(0," + height + ")")
.call(d3.svg.axis().scale(x).tickSubdivide(2).tickSize(-6));
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(d3.svg.axis().scale(x));
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../d3.js"></script>
<style>
body {
font: 10px sans-serif;
}
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
</style>
<body>
<script>
var margin = {top: 10, right: 12, bottom: 20, left: 12},
width = 960 - margin.left - margin.right,
height = 80 - margin.top - margin.bottom;
var x = d3.scale.sqrt()
.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")
.attr("transform", "translate(0," + height + ")")
.call(d3.svg.axis()
.scale(x)
.orient("bottom")
.tickValues([.01, .02, .03, .05, .08, .13, .21, .34, .55, .89])
.tickFormat(d3.format(".02f")));
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../d3.js"></script>
<style>
body {
font: 10px sans-serif;
}
rect {
fill: #ddd;
}
.grid line {
stroke: #fff;
}
.grid line.minor {
stroke-width: .5px;
}
.grid text {
display: none;
}
.axis line {
stroke: #000;
}
path {
display: none;
}
</style>
<body>
<script>
var margin = {top: 10, right: 10, bottom: 20, left: 10},
width = 960 - margin.right - margin.left,
height = 80 - margin.top - margin.bottom;
var x = d3.scale.linear()
.domain([.05, .95])
.range([0, width]);
var y = d3.scale.linear()
.range([0, height]);
var svg = d3.select("body").append("svg")
.attr("width", width + margin.right + margin.left)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
svg.append("rect")
.attr("width", width)
.attr("height", height);
svg.append("g")
.attr("class", "x grid")
.attr("transform", "translate(0," + height + ")")
.call(d3.svg.axis().scale(x).tickSubdivide(1).tickSize(-height));
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(d3.svg.axis().scale(x));
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../d3.js"></script>
<style>
body {
font: 10px sans-serif;
}
.axis line, .axis path {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
</style>
<body>
<script>
var margin = {top: 20, right: 40, bottom: 20, left: 40},
width = 960 - margin.right - margin.left,
height = 500 - margin.top - margin.bottom;
var x = d3.time.scale()
.domain([new Date(2011, 07, 01), new Date(2011, 07, 08)])
.range([0, width]);
var y = d3.scale.sqrt()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.ticks(d3.time.days)
.tickFormat(d3.time.format("%m/%d"));
var yAxis = d3.svg.axis()
.scale(y);
var svg = d3.select("body").append("svg")
.attr("width", width + margin.right + margin.left)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
svg.append("g")
.attr("class", "bottom axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis.orient("bottom"));
svg.append("g")
.attr("class", "top axis")
.call(xAxis.orient("top"));
svg.append("g")
.attr("class", "left axis")
.call(yAxis.orient("left"));
svg.append("g")
.attr("class", "right axis")
.attr("transform", "translate(" + width + ",0)")
.call(yAxis.orient("right"));
</script>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment