@politico/graphics-kit
v1.0.3
Published
[![npm version](https://badge.fury.io/js/%40politico%2Fgraphics-kit.svg)](https://badge.fury.io/js/%40politico%2Fgraphics-kit)
Downloads
20
Maintainers
Keywords
Readme
@politico/graphics-kit
Install
$ yarn add @politico/graphics-kit
Use
import { BaseChart, d3 } from '@politico/graphics-kit';
class MyChart extends BaseChart {
defaultProps = {
stroke: '#ccc',
}
defaultData = [60, 40, 20]
draw() {
const data = this.data();
const props = this.props();
const node = this.selection().node();
d3.select(node).appendSelect('svg');
// ...
}
}
Snippets
Includes Atom snippets to shortcut building your chart.
- Chart component demonstrates how to use the base chart component.
- Chart container imports your chart component into a React container component, with resize and higher-level state hooks.