Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JINRUN-DP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
xinzhedeai
JINRUN-DP
Commits
7a7555ff
Commit
7a7555ff
authored
Dec 12, 2025
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
降雨量 趋势图 屏幕更改自适应
parent
12c514bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
58 deletions
+58
-58
LeftRainfallTrend.vue
src/components/MineMonitor/LeftRainfallTrend.vue
+58
-58
No files found.
src/components/MineMonitor/LeftRainfallTrend.vue
View file @
7a7555ff
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
onMounted
,
onUnmounted
,
nextTick
}
from
"
vue
"
;
import
{
ref
,
onMounted
,
onUnmounted
,
nextTick
}
from
"
vue
"
;
import
*
as
echarts
from
"
echarts
"
;
import
*
as
echarts
from
"
echarts
"
;
import
{
ChevronUp
}
from
"
@vicons/ionicons5
"
;
import
{
debounce
}
from
"
lodash-es
"
;
// 防抖函数,避免频繁触发resize
const
chartRef
=
ref
<
HTMLDivElement
|
null
>
(
null
);
const
chartRef
=
ref
<
HTMLDivElement
|
null
>
(
null
);
let
chartInstance
:
echarts
.
ECharts
|
null
=
null
;
let
chartInstance
:
echarts
.
ECharts
|
null
=
null
;
...
@@ -35,18 +35,6 @@ const initChart = () => {
...
@@ -35,18 +35,6 @@ const initChart = () => {
tooltip
:
{
tooltip
:
{
trigger
:
'
axis
'
trigger
:
'
axis
'
},
},
// toolbox: {
// show: true,
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// dataView: { readOnly: false },
// magicType: { type: ['line', 'bar'] },
// restore: {},
// saveAsImage: {}
// }
// },
xAxis
:
{
xAxis
:
{
type
:
"
category
"
,
type
:
"
category
"
,
data
:
hours
,
data
:
hours
,
...
@@ -55,27 +43,15 @@ const initChart = () => {
...
@@ -55,27 +43,15 @@ const initChart = () => {
},
},
yAxis
:
{
yAxis
:
{
name
:
'
mm
'
,
name
:
'
mm
'
,
// nameLocation:'end',
// nameGap: 10, // 单位与Y轴轴线的间距
// nameAlign:'left',
// axisLabel: {
// offset: 200 // 向左移动10像素
// },
// nameTextStyle: { padding: [-30, 0, 0, 0] },
nameTextStyle
:
{
nameTextStyle
:
{
color
:
"
white
"
,
//颜色
color
:
"
white
"
,
padding
:
[
0
,
30
,
0
,
0
],
//间距分别是 上 右 下 左
padding
:
[
0
,
38
,
0
,
0
],
},
},
type
:
"
value
"
,
type
:
"
value
"
,
max
:
300
,
max
:
300
,
axisLine
:
{
lineStyle
:
{
color
:
"
#4f6b95
"
}
},
axisLine
:
{
lineStyle
:
{
color
:
"
#4f6b95
"
}
},
axisLabel
:
{
color
:
"
white
"
},
axisLabel
:
{
color
:
"
white
"
},
splitLine
:
{
lineStyle
:
{
color
:
"
rgba(79, 107, 149, 0.2)
"
}
},
splitLine
:
{
lineStyle
:
{
color
:
"
rgba(79, 107, 149, 0.2)
"
}
},
// // 添加警戒线标记
// axisTick: {
// show: false
// }
},
},
series
:
[
series
:
[
...
@@ -83,7 +59,7 @@ const initChart = () => {
...
@@ -83,7 +59,7 @@ const initChart = () => {
data
,
data
,
type
:
"
line
"
,
type
:
"
line
"
,
smooth
:
true
,
smooth
:
true
,
showSymbol
:
false
,
// 显示数据点显示
showSymbol
:
false
,
areaStyle
:
{
areaStyle
:
{
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
offset
:
0
,
color
:
"
rgba(54, 162, 235, 0.4)
"
},
{
offset
:
0
,
color
:
"
rgba(54, 162, 235, 0.4)
"
},
...
@@ -91,15 +67,8 @@ const initChart = () => {
...
@@ -91,15 +67,8 @@ const initChart = () => {
]),
]),
},
},
lineStyle
:
{
color
:
"
rgba(54, 162, 235, 1)
"
,
width
:
2
},
lineStyle
:
{
color
:
"
rgba(54, 162, 235, 1)
"
,
width
:
2
},
// markPoint: {// 气泡
// data: [
// { type: 'max', name: 'Max' },
// { type: 'min', name: 'Min' }
// ]
// },
markLine
:
{
markLine
:
{
symbol
:
'
none
'
,
symbol
:
'
none
'
,
// data: [{ type: 'average', name: 'Avg' }]
data
:
warningLines
.
map
(
line
=>
({
data
:
warningLines
.
map
(
line
=>
({
label
:
{
label
:
{
show
:
false
show
:
false
...
@@ -110,8 +79,6 @@ const initChart = () => {
...
@@ -110,8 +79,6 @@ const initChart = () => {
color
:
line
.
color
,
color
:
line
.
color
,
width
:
1
,
width
:
1
,
type
:
'
dashed
'
,
type
:
'
dashed
'
,
}
}
}))
}))
}
}
...
@@ -120,16 +87,49 @@ const initChart = () => {
...
@@ -120,16 +87,49 @@ const initChart = () => {
});
});
};
};
// 窗口缩放适配
// 使用防抖优化resize性能
const
resizeChart
=
()
=>
chartInstance
?.
resize
();
const
resizeChart
=
debounce
(()
=>
{
if
(
chartInstance
)
{
chartInstance
.
resize
({
animation
:
{
duration
:
300
}
});
}
},
300
);
// 监听容器尺寸变化(更精确的自适应)
const
observeContainerResize
=
()
=>
{
if
(
!
chartRef
.
value
)
return
;
const
resizeObserver
=
new
ResizeObserver
(
entries
=>
{
// 使用防抖函数处理尺寸变化
resizeChart
();
});
resizeObserver
.
observe
(
chartRef
.
value
);
// 返回清理函数
return
()
=>
resizeObserver
.
disconnect
();
};
let
cleanupObserver
:
(()
=>
void
)
|
null
=
null
;
onMounted
(()
=>
{
onMounted
(()
=>
{
nextTick
(
initChart
);
nextTick
(()
=>
{
initChart
();
// 添加窗口大小改变事件监听器
window
.
addEventListener
(
"
resize
"
,
resizeChart
);
window
.
addEventListener
(
"
resize
"
,
resizeChart
);
// 添加容器尺寸观察器
cleanupObserver
=
observeContainerResize
();
});
});
});
onUnmounted
(()
=>
{
onUnmounted
(()
=>
{
window
.
removeEventListener
(
"
resize
"
,
resizeChart
);
window
.
removeEventListener
(
"
resize
"
,
resizeChart
);
if
(
cleanupObserver
)
{
cleanupObserver
();
}
chartInstance
?.
dispose
();
chartInstance
?.
dispose
();
});
});
</
script
>
</
script
>
...
@@ -141,7 +141,11 @@ onUnmounted(() => {
...
@@ -141,7 +141,11 @@ onUnmounted(() => {
height
:
3rem
;
height
:
3rem
;
position
:
relative
;
position
:
relative
;
padding
:
0
.15rem
;
padding
:
0
.15rem
;
// padding-top: 0.45rem;
width
:
100%
;
margin-top
:
0
.3rem
;
background-image
:
url("@/assets/jinrun/module-bg.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
.card-title
{
.card-title
{
position
:
absolute
;
position
:
absolute
;
...
@@ -152,11 +156,7 @@ onUnmounted(() => {
...
@@ -152,11 +156,7 @@ onUnmounted(() => {
color
:
#ffffff
;
color
:
#ffffff
;
text-shadow
:
0rem
0rem
0rem
rgba
(
5
,
38
,
68
,
0
.5
);
text-shadow
:
0rem
0rem
0rem
rgba
(
5
,
38
,
68
,
0
.5
);
}
}
width
:
100%
;
margin-top
:
0
.3rem
;
background-image
:
url("@/assets/jinrun/module-bg.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
.chart-wrapper
{
.chart-wrapper
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
@@ -164,10 +164,10 @@ background-size: cover;
...
@@ -164,10 +164,10 @@ background-size: cover;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
}
}
.chart-container
{
.chart-container
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
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