mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Fix gauge signal data
This commit is contained in:
parent
4b44ab0a80
commit
6d0ad4c236
1 changed files with 8 additions and 6 deletions
|
@ -82,12 +82,14 @@ class WidgetGauge extends Component {
|
|||
const signal = nextProps.data[simulator.node][simulator.simulator].values[nextProps.widget.signal];
|
||||
// Take just 3 decimal positions
|
||||
// Note: Favor this method over Number.toFixed(n) in order to avoid a type conversion, since it returns a String
|
||||
const new_value = Math.round( signal[signal.length - 1].y * 1e3 ) / 1e3;
|
||||
if (this.state.value !== new_value) {
|
||||
this.setState({ value: new_value });
|
||||
if (signal != null) {
|
||||
const new_value = Math.round( signal[signal.length - 1].y * 1e3 ) / 1e3;
|
||||
if (this.state.value !== new_value) {
|
||||
this.setState({ value: new_value });
|
||||
|
||||
// update gauge's value
|
||||
this.gauge.set(new_value);
|
||||
// update gauge's value
|
||||
this.gauge.set(new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +104,7 @@ class WidgetGauge extends Component {
|
|||
|
||||
if (this.props.simulation) {
|
||||
var simulationModel = this.props.simulation.models.filter((model) => model.simulator.node === this.props.widget.simulator.node && model.simulator.simulator === this.props.widget.simulator.simulator)[0];
|
||||
signalType = simulationModel && simulationModel.length > 0? simulationModel.mapping[this.props.widget.signal].type : '';
|
||||
signalType = (simulationModel != null && simulationModel.length > 0) ? simulationModel.mapping[this.props.widget.signal].type : '';
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Reference in a new issue