Update index.js

I was using the component but realised that, with the way it was initially constructed, one cannot update the properties of the chart once it has been rendered. I added `componentWillReceiveProps` so that the chart will re-render upon new props being supplied to the component by passing the `newProps`. I also moved the logic that was previously in `componentDidMount` into a method called `updateChart` and now `componentDidMount` calls `updateChart` passing it `this.props`. The API remains unchanged. This pull request is to facilitate updating of the form after initial render.