Skip to content

Instantly share code, notes, and snippets.

@mrahtz
Created May 2, 2015 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrahtz/74447b79b6d354b0cf34 to your computer and use it in GitHub Desktop.
Save mrahtz/74447b79b6d354b0cf34 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.axis path,
.axis line {
fill: none;
stroke-width: 1px;
stroke: black;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var margin = {top: 50, right: 50, bottom: 50, left: 50},
width = 300 - margin.left - margin.right,
height = 300 - margin.top - margin.bottom;
var xScale = d3.scale.linear()
.domain([0, 1])
.range([0, width]);
var xAxis = d3.svg.axis().scale(xScale)
.tickValues([0, 0.2525, 0.5, 1])
.innerTickSize(-50);
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/2 + ")")
.call(xAxis);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment