forked from ddrilling/asb_cloud_front
CF2-7: Добавлены стрелки роста/убывания в компонент DisplayValue
This commit is contained in:
parent
0c351640cd
commit
3274fca6a8
@ -1,13 +1,25 @@
|
||||
export const ValueDisplay = ({prefix, value, suffix}) =>{
|
||||
let val = '---'
|
||||
import { useState } from 'react';
|
||||
import {CaretUpOutlined, CaretDownOutlined} from '@ant-design/icons'
|
||||
|
||||
export const ValueDisplay = ({prefix, value, suffix, isArrowVisible}) =>{
|
||||
const [oldVal, setOldVal] = useState(NaN)
|
||||
|
||||
let val = '---'
|
||||
let arrow = null
|
||||
if(value)
|
||||
if(Number.isFinite(+value))
|
||||
if(Number.isFinite(+value)){
|
||||
val = (+value).toPrecision(4)??'---'
|
||||
else
|
||||
if (isArrowVisible)
|
||||
{
|
||||
arrow = value > oldVal
|
||||
? <CaretUpOutlined style={{color:"red"}} onClick={!isArrowVisible} />
|
||||
: <CaretDownOutlined style={{color:"red"}} onClick={!isArrowVisible} />
|
||||
setOldVal(value)
|
||||
}
|
||||
} else
|
||||
val = value
|
||||
|
||||
return(<span className='display_value'>{prefix} {val} {suffix}</span>)
|
||||
return(<span className='display_value'>{prefix} {val} {suffix}{arrow}</span>)
|
||||
}
|
||||
|
||||
export const Display = (props)=>{
|
||||
|
@ -97,7 +97,7 @@ export const Column = ({ lineGroup, data, interval }) => {
|
||||
<Display
|
||||
label={lineGroup.label}
|
||||
value={pv}
|
||||
suffix={lineGroup.linePv?.units} />
|
||||
suffix={lineGroup.linePv?.units} isArrowVisible={true}/>
|
||||
<ChartTimeOnline
|
||||
data={data}
|
||||
yDisplay={lineGroup.yDisplay}
|
||||
|
Loading…
Reference in New Issue
Block a user