AnSavvides / d3act

d3 with React
MIT License
298 stars 26 forks source link

Adding new values to PieChart doesn't render correctly #13

Closed AnSavvides closed 9 years ago

AnSavvides commented 9 years ago

In essence, a new path is not added to the DOM.

Simple reproduction example:

class ExampleDonutChart extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            data: {
                "React": 2,
                "Babel": 5,
            }
        };
    }

    componentDidMount() {
        window.setTimeout(() => {
            this.setState({
                data: {
                    "React": 2,
                    "Babel": 5,
                    "Radium": 6
                }
            })
        }, 2000);
    }

    render() {
        return (
            <div>
                <h2>Donut Chart</h2>
                <Chart
                    type={"pie"}
                    width={300}
                    height={300}
                    innerRadius={100}
                    showTooltips={true}
                    data={this.state.data}
                />
            </div>
        );
    }

}