Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DC-TOM
Project
Project
Details
Activity
Releases
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
刘照晖
DC-TOM
Commits
624eb03f
Commit
624eb03f
authored
Jun 05, 2025
by
liuzhaoh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化联动
parent
65884fbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
42 deletions
+30
-42
chart.js
src/utils/chart.js
+1
-1
index.vue
src/views/dustMonitoring/index.vue
+29
-41
No files found.
src/utils/chart.js
View file @
624eb03f
...
...
@@ -212,7 +212,7 @@ export const getLineOption2 = (xData = [], seriesData = [], legendDesc = "健康
tooltip
:
{
trigger
:
"axis"
,
axisPointer
:
{
type
:
"none"
//
type: "none"
}
},
grid
:
{
...
...
src/views/dustMonitoring/index.vue
View file @
624eb03f
...
...
@@ -195,15 +195,12 @@ const initChart = (instance, option, domEl) => {
instance
=
echarts
.
init
(
document
.
getElementById
(
domEl
));
instance
.
setOption
(
option
);
chartInstance
[
domEl
]
=
instance
;
// instance.on("showTip", (params) => {
// console.log(params);
// })
chartLinkageFun
();
};
let
instanceList
=
reactive
([])
let
instanceList
=
reactive
([])
;
// 图表联动
const
chartLinkageFun
=
(
target
)
=>
{
instanceList
=
[]
instanceList
=
[]
;
Object
.
keys
(
chartInstance
).
forEach
((
key
)
=>
{
instanceList
.
push
(
chartInstance
[
key
]);
});
...
...
@@ -221,10 +218,31 @@ const chartLinkageFun = (target) => {
item
.
on
(
"showTip"
,
function
(
e
)
{
bindToolTip
(
this
,
e
);
});
// 获取canvas的非绘制图形区域
item
.
getZr
().
on
(
"mousemove"
,
function
(
params
)
{
if
(
item
.
containPixel
(
"grid"
,
[
params
.
event
.
offsetX
,
params
.
event
.
offsetY
])
)
{
// 只在图表区域内处理点击事件
// console.log("Clicked inside the chart area");
}
else
{
// 处理点击空白区域的情况
// console.log("Clicked outside the chart area");
instanceList
.
forEach
((
item_
,
index
)
=>
{
item_
.
dispatchAction
({
type
:
"hideTip"
,
});
item_
.
dispatchAction
({
type
:
'updateAxisPointer'
,
currTrigger
:
"leave"
})
});
}
});
});
};
const
bindToolTip
=
(
that
,
e
)
=>
{
const
connectCharts
=
instanceList
const
connectCharts
=
instanceList
;
if
(
window
.
echartTimer
)
{
clearTimeout
(
window
.
echartTimer
);
}
...
...
@@ -243,41 +261,11 @@ const bindToolTip = (that, e) => {
let
xAxisList
=
option
.
xAxis
[
0
].
data
;
let
tmpIndex
=
e
.
dataIndex
;
item_
.
off
(
"showTip"
);
if
(
option
.
yAxis
&&
option
.
yAxis
[
0
]
&&
option
.
yAxis
[
0
][
"data"
]
&&
option
.
yAxis
[
0
][
"data"
].
length
==
2
&&
option
.
yAxis
[
0
][
"data"
][
0
]
===
0
&&
option
.
yAxis
[
0
][
"data"
][
1
]
===
1
)
{
item_
.
dispatchAction
({
type
:
"showTip"
,
seriesIndex
:
0
,
dataIndex
:
tmpIndex
,
});
item_
.
dispatchAction
({
type
:
"showTip"
,
seriesIndex
:
1
,
dataIndex
:
tmpIndex
,
});
}
else
{
item_
.
dispatchAction
({
type
:
"showTip"
,
seriesIndex
:
0
,
dataIndex
:
tmpIndex
,
});
item_
.
dispatchAction
({
type
:
"showTip"
,
seriesIndex
:
1
,
dataIndex
:
tmpIndex
,
});
item_
.
dispatchAction
({
type
:
"showTip"
,
seriesIndex
:
2
,
dataIndex
:
tmpIndex
,
});
}
item_
.
dispatchAction
({
type
:
"showTip"
,
seriesIndex
:
0
,
dataIndex
:
tmpIndex
,
});
item_
.
on
(
"showTip"
,
function
(
e
)
{
bindToolTip
(
this
,
e
);
...
...
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