Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
5df25a71
Commit
5df25a71
authored
Apr 04, 2023
by
张瑶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 历史数据曲线更新
parent
e3be0a7d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
SingleChart.js
packages/extend-components/EC_HistoryView/src/SingleChart.js
+5
-3
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+9
-5
No files found.
packages/extend-components/EC_HistoryView/src/SingleChart.js
View file @
5df25a71
...
@@ -38,6 +38,11 @@ const SimgleChart = memo((props) => {
...
@@ -38,6 +38,11 @@ const SimgleChart = memo((props) => {
const
option
=
cloneDeep
(
chart
.
getOption
());
const
option
=
cloneDeep
(
chart
.
getOption
());
const
needMarkLine
=
count
===
1
;
const
needMarkLine
=
count
===
1
;
option
.
series
.
forEach
((
item
,
index
)
=>
{
option
.
series
.
forEach
((
item
,
index
)
=>
{
let
offlineAreas
=
offlineArea
(
dataSource
[
index
]);
if
(
offlineAreas
.
data
?.
length
)
{
option
.
markArea
=
null
;
item
.
markArea
=
offlineAreas
;
}
if
(
needMarkLine
&&
selected
[
item
.
name
])
{
if
(
needMarkLine
&&
selected
[
item
.
name
])
{
item
.
markLine
=
alarmMarkLine
(
item
.
markLine
=
alarmMarkLine
(
dataSource
[
index
],
dataSource
[
index
],
...
@@ -46,14 +51,11 @@ const SimgleChart = memo((props) => {
...
@@ -46,14 +51,11 @@ const SimgleChart = memo((props) => {
deviceAlarmSchemes
,
deviceAlarmSchemes
,
);
);
item
.
markPoint
=
minMaxMarkPoint
(
dataSource
[
index
],
index
,
[
dataSource
[
index
]]);
item
.
markPoint
=
minMaxMarkPoint
(
dataSource
[
index
],
index
,
[
dataSource
[
index
]]);
item
.
markArea
=
offlineArea
(
dataSource
[
index
]);
}
else
{
}
else
{
item
.
markLine
=
{};
item
.
markLine
=
{};
item
.
markPoint
=
{};
item
.
markPoint
=
{};
item
.
markArea
=
offlineArea
(
dataSource
[
index
]);
}
}
});
});
console
.
log
(
'wwww'
,
option
);
chart
.
setOption
(
option
,
true
);
chart
.
setOption
(
option
,
true
);
}
}
if
(
!
chart
)
return
;
if
(
!
chart
)
return
;
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
5df25a71
...
@@ -198,9 +198,7 @@ export const decorateAxisGridLine = (axis, showGrid) => {
...
@@ -198,9 +198,7 @@ export const decorateAxisGridLine = (axis, showGrid) => {
* @param {any} dataItem
* @param {any} dataItem
*/
*/
export
const
offlineArea
=
(
dataItem
)
=>
{
export
const
offlineArea
=
(
dataItem
)
=>
{
// 只有一个数据曲线时显示markline
if
(
!
dataItem
)
return
{};
if
(
!
dataItem
)
return
{};
console
.
log
(
'wwww'
,
dataItem
);
const
{
dataModel
}
=
dataItem
;
const
{
dataModel
}
=
dataItem
;
let
datas
=
new
Array
();
let
datas
=
new
Array
();
let
offlineData
=
[];
let
offlineData
=
[];
...
@@ -210,20 +208,19 @@ export const offlineArea = (dataItem) => {
...
@@ -210,20 +208,19 @@ export const offlineArea = (dataItem) => {
offlineData
=
[
offlineData
=
[
{
{
name
:
'离线'
,
name
:
'离线'
,
xAxis
:
item
.
pt
,
xAxis
:
new
Date
(
item
.
pt
)
,
},
},
];
];
hasOffline
=
true
;
hasOffline
=
true
;
}
else
if
(
item
.
pv
&&
hasOffline
)
{
}
else
if
(
item
.
pv
&&
hasOffline
)
{
offlineData
.
push
({
offlineData
.
push
({
xAxis
:
item
.
pt
,
xAxis
:
new
Date
(
item
.
pt
)
,
});
});
datas
.
push
(
offlineData
);
datas
.
push
(
offlineData
);
offlineData
=
[];
offlineData
=
[];
hasOffline
=
false
;
hasOffline
=
false
;
}
}
});
});
console
.
log
(
'wwww'
,
datas
);
return
{
return
{
itemStyle
:
{
itemStyle
:
{
color
:
'#eee'
,
color
:
'#eee'
,
...
@@ -331,6 +328,12 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -331,6 +328,12 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
const
yAxisIndex
=
yAxisInterator
.
get
(
sensorName
);
const
yAxisIndex
=
yAxisInterator
.
get
(
sensorName
);
const
markLine
=
showMarkLine
?
alarmMarkLine
(
item
,
index
,
dataSource
,
deviceAlarmSchemes
)
:
{};
const
markLine
=
showMarkLine
?
alarmMarkLine
(
item
,
index
,
dataSource
,
deviceAlarmSchemes
)
:
{};
const
markPoint
=
showPoint
?
minMaxMarkPoint
(
item
,
index
,
dataSource
)
:
{};
const
markPoint
=
showPoint
?
minMaxMarkPoint
(
item
,
index
,
dataSource
)
:
{};
let
markArea
=
null
;
let
offlineAreas
=
offlineArea
(
item
);
if
(
offlineAreas
.
data
?.
length
)
{
restOption
.
markArea
=
null
;
markArea
=
offlineAreas
;
}
return
{
return
{
notMerge
:
true
,
notMerge
:
true
,
name
,
name
,
...
@@ -342,6 +345,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -342,6 +345,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
unit
,
unit
,
markLine
,
markLine
,
markPoint
,
markPoint
,
markArea
,
};
};
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment