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
af874e68
Commit
af874e68
authored
Jan 12, 2023
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(EC_HistoryView): 优化多图表图例显示
parent
7cd47831
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
GridChart.js
packages/extend-components/EC_HistoryView/src/GridChart.js
+1
-0
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+4
-3
No files found.
packages/extend-components/EC_HistoryView/src/GridChart.js
View file @
af874e68
...
@@ -57,6 +57,7 @@ const GridChart = memo((props) => {
...
@@ -57,6 +57,7 @@ const GridChart = memo((props) => {
};
};
const
option
=
optionGenerator
(
list
,
cusOption
,
contrast
,
contrastOption
,
smooth
,
{
const
option
=
optionGenerator
(
list
,
cusOption
,
contrast
,
contrastOption
,
smooth
,
{
curveCenter
,
curveCenter
,
nameWithSensor
:
false
,
});
});
return
{
return
{
key
,
key
,
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
af874e68
...
@@ -12,9 +12,9 @@ const axisWidth = 40;
...
@@ -12,9 +12,9 @@ const axisWidth = 40;
* @param {any} contrastOption 同期对比周期配置, day|month
* @param {any} contrastOption 同期对比周期配置, day|month
* @returns
* @returns
*/
*/
const
nameFormatter
=
(
data
,
contrast
,
contrastOption
)
=>
{
const
nameFormatter
=
(
data
,
contrast
,
contrastOption
,
nameWithSensor
)
=>
{
const
{
equipmentName
,
sensorName
,
unit
,
dataModel
,
dateFrom
,
dateTo
}
=
data
;
const
{
equipmentName
,
sensorName
,
unit
,
dataModel
,
dateFrom
,
dateTo
}
=
data
;
let
name
=
`
${
equipmentName
}
-
${
sensorName
}
`
;
let
name
=
nameWithSensor
?
`
${
equipmentName
}
-
${
sensorName
}
`
:
equipmentName
;
if
(
contrast
)
{
if
(
contrast
)
{
const
time
=
dateFrom
.
slice
(
0
,
contrastOption
===
'day'
?
10
:
7
).
replace
(
/-/g
,
''
);
const
time
=
dateFrom
.
slice
(
0
,
contrastOption
===
'day'
?
10
:
7
).
replace
(
/-/g
,
''
);
name
=
`
${
name
}
-
${
time
}
`
;
name
=
`
${
name
}
-
${
time
}
`
;
...
@@ -80,6 +80,7 @@ const minMax = (data) => {
...
@@ -80,6 +80,7 @@ const minMax = (data) => {
const
optionGenerator
=
(
dataSource
,
cusOption
,
contrast
,
contrastOption
,
smooth
,
config
)
=>
{
const
optionGenerator
=
(
dataSource
,
cusOption
,
contrast
,
contrastOption
,
smooth
,
config
)
=>
{
const
needUnit
=
_
.
get
(
config
,
'needUnit'
,
false
);
const
needUnit
=
_
.
get
(
config
,
'needUnit'
,
false
);
const
curveCenter
=
_
.
get
(
config
,
'curveCenter'
,
false
);
const
curveCenter
=
_
.
get
(
config
,
'curveCenter'
,
false
);
const
nameWithSensor
=
_
.
get
(
config
,
'nameWithSensor'
,
true
);
// 自定义属性
// 自定义属性
const
restOption
=
_
.
pick
(
cusOption
,
[
'title'
,
'legend'
]);
const
restOption
=
_
.
pick
(
cusOption
,
[
'title'
,
'legend'
]);
...
@@ -138,7 +139,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -138,7 +139,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
const
series
=
dataSource
.
map
((
item
)
=>
{
const
series
=
dataSource
.
map
((
item
)
=>
{
const
{
sensorName
,
unit
}
=
item
;
const
{
sensorName
,
unit
}
=
item
;
const
name
=
nameFormatter
(
item
,
contrast
,
contrastOption
);
const
name
=
nameFormatter
(
item
,
contrast
,
contrastOption
,
nameWithSensor
);
const
data
=
dataAccessor
(
item
,
contrast
,
contrastOption
);
const
data
=
dataAccessor
(
item
,
contrast
,
contrastOption
);
const
type
=
'line'
;
const
type
=
'line'
;
const
areaStyle
=
areaStyleFormatter
(
item
);
const
areaStyle
=
areaStyleFormatter
(
item
);
...
...
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