summaryrefslogtreecommitdiffstats
path: root/webapp/components/analytics/doughnut_chart.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-06-13 15:29:24 -0400
committerJoramWilander <jwawilander@gmail.com>2016-06-13 15:29:24 -0400
commit5af526c259d9c6477d67eb8f8a1e7b86270c7294 (patch)
tree97cc595107026a1f19d6fd6e35627dda23979aa3 /webapp/components/analytics/doughnut_chart.jsx
parentbb5ca5a8780f9259306d881e85760de8b87ddea8 (diff)
parent974238231b9cdbd39a825ec8e9299fbb0b51f6b8 (diff)
downloadchat-5af526c259d9c6477d67eb8f8a1e7b86270c7294.tar.gz
chat-5af526c259d9c6477d67eb8f8a1e7b86270c7294.tar.bz2
chat-5af526c259d9c6477d67eb8f8a1e7b86270c7294.zip
Merge branch 'release-3.1'
Conflicts: webapp/components/create_comment.jsx
Diffstat (limited to 'webapp/components/analytics/doughnut_chart.jsx')
-rw-r--r--webapp/components/analytics/doughnut_chart.jsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/webapp/components/analytics/doughnut_chart.jsx b/webapp/components/analytics/doughnut_chart.jsx
index b946ad8bb..5834e290a 100644
--- a/webapp/components/analytics/doughnut_chart.jsx
+++ b/webapp/components/analytics/doughnut_chart.jsx
@@ -23,26 +23,26 @@ export default class DoughnutChart extends React.Component {
componentDidUpdate(prevProps) {
if (!Utils.areObjectsEqual(prevProps.data, this.props.data) || !Utils.areObjectsEqual(prevProps.options, this.props.options)) {
- if (this.chart) {
- this.chart.destroy();
- }
- this.initChart();
+ this.initChart(true);
}
}
componentWillUnmount() {
- if (this.chart) {
+ if (this.chart && this.refs.canvas) {
this.chart.destroy();
}
}
- initChart() {
+ initChart(update) {
if (!this.refs.canvas) {
return;
}
var el = ReactDOM.findDOMNode(this.refs.canvas);
var ctx = el.getContext('2d');
this.chart = new Chart(ctx, {type: 'doughnut', data: this.props.data, options: this.props.options || {}}); //eslint-disable-line new-cap
+ if (update) {
+ this.chart.update();
+ }
}
render() {