Commit 9eb42466 authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

wip: fix for value widget:more elegant solution for display issues #192

parent cfcdbc41
......@@ -249,6 +249,7 @@ span.signal-unit::after {
width: 100%;
height: 100%;
display: flex;
flex: none;
word-wrap: break-word;
}
......
......@@ -68,13 +68,16 @@ class WidgetValue extends Component {
}
render() {
let unit = " [" + this.state.unit + "]";
let value_to_render = Number(this.state.value);
let value_width = this.props.widget.customProperties.textSize*0.55* (this.state.value.length +2);
let unit_width = this.props.widget.customProperties.textSize*2;
return (
<div className="single-value-widget">
<strong style={{ fontSize: this.props.widget.customProperties.textSize + 'px' }}>{this.props.widget.name}</strong>
<span style={{ fontSize: this.props.widget.customProperties.textSize + 'px'}}>{Number.isNaN(value_to_render) ? NaN : format('.3s')(value_to_render)}
{this.props.widget.customProperties.showUnit && unit }</span>
<strong style={{ fontSize: this.props.widget.customProperties.textSize + 'px'}}>{this.props.widget.name}</strong>
<span style={{ fontSize: this.props.widget.customProperties.textSize + 'px',width: value_width }}>{Number.isNaN(value_to_render) ? NaN : format('.3s')(value_to_render)}</span>
{this.props.widget.customProperties.showUnit &&
<span style={{ fontSize: this.props.widget.customProperties.textSize + 'px', width: unit_width}}>[{this.state.unit}]</span>
}
</div>
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment