Skip to content

Instantly share code, notes, and snippets.

@dcousineau
Last active August 29, 2015 14:27
Show Gist options
  • Save dcousineau/4548a5301f80b0899097 to your computer and use it in GitHub Desktop.
Save dcousineau/4548a5301f80b0899097 to your computer and use it in GitHub Desktop.
class Line extends React.Component {
static contextTypes = {
xScale: React.PropTypes.func,
yScale: React.PropTypes.func
};
render() {
let path = d3.svg.line()
.interpolate("basis")
.x(d => this.context.xScale(d.x))
.y(d => this.context.yScale(d.y));
return (
<path d={path(this.props.data)}
stroke={this.props.color}
strokeWidth={this.props.width}
fill="none" />
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment