]> source.dussan.org Git - sonarqube.git/commitdiff
update size of bar chart
authorStas Vilchik <stas.vilchik@sonarsource.com>
Fri, 20 Oct 2017 14:41:03 +0000 (16:41 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Mon, 23 Oct 2017 06:57:31 +0000 (08:57 +0200)
server/sonar-web/src/main/js/components/charts/bar-chart.js

index 8e963366f677fbb0faf10dca02354d6f3d096574..1548036d0c6672e2a18dfd642be1b1fb65ca37b3 100644 (file)
@@ -48,6 +48,15 @@ export const BarChart = createReactClass({
     };
   },
 
+  componentDidUpdate(prevProps) {
+    if (this.props.width && prevProps.width !== this.props.width) {
+      this.setState({ width: this.props.width });
+    }
+    if (this.props.height && prevProps.height !== this.props.height) {
+      this.setState({ height: this.props.height });
+    }
+  },
+
   getInitialState() {
     return { width: this.props.width, height: this.props.height };
   },