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
813ac070
Commit
813ac070
authored
Feb 26, 2023
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(EC_HistoryView): 添加最值标记
parent
7a7438d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
10 deletions
+27
-10
SingleChart.js
packages/extend-components/EC_HistoryView/src/SingleChart.js
+13
-5
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+14
-5
No files found.
packages/extend-components/EC_HistoryView/src/SingleChart.js
View file @
813ac070
import
React
,
{
memo
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
BasicChart
}
from
'@wisdom-components/basicchart'
;
import
PandaEmpty
from
'@wisdom-components/empty'
;
import
optionGenerator
,
{
alarmMarkLine
}
from
'./utils'
;
import
optionGenerator
,
{
alarmMarkLine
,
minMaxMarkPoint
}
from
'./utils'
;
import
{
isArray
,
cloneDeep
}
from
'lodash'
;
const
SimgleChart
=
memo
((
props
)
=>
{
...
...
@@ -36,10 +36,18 @@ const SimgleChart = memo((props) => {
const
option
=
cloneDeep
(
chart
.
getOption
());
const
needMarkLine
=
count
===
1
;
option
.
series
.
forEach
((
item
,
index
)
=>
{
item
.
markLine
=
needMarkLine
&&
selected
[
item
.
name
]
?
alarmMarkLine
(
dataSource
[
index
],
index
,
[
dataSource
[
index
]],
deviceAlarmSchemes
)
:
{};
if
(
needMarkLine
&&
selected
[
item
.
name
])
{
item
.
markLine
=
alarmMarkLine
(
dataSource
[
index
],
index
,
[
dataSource
[
index
]],
deviceAlarmSchemes
,
);
item
.
markPoint
=
minMaxMarkPoint
(
dataSource
[
index
],
index
,
[
dataSource
[
index
]]);
}
else
{
item
.
markLine
=
{};
item
.
markPoint
=
{};
}
});
chart
.
setOption
(
option
,
true
);
}
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
813ac070
...
...
@@ -103,11 +103,6 @@ export const alarmMarkLine = (dataItem, index, dataSource, schemes) => {
llLimit
!==
null
&&
llLimit
!==
void
0
&&
data
.
push
(
markLineItem
(
'低低限'
,
llLimit
,
'#FF0000'
));
hhLimit
!==
null
&&
hhLimit
!==
void
0
&&
data
.
push
(
markLineItem
(
'高高限'
,
hhLimit
,
'#FF0000'
));
});
// 添加均值线
const
sum
=
(
dataItem
.
dataModel
||
[]).
reduce
(
(
pre
,
item
)
=>
(
isNaN
(
Number
(
item
.
pv
))
?
pre
:
item
.
pv
),
0
,
);
data
.
push
({
name
:
'平均线'
,
type
:
'average'
,
...
...
@@ -129,6 +124,18 @@ export const alarmMarkLine = (dataItem, index, dataSource, schemes) => {
};
};
export
const
minMaxMarkPoint
=
(
dataItem
,
index
,
dataSource
)
=>
{
// 只有一个数据曲线时显示markline
if
(
!
dataItem
||
dataSource
.
length
!==
1
)
return
{};
const
data
=
[];
data
.
push
({
type
:
'min'
,
name
:
'最小值'
,
label
:
{
color
:
'#FFFFFF'
}
});
data
.
push
({
type
:
'max'
,
name
:
'最大值'
,
label
:
{
color
:
'#FFFFFF'
}
});
return
{
symbol
:
'pin'
,
data
,
};
};
/**
* 坐标轴添加网格线配置
*
...
...
@@ -258,6 +265,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
const
areaStyle
=
areaStyleFormatter
(
item
);
const
yAxisIndex
=
yAxisInterator
.
get
(
sensorName
);
const
markLine
=
alarmMarkLine
(
item
,
index
,
dataSource
,
deviceAlarmSchemes
);
const
markPoint
=
minMaxMarkPoint
(
item
,
index
,
dataSource
);
return
{
notMerge
:
true
,
name
,
...
...
@@ -268,6 +276,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
smooth
,
unit
,
markLine
,
markPoint
,
};
});
...
...
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