Created
November 6, 2017 11:15
-
-
Save albertorestifo/91e67c96a3a1c16fdd3cce5758e8a05b to your computer and use it in GitHub Desktop.
Charts In React - Article resources
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
import React, { Component } from 'react'; | |
import { select } from 'd3-select'; | |
class LineChart extends Component { | |
componentDidMount() { | |
this.renderChart(); | |
} | |
renderChart() { | |
const svg = select(this.containerEl); | |
// ... d3 logic goes here | |
} | |
render() { | |
return ( | |
<svg | |
width="960" | |
height="500" | |
ref={el => this.containerEl = el} | |
/> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment