Skip to content

Instantly share code, notes, and snippets.

@abierbaum
abierbaum / index.html
Created July 10, 2012 19:12 — forked from mbostock/.block
Axis Component (AB)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@abierbaum
abierbaum / app.js
Created July 10, 2012 18:08 — forked from abierbaum/app.js
Test for data based line chart.
//
// Chart example
//
// - Shows multiple lines in one chart
// - User can see scale showing the values and the timeframe
// - Each line has separate color
// - Show legend of groups with colors
// - Support transitions to:
// - Change data shown
// - Change the items shown (keep colors for old ones)
@abierbaum
abierbaum / app.js
Created July 10, 2012 15:43
Test for line chart in d3.js
var data = [3,7,9,1,4,6,8,2,5],
w = 700,
h = 300,
max_val = d3.max(data);
// Scales
x = d3.scale.linear()
.domain([0, data.length - 1])
.range([0, w]);
y = d3.scale.linear()