Commit 323d5ef2 authored by 陈龙's avatar 陈龙

fix: 修复历史曲线的tooltip显示异常的问题

parent cc0a3f03
......@@ -37,7 +37,7 @@ path: /
## 多图表
<code src="./demos/GridDemo.js"></code>
[//]: # (<code src="./demos/GridDemo.js"></code>)
## API
......
......@@ -70,13 +70,14 @@ import HistoryView from '../index';
"deviceType": "二供泵房"
}
]*/
const deviceParams = [
{
/*const deviceParams = [
/!* {
"deviceCode": "EGBF00000141",
"sensors": "进水压力,出水瞬时流量,今日用电量",
"deviceType": "二供泵房"
}
/* {
}*!/
/!* {
"deviceCode": "EGBF00000244",
"sensors": "进水压力,出水瞬时流量,今日用电量,今日供水量",
"deviceType": "二供泵房"
......@@ -90,8 +91,20 @@ const deviceParams = [
"deviceCode": "EGBF00000184",
"sensors": "进水压力,出水瞬时流量,今日用电量,今日供水量",
"deviceType": "二供泵房"
}*/
];
}*!/
];*/
const deviceParams = [
{
"deviceCode": "EGJZ00000002",
"sensors": "出水实际压力,1#水箱液位",
"deviceType": "二供机组"
},
{
"deviceCode": "EGBF00000004",
"sensors": "今日用电量,今日供水量",
"deviceType": "二供泵房"
}
]
const Demo = () => {
return <div style={{height: 700}}>
<HistoryView deviceParams={deviceParams} grid/>
......
......@@ -192,22 +192,22 @@ import { MobileHistoryChart } from '../mobile';
];*/
const deviceParams = [
// 预测的
/* {
{
"deviceCode": "YLB00000041",
"sensors": "进水压力",
"deviceType": "压力表"
}*/
},
/* {
"deviceCode": "SSBF00000001",
"sensors": "出水压力",
"deviceType": "送水泵房"
}*/
//预测结束
{
/* {
"deviceCode": "EGBF00000141",
"sensors": "进水压力,出水瞬时流量,今日用电量",
"deviceType": "二供泵房"
}
}*/
]
const Demo = () => {
return (
......
......@@ -338,7 +338,7 @@ const HistoryView = (props) => {
const [allSensorType, setAllSensorType] = useState([]);
const [isSingleStatusSensor, setIsSingleStatusSensor] = useState(false);
const [predicateDevice, setPredicateDevice] = useState(null);
const [predicateData, setPredicateData] = useState(null);
const [predicateData, setPredicateData] = useState([]);
// 历史数据相关的特征描述
const deviceConfig = useRef({
oneDevice: deviceParams.length === 1, //单设备
......
......@@ -538,7 +538,7 @@ const returnXAxis = ({
return final
}, [])?.length;
// 线图 且 有预测数据情况下,才合并预测数据
let series = (predicateData && chartType === 'lineChart' ? dataSource.concat(predicateData) : dataSource)
let series = (predicateData && predicateData.length && chartType === 'lineChart' ? dataSource.concat(predicateData) : dataSource)
.filter((item) => {
if (item.sensorName === '是否在线') {
_offlineData.push(item);
......@@ -1183,7 +1183,7 @@ const optionGenerator = (
</div>`;
},
};
if (predicateData) {
if (predicateData && predicateData.length) {
tooltip = {
trigger: 'axis',
formatter: (e) => {
......
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