summaryrefslogtreecommitdiffstats
path: root/webapp/components/analytics/doughnut_chart.jsx
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-06-09 12:08:20 -0300
committerJoram Wilander <jwawilander@gmail.com>2016-06-09 11:08:20 -0400
commit1b2fd5af5e55b6da3a2da5534570f357b0c643f3 (patch)
treec2aac2d72b619801c898da521cc4250ef682c4bf /webapp/components/analytics/doughnut_chart.jsx
parent6a3e742e9b52ab82e192085c648782aa52195bea (diff)
downloadchat-1b2fd5af5e55b6da3a2da5534570f357b0c643f3.tar.gz
chat-1b2fd5af5e55b6da3a2da5534570f357b0c643f3.tar.bz2
chat-1b2fd5af5e55b6da3a2da5534570f357b0c643f3.zip
PLT-3257 Fix Team Statistics (#3290)
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() {