From a46c8d60fe7096f916ed96900661be97928f9de7 Mon Sep 17 00:00:00 2001
From: jcw780 <30562395+jcw780@users.noreply.github.com>
Date: Thu, 5 Nov 2020 17:32:16 -0500
Subject: [PATCH] feature: added button for updating graph layouts without
recomputing
---
src/components/App.tsx | 10 +-
src/components/Charts/Charts.tsx | 18 +--
src/components/SettingsBar/SettingsBar.tsx | 9 +-
.../SettingsBar/SettingsBarInternal.tsx | 125 +++++++++---------
src/components/SettingsBar/index.tsx | 7 +-
5 files changed, 93 insertions(+), 76 deletions(-)
diff --git a/src/components/App.tsx b/src/components/App.tsx
index 46e6233..4fd3f28 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -357,9 +357,12 @@ class App extends React.Component<{},{}> {
calculatedData.refAngles.push(temp);
}
//updateInitialData(calculatedData);
- if(this.graphsRef.current){
- this.graphsRef.current.updateData(calculatedData);
- }
+ this.updateCharts();
+ }
+ }
+ updateCharts = () => {
+ if(this.graphsRef.current){
+ this.graphsRef.current.updateData(this.calculatedData);
}
}
onUpdate = () => {this.navRef.current!.update();} // Update Navbar when charts are updated
@@ -391,6 +394,7 @@ class App extends React.Component<{},{}> {
settings={this.settings}
ref={this.Settingsref}
updateColors={this.updateColors}
+ updateCharts={this.updateCharts}
/>
diff --git a/src/components/Charts/Charts.tsx b/src/components/Charts/Charts.tsx
index 7b6ae3f..23fd680 100644
--- a/src/components/Charts/Charts.tsx
+++ b/src/components/Charts/Charts.tsx
@@ -539,16 +539,16 @@ export class ChartGroup extends React.Component{
if(graphData !== undefined){
for(const [rowIndex, chart] of target.entries()){
let counter = 0;
- const CRA = configs[rowIndex].axes.entries();
- for(const[, axis] of CRA){
- const ALE = axis.lines.entries();
- for(const[, line] of ALE){
+ for(const[, axis] of configs[rowIndex].axes.entries()){
+ for(const[, line] of axis.lines.entries()){
if(graphData[line.data] !== undefined){
- chart[singleChartIndex.config].data.datasets.push(addLine(
- graphData[line.data][shellIndex],
- line.lineLabel + name,
- axis.id,
- colors[counter]));
+ chart[singleChartIndex.config].data.datasets.push(
+ addLine(
+ graphData[line.data][shellIndex],
+ line.lineLabel + name,
+ axis.id,
+ colors[counter])
+ );
counter++;
}
}
diff --git a/src/components/SettingsBar/SettingsBar.tsx b/src/components/SettingsBar/SettingsBar.tsx
index 86d8001..138df58 100644
--- a/src/components/SettingsBar/SettingsBar.tsx
+++ b/src/components/SettingsBar/SettingsBar.tsx
@@ -3,13 +3,11 @@ import {Button, Collapse} from 'react-bootstrap';
import * as T from '../commonTypes';
import './SettingsBar.css';
+import {settingsBarProps} from './index';
const SettingsBarInternal = React.lazy(() => import('./SettingsBarInternal'));
interface settingsBarState{open: boolean}
-interface settingsBarProps{
- settings: T.settingsT, updateColors: Function
-}
export class SettingsBar extends React.Component{
state = {open : false}; scrollRef = React.createRef