From 11c817013f57bcac761d15e54c4549e41ba652a5 Mon Sep 17 00:00:00 2001 From: Alexander Tornoreanu Date: Sun, 8 Sep 2019 17:19:38 +0200 Subject: [PATCH] fix incosistent data problem with bar chart --- app/components/ViewParsed.js | 31 ++++++++++++++++++------------- package.json | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/app/components/ViewParsed.js b/app/components/ViewParsed.js index ee928d4..4b7527a 100644 --- a/app/components/ViewParsed.js +++ b/app/components/ViewParsed.js @@ -21,15 +21,20 @@ export default class ViewParsed extends Component { balanceZoom: false, balanceZoomIndex: 0, balanceZoomPageSize: 30, - balanceZoomData: '', + balanceZoomData: {}, balanceZoomEnd: false, balanceZoomStart: true }; } toggleBalanceZoom() { - this.setState({ balanceZoom: !this.state.balanceZoom }); - this.recalculateBalanceData(0, this.state.balanceZoomPageSize); + this.setState({ balanceZoom: !this.state.balanceZoom }, () => { + if (this.state.balanceZoom) { + this.recalculateBalanceData(0, this.state.balanceZoomPageSize); + } else { + this.unZoomBalanceData(); + } + }); this.setState({ balanceZoomIndex: 1, balanceZoomStart: true, @@ -37,6 +42,13 @@ export default class ViewParsed extends Component { }); } + unZoomBalanceData() { + this.recalculateBalanceData( + 0, + this.state.parsedContent.balanceData.labels.length + ); + } + nextPageBalance() { if (this.state.balanceZoomEnd) { window.alert('already on the last page'); @@ -79,7 +91,6 @@ export default class ViewParsed extends Component { } recalculateBalanceData(start, end) { - this.setState({ parsedContent: JSON.parse(this.state.rawContent) }); let newBalanceData = { labels: this.state.parsedContent.balanceData.labels.slice(start, end), datasets: this.state.parsedContent.balanceData.datasets.map(dataset => { @@ -205,11 +216,7 @@ export default class ViewParsed extends Component { )} { - this.setState({ - parsedContent: JSON.parse(data), - rawContent: data - }); + this.setState({ parsedContent: JSON.parse(data) }); + this.unZoomBalanceData(); }); } } diff --git a/package.json b/package.json index 1f5c49c..3d033b1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ipm-hpc-v2", "productName": "IPM-HPC-v2", - "version": "0.7.0", + "version": "0.7.1", "description": "Interactive Visualization of MPI Performance Data (Bachelor Thesis)", "scripts": { "build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",