AnSavvides / d3act

d3 with React
MIT License
298 stars 26 forks source link

Make customisable props more extensible #8

Closed AnSavvides closed 9 years ago

AnSavvides commented 9 years ago

Currently, we do the following in BaseChart:

this.showTooltips = this.props.showTooltips ? true : false;
this.transitionDuration = this.props.transitionDuration || 1000;

Let's instead move this information to an object like this:

const customisableProps = {
    showTooltips: true,
    transitionDuration: 1000
};

This way we'll have a default value per customisable prop and we can just add to that object when we want to add another prop.

We can then just iterate through each key and make the necessary assignments in the BaseChart constructor.