forked from ddrilling/asb_cloud_front
Отображение графиков мониторинга исправлено
This commit is contained in:
parent
4937dddf87
commit
de72f13bac
@ -5,17 +5,13 @@ import {ChartTimeOnlineFooter} from './ChartTimeOnlineFooter';
|
||||
const stroke = (sz='1px', c='white') => ({ textShadow: `-${sz} -${sz} 0 ${c}, ${sz} -${sz} 0 ${c}, -${sz} ${sz} 0 ${c}, ${sz} ${sz} 0 ${c}` })
|
||||
|
||||
export const Column = ({lineGroup, data, interval, showBorder, style, headerHeight}) => {
|
||||
let dataLast = null
|
||||
let pv = null
|
||||
if (data?.length > 0) {
|
||||
dataLast = data[data.length - 1];
|
||||
pv = lineGroup.filter(line => line.showGraph).map(line => ({
|
||||
let dataLast = data?.length > 0 ? data[data.length - 1] : null
|
||||
let pv = lineGroup.filter(line => line.showGraph).map(line => ({
|
||||
color: line.color,
|
||||
label: line.label,
|
||||
unit: line.units,
|
||||
value: dataLast[line.xAccessorName]
|
||||
value: dataLast?.[line.xAccessorName]
|
||||
}))
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
@ -27,7 +23,7 @@ export const Column = ({lineGroup, data, interval, showBorder, style, headerHeig
|
||||
<div style={{position: 'relative'}}>
|
||||
<Grid className={'display_chart_values'}>
|
||||
{pv?.map((v, idx) => (
|
||||
<GridItem key={idx} col={1} row={idx} style={{...stroke(), color: v.color, padding: '0 4px'}}>{v.value.toFixed(2)} {v.unit}</GridItem>
|
||||
<GridItem key={idx} col={1} row={idx} style={{...stroke(), color: v.color, padding: '0 4px'}}>{v.value?.toFixed(2) ?? '--'} {v.unit}</GridItem>
|
||||
))}
|
||||
</Grid>
|
||||
<ChartTimeOnline
|
||||
|
@ -43,7 +43,7 @@ const blockHeightGroup = [
|
||||
dash
|
||||
}, {
|
||||
label: 'Расход',
|
||||
units: 'м³/ч',
|
||||
units: 'л/c',
|
||||
xAccessorName: 'flow',
|
||||
yAccessorName: 'date',
|
||||
color: '#077',
|
||||
|
Loading…
Reference in New Issue
Block a user