d3-react-container
v1.1.7
Published
D3 container for React.js
Downloads
21
Readme
d3-react-container
Maintainer
Installation
npm install d3-react-container
Usage
Using NPM
1 . Require d3-react-container after installation
import D3Container from 'd3-react-container'
2 . Add parent element = "html element" to D3Container component
<D3Container element="div" />
3 . Include d3 implementation in D3Callback props
<D3Container element="div"
d3Callback={selection => {
//d3 code
}/>
Options
| props | Type | Description | Default Value | | :--------- | :------- | :---------------- | :--------------- | | element | String | HTML element | 'div' | | D3Callback | Function | D3 Implementation | (selection)=> {} |
Example of using d3-react-container:
import D3Container from 'd3-react-container'
<D3Container
element="div"
d3Callback={selection => {
const div = selection.attr('class', 'App')
.style('width', '500px')
.style('height', '500px')
const header = div.append('header').attr('class', 'App-header')}/>
Contributing
We welcome your contribution! Fork the repo, make some changes, submit a pull-request!.
License
none