mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
use SI prefixes in value widget
This commit is contained in:
parent
d3b1af177e
commit
e7b5aa6c0d
1 changed files with 2 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { format } from 'd3';
|
||||
|
||||
class WidgetValue extends Component {
|
||||
constructor(props) {
|
||||
|
@ -59,7 +60,7 @@ class WidgetValue extends Component {
|
|||
return (
|
||||
<div className="single-value-widget">
|
||||
<strong style={{ fontSize: this.props.widget.textSize + 'px' }}>{this.props.widget.name}</strong>
|
||||
<span style={{ fontSize: this.props.widget.textSize + 'px' }}>{Number.isNaN(value_to_render) ? NaN : value_to_render.toFixed(3)}</span>
|
||||
<span style={{ fontSize: this.props.widget.textSize + 'px' }}>{Number.isNaN(value_to_render) ? NaN : format('.3s')(value_to_render)}</span>
|
||||
{this.props.widget.showUnit &&
|
||||
<span style={{ fontSize: this.props.widget.textSize + 'px' }}>[{this.state.unit}]</span>
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue