From fe2de0f524deef7d2f3e35398a978df120af3090 Mon Sep 17 00:00:00 2001 From: Markus Grigull Date: Sun, 24 Sep 2017 19:01:42 +0200 Subject: [PATCH] Fix widgets simulation models Fix plot widget time axis Fix visualization component key warning --- src/components/widget-plot-table.js | 1 - src/components/widget-plot/plot.js | 3 ++- src/components/widget-table.js | 10 ++++++---- src/containers/visualization.js | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/widget-plot-table.js b/src/components/widget-plot-table.js index ce5392d..0ff3082 100644 --- a/src/components/widget-plot-table.js +++ b/src/components/widget-plot-table.js @@ -44,7 +44,6 @@ class WidgetPlotTable extends Component { // Identify if there was a change in the preselected signals if (nextProps.simulation && (JSON.stringify(nextProps.widget.preselectedSignals) !== JSON.stringify(this.props.widget.preselectedSignals) || this.state.preselectedSignals.length === 0)) { - // Update the currently selected signals by intersecting with the preselected signals // Do the same with the plot values var intersection = this.computeIntersection(nextProps.widget.preselectedSignals, nextProps.widget.signals); diff --git a/src/components/widget-plot/plot.js b/src/components/widget-plot/plot.js index 4caf4c2..c7bff16 100644 --- a/src/components/widget-plot/plot.js +++ b/src/components/widget-plot/plot.js @@ -59,7 +59,7 @@ class Plot extends React.Component { // check if data is invalid if (nextProps.data == null || nextProps.data.length === 0 || nextProps.data[0].length === 0) { // create empty plot axes - const xScale = scaleTime().domain([Date.now() - 5 * nextProps.time * 1000, Date.now()]).range([leftMargin, nextProps.width]); + const xScale = scaleTime().domain([Date.now() - nextProps.time * 1000, Date.now()]).range([leftMargin, nextProps.width]); let yScale; if (nextProps.yUseMinMax) { @@ -112,6 +112,7 @@ class Plot extends React.Component { tick = () => { if (this.state.data == null || this.props.paused === true) { + this.setState({ lines: null }); return; } diff --git a/src/components/widget-table.js b/src/components/widget-table.js index 56389e9..e72bca7 100644 --- a/src/components/widget-table.js +++ b/src/components/widget-table.js @@ -62,10 +62,12 @@ class WidgetTable extends Component { var rows = []; nextProps.data[simulator.node][simulator.simulator].values.forEach((signal, index) => { - rows.push({ - name: simulationModel.mapping[index].name, - value: signal[signal.length - 1].y.toFixed(3) - }) + if (index < simulationModel.mapping.length) { + rows.push({ + name: simulationModel.mapping[index].name, + value: signal[signal.length - 1].y.toFixed(3) + }); + } }); this.setState({ rows: rows, sequence: nextProps.data[simulator.node][simulator.simulator].sequence }); diff --git a/src/containers/visualization.js b/src/containers/visualization.js index 52c2443..3af78e1 100644 --- a/src/containers/visualization.js +++ b/src/containers/visualization.js @@ -430,7 +430,7 @@ class Visualization extends React.Component { if (this.state.editing) { editingControls.push( -
+
Grid: {this.state.visualization.grid > 1 ? this.state.visualization.grid : 'Disabled'} this.setGrid(value)} />