Last active
August 29, 2015 14:02
-
-
Save radiodario/5574a6642f424a6da9fc to your computer and use it in GitHub Desktop.
wtfd3.js
This file contains hidden or 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
var data = [ | |
[ | |
{ | |
time: new Date(2000, 1, 1), | |
value: 10 | |
}, | |
{ | |
time: new Date(2000, 1, 2), | |
value: 20 | |
}, | |
{ | |
time: new Date(2000, 1, 3), | |
value: 30 | |
}, | |
{ | |
time: new Date(2000, 1, 4), | |
value: 40 | |
} | |
], [ | |
{ | |
time: new Date(2010, 1, 1), | |
value: 10 | |
}, | |
{ | |
time: new Date(2010, 1, 2), | |
value: 20 | |
}, | |
{ | |
time: new Date(2010, 1, 3), | |
value: 30 | |
}, | |
{ | |
time: new Date(2010, 1, 4), | |
value: 40 | |
} | |
] | |
]; | |
var paths = this.selection.data(data); | |
paths.enter() | |
.append('g') | |
.attr("class", "series") | |
.append('path') | |
.attr("class", "line"); | |
paths.selectAll('path.line') | |
.attr("d", function(d, i) { | |
console.log(JSON.stringify(d), i) | |
// lines is an array of line generators with different | |
// scales (i.e. drawing two time series with different x scales | |
// on top of each other) | |
return lines[i](d); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment