Skip to content

Instantly share code, notes, and snippets.

@jkuhnert
Created May 22, 2014 16:12
Show Gist options
  • Save jkuhnert/5cd0e31816fd4908ad1d to your computer and use it in GitHub Desktop.
Save jkuhnert/5cd0e31816fd4908ad1d to your computer and use it in GitHub Desktop.
SO one axis to rule them all
{"description":"SO one axis to rule them all","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"day.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"week.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"month.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/T5nTCvk.png"}
time value
20/03 10:00 10
20/03 11:13 10
20/03 12:00 10
20/03 12:45 10
20/03 17:42 10
20/03 18:30 10
var margin = {top:10,right:10,left:10,bottom:40},
width = 700,
height= 400,
dayData = tributary.day,
weekData = tributary.week,
monthData = tributary.month,
parse = d3.time.format('%d/%m %H:%M').parse;
xScale = d3.time.scale()
.range([0,width]);
xAxis = d3.svg.axis().ticks(5)
var svg = d3.select("svg");
svg.append("g")
.attr("transform", "translate("+ margin.left +"," + (height - margin.bottom - 200) + ")")
.call(xAxis.scale(xScale.domain(d3.extent(dayData, function(d){return parse(d.time)}))))
svg.append("g")
.attr("transform", "translate("+ margin.left +"," + (height - margin.bottom - 100) + ")")
.call(xAxis.scale(xScale.domain(d3.extent(weekData, function(d){return parse(d.time)}))))
svg.append("g")
.attr("transform", "translate("+ margin.left +"," + (height - margin.bottom - 0) + ")")
.call(xAxis.scale(xScale.domain(d3.extent(monthData, function(d){return parse(d.time)}))))
time value
20/03 10:00 10
29/03 11:13 10
01/04 12:00 10
15/04 12:45 10
01/05 17:42 10
20/05 18:30 -375
time value
20/03 10:00 10
21/03 11:13 10
21/03 12:00 10
22/03 12:45 10
24/03 17:42 10
25/03 18:30 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment