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
00852529
Commit
00852529
authored
Apr 03, 2023
by
张瑶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 更新
parent
da8c57a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
SingleChart.js
packages/extend-components/EC_HistoryView/src/SingleChart.js
+4
-1
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+40
-0
No files found.
packages/extend-components/EC_HistoryView/src/SingleChart.js
View file @
00852529
import
React
,
{
memo
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
BasicChart
}
from
'@wisdom-components/basicchart'
;
import
PandaEmpty
from
'@wisdom-components/empty'
;
import
optionGenerator
,
{
alarmMarkLine
,
minMaxMarkPoint
}
from
'./utils'
;
import
optionGenerator
,
{
alarmMarkLine
,
minMaxMarkPoint
,
offlineArea
}
from
'./utils'
;
import
{
isArray
,
cloneDeep
}
from
'lodash'
;
const
SimgleChart
=
memo
((
props
)
=>
{
...
...
@@ -46,11 +46,14 @@ const SimgleChart = memo((props) => {
deviceAlarmSchemes
,
);
item
.
markPoint
=
minMaxMarkPoint
(
dataSource
[
index
],
index
,
[
dataSource
[
index
]]);
item
.
markArea
=
offlineArea
(
dataSource
[
index
]);
}
else
{
item
.
markLine
=
{};
item
.
markPoint
=
{};
item
.
markArea
=
offlineArea
(
dataSource
[
index
]);
}
});
console
.
log
(
'wwww'
,
option
);
chart
.
setOption
(
option
,
true
);
}
if
(
!
chart
)
return
;
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
00852529
...
...
@@ -192,6 +192,46 @@ export const decorateAxisGridLine = (axis, showGrid) => {
};
};
/**
* 坐标轴添加离线区间
*
* @param {any} dataItem
*/
export
const
offlineArea
=
(
dataItem
)
=>
{
// 只有一个数据曲线时显示markline
if
(
!
dataItem
)
return
{};
console
.
log
(
'wwww'
,
dataItem
);
const
{
dataModel
}
=
dataItem
;
let
datas
=
new
Array
();
let
offlineData
=
[];
let
hasOffline
=
false
;
dataModel
.
forEach
((
item
)
=>
{
if
(
!
item
.
pv
&&
!
hasOffline
)
{
offlineData
=
[
{
name
:
'离线'
,
xAxis
:
item
.
pt
,
},
];
hasOffline
=
true
;
}
else
if
(
item
.
pv
&&
hasOffline
)
{
offlineData
.
push
({
xAxis
:
item
.
pt
,
});
datas
.
push
(
offlineData
);
offlineData
=
[];
hasOffline
=
false
;
}
});
console
.
log
(
'wwww'
,
datas
);
return
{
itemStyle
:
{
color
:
'#eee'
,
},
data
:
datas
,
};
};
/**
* 图表配置项生成
*
...
...
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