mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Update plot widget to new simulator connection
This commit is contained in:
parent
f66d75aede
commit
9f3145aedf
2 changed files with 7 additions and 8 deletions
|
@ -28,7 +28,7 @@ class EditWidgetSignalsControl extends Component {
|
|||
|
||||
this.state = {
|
||||
widget: {
|
||||
simulator: ''
|
||||
simulator: {}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ class EditWidgetSignalsControl extends Component {
|
|||
|
||||
if (this.props.simulation) {
|
||||
// get selected simulation model
|
||||
const simulationModel = this.props.simulation.models.find( model => model.simulator === this.state.widget.simulator );
|
||||
const simulationModel = this.props.simulation.models.find( model => model.simulator.node === this.state.widget.simulator.node && model.simulator.simulator === this.state.widget.simulator.simulator );
|
||||
|
||||
// If simulation model update the signals to render
|
||||
signalsToRender = simulationModel? simulationModel.mapping : [];
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<FormGroup>
|
||||
<ControlLabel>Signals</ControlLabel>
|
||||
|
@ -81,4 +81,4 @@ class EditWidgetSignalsControl extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default EditWidgetSignalsControl;
|
||||
export default EditWidgetSignalsControl;
|
||||
|
|
|
@ -27,7 +27,6 @@ import PlotLegend from './widget-plot/plot-legend';
|
|||
class WidgetPlot extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
const simulator = this.props.widget.simulator;
|
||||
const simulation = this.props.simulation;
|
||||
let legendSignals = [];
|
||||
|
@ -36,10 +35,10 @@ class WidgetPlot extends Component {
|
|||
// Proceed if a simulation with models and a simulator are available
|
||||
if (simulator && simulation && simulation.models.length > 0) {
|
||||
|
||||
const model = simulation.models.find( (model) => model.simulator === simulator );
|
||||
const model = simulation.models.find( model => model.simulator.node === simulator.node && model.simulator.simulator === simulator.simulator );
|
||||
const chosenSignals = this.props.widget.signals;
|
||||
|
||||
simulatorData = this.props.data[simulator];
|
||||
simulatorData = this.props.data[simulator.node][simulator.simulator];
|
||||
|
||||
// Query the signals that will be displayed in the legend
|
||||
legendSignals = model.mapping.reduce( (accum, model_signal, signal_index) => {
|
||||
|
@ -53,7 +52,7 @@ class WidgetPlot extends Component {
|
|||
return (
|
||||
<div className="plot-widget" ref="wrapper">
|
||||
<h4>{this.props.widget.name}</h4>
|
||||
|
||||
|
||||
<div className="widget-plot">
|
||||
<Plot signals={ this.props.widget.signals } time={ this.props.widget.time } simulatorData={ simulatorData } yAxisLabel={ this.props.widget.ylabel } />
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue