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
ae5c513b
Commit
ae5c513b
authored
Feb 14, 2025
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化样式
parent
30a9d1bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
20 deletions
+37
-20
GridChart.js
packages/extend-components/EC_HistoryView/src/GridChart.js
+28
-16
GridDemo.js
...es/extend-components/EC_HistoryView/src/demos/GridDemo.js
+9
-4
No files found.
packages/extend-components/EC_HistoryView/src/GridChart.js
View file @
ae5c513b
...
@@ -82,29 +82,29 @@ const ChartWidthRef = (props) => {
...
@@ -82,29 +82,29 @@ const ChartWidthRef = (props) => {
// 6. 确定使用的图形
// 6. 确定使用的图形
// 默认图形,居中
// 默认图形,居中
let
maxIconPath
=
`path://M1233.329493 195.75466633h-1112.064c-34.128213 0-61.781333 27.661653-61.781333 61.781334v473.658026c0 34.117973 27.65312 61.781333 61.781333 61.781334h472.80128l83.23072 144.155306 83.23072-144.155306h472.80128c34.128213 0 61.781333-27.66336 61.781334-61.781334V257.53600033c0-34.117973-27.65312-61.781333-61.781334-61.781334z`
;
let
maxIconPath
=
`path://M1233.329493 195.75466633h-1112.064c-34.128213 0-61.781333 27.661653-61.781333 61.781334v473.658026c0 34.117973 27.65312 61.781333 61.781333 61.781334h472.80128l83.23072 144.155306 83.23072-144.155306h472.80128c34.128213 0 61.781333-27.66336 61.781334-61.781334V257.53600033c0-34.117973-27.65312-61.781333-61.781334-61.781334z`
;
let
maxSymbolOffset
=
[
0
,
-
20
];
let
maxSymbolOffset
=
[
0
,
-
14
];
if
(
maxOutEdge
)
{
if
(
maxOutEdge
)
{
if
(
maxOutSide
===
'left'
)
{
if
(
maxOutSide
===
'left'
)
{
// 左边界超出,使用朝右的图表
// 左边界超出,使用朝右的图表
maxSymbolOffset
=
[
'50%'
,
-
20
];
maxSymbolOffset
=
[
'50%'
,
-
14
];
maxIconPath
=
'path://M48.677,6.151v10c0,1.7-1.3,3-3,3h-35.5l-6.7,4c0,0,0.2-5.3,0.2-7v-10c0-1.7,1.3-3,3-3h39C47.277,3.151,48.677,4.551,48.677,6.151z'
;
maxIconPath
=
'path://M48.677,6.151v10c0,1.7-1.3,3-3,3h-35.5l-6.7,4c0,0,0.2-5.3,0.2-7v-10c0-1.7,1.3-3,3-3h39C47.277,3.151,48.677,4.551,48.677,6.151z'
;
}
else
if
(
maxOutSide
===
'right'
)
{
}
else
if
(
maxOutSide
===
'right'
)
{
// 右边界超出,使用朝左的图表
// 右边界超出,使用朝左的图表
maxSymbolOffset
=
[
'-50%'
,
-
20
];
maxSymbolOffset
=
[
'-50%'
,
-
14
];
maxIconPath
=
'path://M6.477,3.151h39c1.7,0,3,1.3,3,3v10c0,1.7,0.2,7,0.2,7l-6.7-4h-35.5c-1.7,0-3-1.3-3-3v-10C3.477,4.551,4.877,3.151,6.477,3.151z'
maxIconPath
=
'path://M6.477,3.151h39c1.7,0,3,1.3,3,3v10c0,1.7,0.2,7,0.2,7l-6.7-4h-35.5c-1.7,0-3-1.3-3-3v-10C3.477,4.551,4.877,3.151,6.477,3.151z'
}
}
}
}
// 默认图形
// 默认图形
let
minIconPath
=
'path://M131.999 849.579h1112.064c34.128 0 61.781-27.662 61.781-61.781v-473.658c0-34.118-27.653-61.781-61.781-61.781h-472.801l-83.231-144.155-83.231 144.155h-472.801c-34.128 0-61.781 27.663-61.781 61.781v473.658c0 34.118 27.653 61.781 61.781 61.781z'
;
let
minIconPath
=
'path://M131.999 849.579h1112.064c34.128 0 61.781-27.662 61.781-61.781v-473.658c0-34.118-27.653-61.781-61.781-61.781h-472.801l-83.231-144.155-83.231 144.155h-472.801c-34.128 0-61.781 27.663-61.781 61.781v473.658c0 34.118 27.653 61.781 61.781 61.781z'
;
let
minSymbolOffset
=
[
0
,
20
];
let
minSymbolOffset
=
[
0
,
14
];
if
(
minOutEdge
)
{
if
(
minOutEdge
)
{
if
(
minOutSide
===
'left'
)
{
if
(
minOutSide
===
'left'
)
{
// 左边界超出,使用朝右的图表
// 左边界超出,使用朝右的图表
minSymbolOffset
=
[
'50%'
,
20
];
minSymbolOffset
=
[
'50%'
,
14
];
minIconPath
=
'path://M45.677,23.151h-39c-1.7,0-3-1.3-3-3v-10c0-1.7-0.2-7-0.2-7l6.7,4h35.5c1.7,0,3,1.3,3,3v10C48.677,21.751,47.277,23.151,45.677,23.151z'
;
minIconPath
=
'path://M45.677,23.151h-39c-1.7,0-3-1.3-3-3v-10c0-1.7-0.2-7-0.2-7l6.7,4h35.5c1.7,0,3,1.3,3,3v10C48.677,21.751,47.277,23.151,45.677,23.151z'
;
}
else
if
(
minOutSide
===
'right'
)
{
}
else
if
(
minOutSide
===
'right'
)
{
// 右边界超出,使用朝左的图表
// 右边界超出,使用朝左的图表
minSymbolOffset
=
[
'-50%'
,
20
];
minSymbolOffset
=
[
'-50%'
,
14
];
minIconPath
=
'path://M3.477,20.151v-10c0-1.7,1.3-3,3-3h35.5l6.7-4c0,0-0.2,5.3-0.2,7v10c0,1.7-1.3,3-3,3h-39C4.877,23.151,3.477,21.751,3.477,20.151z'
minIconPath
=
'path://M3.477,20.151v-10c0-1.7,1.3-3,3-3h35.5l6.7-4c0,0-0.2,5.3-0.2,7v10c0,1.7-1.3,3-3,3h-39C4.877,23.151,3.477,21.751,3.477,20.151z'
}
}
}
}
...
@@ -118,15 +118,15 @@ const ChartWidthRef = (props) => {
...
@@ -118,15 +118,15 @@ const ChartWidthRef = (props) => {
symbol
:
minIconPath
,
symbol
:
minIconPath
,
symbolSize
:
(
e
)
=>
{
symbolSize
:
(
e
)
=>
{
let
str
=
!
[
undefined
,
null
].
includes
(
e
)
?
String
(
e
)
:
''
;
let
str
=
!
[
undefined
,
null
].
includes
(
e
)
?
String
(
e
)
:
''
;
let
length
=
6
0
+
str
.
length
*
6
let
length
=
4
0
+
str
.
length
*
6
return
[
length
,
32
]
return
[
length
,
20
]
},
},
label
:
{
label
:
{
show
:
true
,
show
:
true
,
color
:
'#fff'
,
color
:
'#fff'
,
formatter
:
'最小: {c}'
,
formatter
:
'最小: {c}'
,
fontSize
:
1
4
,
fontSize
:
1
2
,
fontWeight
:
'
bold
'
,
fontWeight
:
'
normal
'
,
verticalAlign
:
'top'
,
verticalAlign
:
'top'
,
offset
:
[
0
,
-
2
]
offset
:
[
0
,
-
2
]
},
},
...
@@ -142,19 +142,19 @@ const ChartWidthRef = (props) => {
...
@@ -142,19 +142,19 @@ const ChartWidthRef = (props) => {
symbolOffset
:
maxSymbolOffset
,
symbolOffset
:
maxSymbolOffset
,
symbolSize
:
(
e
)
=>
{
symbolSize
:
(
e
)
=>
{
let
str
=
!
[
undefined
,
null
].
includes
(
e
)
?
String
(
e
)
:
''
;
let
str
=
!
[
undefined
,
null
].
includes
(
e
)
?
String
(
e
)
:
''
;
let
length
=
6
0
+
str
.
length
*
6
let
length
=
4
0
+
str
.
length
*
6
return
[
length
,
32
]
return
[
length
,
20
]
},
},
itemStyle
:
{
itemStyle
:
{
// color: "#1980ff",
// color: "#1980ff",
},
},
label
:
{
label
:
{
color
:
'#fff'
,
color
:
'#fff'
,
fontSize
:
1
4
,
fontSize
:
1
2
,
fontWeight
:
'
bold
'
,
fontWeight
:
'
normal
'
,
show
:
true
,
show
:
true
,
formatter
:
'最大: {c}'
,
formatter
:
'最大: {c}'
,
offset
:
[
0
,
-
2
]
offset
:
[
0
,
-
1
]
}
}
},
},
{
{
...
@@ -193,8 +193,19 @@ const ChartWidthRef = (props) => {
...
@@ -193,8 +193,19 @@ const ChartWidthRef = (props) => {
})
})
},
200
)
},
200
)
};
};
// 将opt修改一下
const
cur_opt
=
useMemo
(()
=>
{
return
{
...
props
.
option
,
grid
:
{
...
props
.
option
,
top
:
45
,
bottom
:
65
,
}
}
},
[
props
.
option
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'props.opt: '
,
props
.
option
);
if
(
props
.
data
.
list
?.
length
!==
1
)
return
;
if
(
props
.
data
.
list
?.
length
!==
1
)
return
;
const
chart
=
ref
.
current
?.
getEchartsInstance
?.();
const
chart
=
ref
.
current
?.
getEchartsInstance
?.();
chart
.
setOption
({
chart
.
setOption
({
...
@@ -231,7 +242,7 @@ const ChartWidthRef = (props) => {
...
@@ -231,7 +242,7 @@ const ChartWidthRef = (props) => {
chart
.
off
(
'legendselectchanged'
,
renderMarkPoint
);
chart
.
off
(
'legendselectchanged'
,
renderMarkPoint
);
chart
.
off
(
'datazoom'
,
dataZoomFn
);
chart
.
off
(
'datazoom'
,
dataZoomFn
);
}
}
},
[
props
.
option
]);
},
[
cur_opt
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
props
.
data
.
list
?.
length
!==
1
)
return
;
if
(
props
.
data
.
list
?.
length
!==
1
)
return
;
renderMarkPoint
(
false
)
renderMarkPoint
(
false
)
...
@@ -239,6 +250,7 @@ const ChartWidthRef = (props) => {
...
@@ -239,6 +250,7 @@ const ChartWidthRef = (props) => {
return
<
BasicChart
return
<
BasicChart
ref
=
{
ref
}
ref
=
{
ref
}
{...
props
}
{...
props
}
option
=
{
cur_opt
}
/
>
/
>
}
}
const
GridChart
=
memo
((
props
)
=>
{
const
GridChart
=
memo
((
props
)
=>
{
...
...
packages/extend-components/EC_HistoryView/src/demos/GridDemo.js
View file @
ae5c513b
...
@@ -94,13 +94,13 @@ import HistoryView from '../index';
...
@@ -94,13 +94,13 @@ import HistoryView from '../index';
}*!/
}*!/
];*/
];*/
const
deviceParams
=
[
const
deviceParams
=
[
{
/*
{
"deviceCode": "DYSC00000001",
"deviceCode": "DYSC00000001",
//
"sensors": "出水压力,出水瞬时流量,今日供水量,出厂水浊度",
"sensors": "出水压力,出水瞬时流量,今日供水量,出厂水浊度",
"sensors"
:
"出水压力,出水瞬时流量"
,
//
"sensors": "出水压力,出水瞬时流量",
"deviceType": "大邑生产数据"
"deviceType": "大邑生产数据"
},
},
/*
{
{
"deviceCode": "DYSC00000006",
"deviceCode": "DYSC00000006",
"sensors": "出水压力,出水瞬时流量,今日供水量,出厂水浊度",
"sensors": "出水压力,出水瞬时流量,今日供水量,出厂水浊度",
"deviceType": "大邑生产数据"
"deviceType": "大邑生产数据"
...
@@ -110,6 +110,11 @@ const deviceParams = [
...
@@ -110,6 +110,11 @@ const deviceParams = [
"sensors": "出水压力,出水瞬时流量,今日供水量,出厂水浊度",
"sensors": "出水压力,出水瞬时流量,今日供水量,出厂水浊度",
"deviceType": "大邑生产数据"
"deviceType": "大邑生产数据"
}*/
}*/
{
"deviceCode"
:
"NT00000001"
,
"sensors"
:
"环境温度,出口瞬时流量,管路温度,预测循环水量"
,
"deviceType"
:
"暖通"
}
]
]
const
Demo
=
()
=>
{
const
Demo
=
()
=>
{
return
<
div
>
return
<
div
>
...
...
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