A Pen by Blake Friedman on CodePen.
Last active
August 29, 2015 14:27
-
-
Save blakef/188cb12c8fa16fbaa927 to your computer and use it in GitHub Desktop.
VLJxxO
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
let c = { | |
width: 100, | |
height: 100 | |
}; | |
var svg = d3 | |
.select('body') | |
.append('svg') | |
.attr({ | |
width: c.width, | |
height: c.height | |
}) | |
; | |
let data = [d3.range(10), d3.range(10,50), d3.range(50, 100)]; | |
let x = d3.scale.linear().domain([1, 100]).range([0, c.width]); | |
let y = d3.scale.linear().domain([1, 100]).range([0, c.height]); | |
let line = d3.svg.line() | |
.x( (d,i) => x(i) ) | |
.y( (d,i) => y(d) ) | |
.interpolate('linear') | |
; | |
svg | |
.selectAll('path') | |
.data(data) | |
.enter() | |
.append('path') | |
.attr('d', (d,i) => line(d)) | |
.attr({ | |
stroke: 'red', | |
'stroke-width': 1, | |
fill: 'none' | |
}) | |
; | |
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
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment