Created
November 12, 2017 21:52
-
-
Save ahupowerdns/e83dd9b83ee97b17063575c3acdf00b3 to your computer and use it in GitHub Desktop.
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; | |
text-anchor: middle; /* or start or end */ | |
} | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} | |
</style> | |
<body> | |
<script src="//d3js.org/d3.v4.min.js"></script> | |
<script> | |
var margin = {top: 10, right: 100, bottom: 20, left: 100}, | |
width = 960 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
var xscale = d3.scaleLog() | |
.domain([.0001, 100.0]) | |
.range([0, width]); | |
var xAxis = d3.axisBottom(xscale) | |
.ticks(7, ",") | |
.tickSize(6, 6); | |
var yscale = d3.scaleLog() | |
.domain([1, 4000.0]) | |
.nice() | |
.range([height - margin.bottom, 0]); | |
var yAxis = d3.axisLeft(yscale) | |
.ticks(7, ",") | |
.tickSize(6, 6); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width + margin.left + margin.right) | |
.attr("height", height + margin.right + margin.bottom) | |
.attr("transform", "translate(30,30)"); | |
svg.append("g") | |
.classed("y axis", true) | |
.call(yAxis); | |
svg.append("g") | |
.attr("transform", "translate(6,"+(height-margin.bottom)+")") | |
.call(xAxis); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment