mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Fix widgets simulation models
Fix plot widget time axis Fix visualization component key warning
This commit is contained in:
parent
94003207f3
commit
fe2de0f524
4 changed files with 9 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -430,7 +430,7 @@ class Visualization extends React.Component {
|
|||
|
||||
if (this.state.editing) {
|
||||
editingControls.push(
|
||||
<div>
|
||||
<div key={editingControls.length}>
|
||||
<span>Grid: {this.state.visualization.grid > 1 ? this.state.visualization.grid : 'Disabled'}</span>
|
||||
<Slider value={this.state.visualization.grid} style={{ width: '80px' }} step={5} onChange={value => this.setGrid(value)} />
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue