Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#905 Charts className fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Jun 26, 2017
1 parent 91566fc commit 3451a82
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/assets/css/indicator.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}

.kpis-wrapper {
clear:both;
margin: -.5rem;
display: flex;
flex-direction: row;
Expand Down
6 changes: 3 additions & 3 deletions src/components/charts/PieChartComponent/svg.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as d3 from 'd3';

export const getSvg = (chartClass, width, height, wrapperWidth) => {
d3.select('.chart-item').remove();
d3.select('.chart-item' + chartClass).remove();
const svg = d3.select('.' + chartClass)
.attr('width', width)
.attr('height', height)
.append('g')
.attr('class', 'chart-item');
.attr('class', 'chart-item' + chartClass);

const chart = svg
.attr('width', width)
Expand All @@ -21,4 +21,4 @@ export const getSvg = (chartClass, width, height, wrapperWidth) => {
.attr('class', 'slices');

return svg;
};
};
24 changes: 14 additions & 10 deletions src/components/charts/RawChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,7 @@ class RawChart extends Component {
const { pollInterval, noData } = this.props;

if(noData) return;

this.fetchData();

if (pollInterval){
this.setState({
intervalId: setInterval(() => {
this.fetchData();
}, pollInterval * 1000)
})
}
this.init();
}

componentWillUnmount(){
Expand All @@ -70,6 +61,19 @@ class RawChart extends Component {
})
}
}

init = () => {
const {pollInterval} = this.props;
this.fetchData();

if (pollInterval){
this.setState({
intervalId: setInterval(() => {
this.fetchData();
}, pollInterval * 1000)
})
}
}

getData() {
const { id, chartType } = this.props;
Expand Down
3 changes: 2 additions & 1 deletion src/components/dashboard/ChartWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export class ChartWidget extends Component {
} = this.state;

const isMaximized = idMaximized === id;

if(!isMaximized && typeof idMaximized === 'number') return false;

return (
<div>
<div
Expand Down

0 comments on commit 3451a82

Please sign in to comment.