diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index 077de3f..d15a671 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -186,17 +186,17 @@ class Dashboard extends Component { componentDidUpdate(prevProps: Readonly

, prevState: Readonly, snapshot: SS) { // open web sockets if ICs are already known and sockets are not opened yet if (this.state.ics !== undefined && !Dashboard.webSocketsOpened) { - // only open sockets of ICs with configured input or output signals - let relevantICs = this.state.ics.filter(ic => { - let result = false; - this.state.configs.forEach(config => { - if(ic.id === config.icID && (config.inputLength !== 0 || config.outputLength !== 0)){ - result = true; - } + // only open sockets of ICs with configured input or output signals + let relevantICs = this.state.ics.filter(ic => { + let result = false; + this.state.configs.forEach(config => { + if(ic.id === config.icID && (config.inputLength !== 0 || config.outputLength !== 0)){ + result = true; + } + }) + return result; }) - return result; - }) - + if (relevantICs.length > 0) { console.log("Starting to open IC websockets:", relevantICs); AppDispatcher.dispatch({ diff --git a/src/widget/edit-widget/edit-widget-control-creator.js b/src/widget/edit-widget/edit-widget-control-creator.js index a207762..8eb6583 100644 --- a/src/widget/edit-widget/edit-widget-control-creator.js +++ b/src/widget/edit-widget/edit-widget-control-creator.js @@ -74,7 +74,8 @@ export default function CreateControls(widgetType = null, widget = null, session handleChange(e)} direction={'out'}/>, handleChange(e)} />, handleChange(e)} />, - handleChange(e)} /> + handleChange(e)} />, + handleChange(e)} /> ); break; case 'Table': diff --git a/src/widget/widget-factory.js b/src/widget/widget-factory.js index e3f4c2c..8a9baa8 100644 --- a/src/widget/widget-factory.js +++ b/src/widget/widget-factory.js @@ -90,6 +90,7 @@ class WidgetFactory { widget.customProperties.yMax = 10; widget.customProperties.yUseMinMax = false; widget.customProperties.lineColors = []; + widget.customProperties.showUnit = false; break; case 'Table': widget.minWidth = 200; @@ -150,7 +151,7 @@ class WidgetFactory { widget.customProperties.rangeMin = 0; widget.customProperties.rangeMax = 200; widget.customProperties.rangeUseMinMax = true; - widget.customProperties.showUnit = true; + widget.customProperties.showUnit = false; widget.customProperties.continous_update = false; widget.customProperties.default_value = '0'; widget.customProperties.value = ''; diff --git a/src/widget/widget-plot/plot-legend.js b/src/widget/widget-plot/plot-legend.js index 310bc49..096c67b 100644 --- a/src/widget/widget-plot/plot-legend.js +++ b/src/widget/widget-plot/plot-legend.js @@ -26,22 +26,13 @@ function Legend(props){ let color = typeof props.lineColor === "undefined" ? schemeCategory10[props.index % 10] : props.lineColor; - if(hasScalingFactor){ - return ( -

  • - {signal.name} - {signal.unit} - {signal.scalingFactor} -
  • - ) - } else { - return ( -
  • - {signal.name} - {signal.unit} -
  • - ) - } + return ( +
  • + {signal.name} + {props.showUnit ? {signal.unit} : <> } + {hasScalingFactor ? {signal.scalingFactor} : <>} +
  • + ) } class PlotLegend extends React.Component { @@ -51,10 +42,10 @@ class PlotLegend extends React.Component { diff --git a/src/widget/widgets/plot.js b/src/widget/widgets/plot.js index 1479081..a9303ab 100644 --- a/src/widget/widgets/plot.js +++ b/src/widget/widgets/plot.js @@ -107,7 +107,10 @@ class WidgetPlot extends React.Component { signalIDs={this.props.widget.signalIDs} /> - + ; } }