Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
Overview
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
姜雷
dcxy-manage-shell
Commits
220f35fa
Commit
220f35fa
authored
May 23, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
修改可以根据图例点击饼状图 See merge request
!116
parents
a68bd9bf
5e926cbb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
6 deletions
+92
-6
CampusRankChart.vue
src/containers/Dashboard/CampusRank/CampusRankChart.vue
+53
-5
SeviceRatioChart.vue
src/containers/Dashboard/SeviceRatio/SeviceRatioChart.vue
+39
-1
No files found.
src/containers/Dashboard/CampusRank/CampusRankChart.vue
View file @
220f35fa
...
@@ -55,7 +55,7 @@ export default {
...
@@ -55,7 +55,7 @@ export default {
useHtml
:
true
,
useHtml
:
true
,
containerTpl
:
`
containerTpl
:
`
<div class="g2-legend">
<div class="g2-legend">
<ul class="g2-legend-list" style="list-style-type:none;margin:0;padding:0;"></ul>
<ul class="g2-legend-list
legend-CampusRank
" style="list-style-type:none;margin:0;padding:0;"></ul>
</div>`
,
</div>`
,
itemTpl
:
(
value
,
color
,
checked
,
index
)
=>
{
itemTpl
:
(
value
,
color
,
checked
,
index
)
=>
{
const
obj
=
this
.
data
[
index
];
const
obj
=
this
.
data
[
index
];
...
@@ -66,6 +66,7 @@ export default {
...
@@ -66,6 +66,7 @@ export default {
class="g2-legend-list-item item-
${
index
}
${
checked
}
"
class="g2-legend-list-item item-
${
index
}
${
checked
}
"
data-value="
${
value
}
"
data-value="
${
value
}
"
data-color=
${
color
}
data-color=
${
color
}
data-index=
${
index
}
style="cursor: pointer;font-size:14px;width:100%;"
style="cursor: pointer;font-size:14px;width:100%;"
>
>
<i
<i
...
@@ -137,6 +138,7 @@ export default {
...
@@ -137,6 +138,7 @@ export default {
this
.
changeSelected
(
this
.
data
[
0
]);
this
.
changeSelected
(
this
.
data
[
0
]);
this
.
updateCampusName
(
this
.
data
[
0
]);
this
.
updateCampusName
(
this
.
data
[
0
]);
this
.
SelectedDataIndex
=
this
.
data
[
0
];
this
.
SelectedDataIndex
=
this
.
data
[
0
];
this
.
bindClickLegendHandle
();
}
else
{
}
else
{
this
.
updateCampusName
();
this
.
updateCampusName
();
this
.
SelectedDataIndex
=
null
;
this
.
SelectedDataIndex
=
null
;
...
@@ -144,6 +146,8 @@ export default {
...
@@ -144,6 +146,8 @@ export default {
},
},
clickHandle
(
ev
)
{
clickHandle
(
ev
)
{
let
data
=
ev
.
data
.
_origin
;
let
data
=
ev
.
data
.
_origin
;
console
.
log
(
data
);
if
(
this
.
SelectedDataIndex
.
areaId
!==
data
.
areaId
)
{
if
(
this
.
SelectedDataIndex
.
areaId
!==
data
.
areaId
)
{
this
.
SelectedDataIndex
=
data
;
this
.
SelectedDataIndex
=
data
;
this
.
changeSelected
(
data
);
this
.
changeSelected
(
data
);
...
@@ -152,11 +156,55 @@ export default {
...
@@ -152,11 +156,55 @@ export default {
}
else
{
}
else
{
this
.
showOtherNameHandle
();
this
.
showOtherNameHandle
();
}
}
}
else
{
let
selected
=
this
.
chartGeom
.
_getSelectedShapes
();
if
(
selected
&&
selected
.
length
)
{
this
.
chartGeom
.
clearActivedShapes
();
this
.
chartGeom
.
clearSelected
();
}
else
{
this
.
chartGeom
.
setSelected
(
data
);
}
}
},
bindClickLegendHandle
()
{
let
ulDom
=
document
.
querySelector
(
'.legend-CampusRank'
);
ulDom
.
removeEventListener
(
'click'
,
this
.
clickLegendHandle
);
ulDom
.
addEventListener
(
'click'
,
this
.
clickLegendHandle
);
},
clickLegendHandle
(
ev
)
{
let
liDom
=
null
;
if
(
ev
.
target
.
tagName
===
'LI'
)
{
liDom
=
ev
.
target
;
}
else
{
liDom
=
ev
.
target
.
parentElement
;
}
const
index
=
Number
(
liDom
.
dataset
.
index
);
if
(
isNaN
(
index
))
{
return
;
}
// this.chart.eachShape(function(data, shape, gemo) {
// console.log(gemo);
// });
this
.
chartGeom
.
clearActivedShapes
();
const
data
=
this
.
data
[
index
];
if
(
this
.
SelectedDataIndex
.
areaId
!==
data
.
areaId
)
{
this
.
SelectedDataIndex
=
data
;
this
.
chartGeom
.
setSelected
(
data
);
this
.
changeSelected
(
data
);
if
(
data
.
areaId
)
{
this
.
changeCampusHandle
(
data
);
}
else
{
this
.
showOtherNameHandle
();
}
}
}
},
},
changeSelected
(
data
)
{
changeSelected
(
data
)
{
this
.
percentDom
=
document
.
querySelector
(
'.CampusRank-percent'
);
this
.
percentDom
=
document
.
querySelector
(
'.CampusRank-percent'
);
this
.
areaNameDom
=
document
.
querySelector
(
'.CampusRank-areaName'
);
//
this.areaNameDom = document.querySelector('.CampusRank-areaName');
if
(
this
.
percentDom
)
{
if
(
this
.
percentDom
)
{
if
(
this
.
total
===
0
)
{
if
(
this
.
total
===
0
)
{
this
.
percentDom
.
innerHTML
=
'0.00'
;
this
.
percentDom
.
innerHTML
=
'0.00'
;
...
@@ -166,9 +214,9 @@ export default {
...
@@ -166,9 +214,9 @@ export default {
);
);
}
}
}
}
if
(
this
.
areaNameDom
)
{
//
if (this.areaNameDom) {
this
.
areaNameDom
.
innerHTML
=
data
.
areaName
;
//
this.areaNameDom.innerHTML = data.areaName;
}
//
}
},
},
},
},
};
};
...
...
src/containers/Dashboard/SeviceRatio/SeviceRatioChart.vue
View file @
220f35fa
...
@@ -50,7 +50,7 @@ export default {
...
@@ -50,7 +50,7 @@ export default {
useHtml
:
true
,
useHtml
:
true
,
containerTpl
:
`
containerTpl
:
`
<div class="g2-legend">
<div class="g2-legend">
<ul class="g2-legend-list" style="list-style-type:none;margin:0;padding:0;"></ul>
<ul class="g2-legend-list
legend-SeviceRatio
" style="list-style-type:none;margin:0;padding:0;"></ul>
</div>`
,
</div>`
,
itemTpl
:
(
value
,
color
,
checked
,
index
)
=>
{
itemTpl
:
(
value
,
color
,
checked
,
index
)
=>
{
const
obj
=
this
.
data
[
index
];
const
obj
=
this
.
data
[
index
];
...
@@ -61,6 +61,7 @@ export default {
...
@@ -61,6 +61,7 @@ export default {
class="g2-legend-list-item item-
${
index
}
${
checked
}
"
class="g2-legend-list-item item-
${
index
}
${
checked
}
"
data-value="
${
value
}
"
data-value="
${
value
}
"
data-color=
${
color
}
data-color=
${
color
}
data-index=
${
index
}
style="cursor: pointer;font-size:14px;width:100%;"
style="cursor: pointer;font-size:14px;width:100%;"
>
>
<i
<i
...
@@ -122,6 +123,7 @@ export default {
...
@@ -122,6 +123,7 @@ export default {
this
.
chartGeom
.
setSelected
(
this
.
data
[
0
]);
this
.
chartGeom
.
setSelected
(
this
.
data
[
0
]);
this
.
changeSelected
(
this
.
data
[
0
]);
this
.
changeSelected
(
this
.
data
[
0
]);
this
.
SelectedDataIndex
=
this
.
data
[
0
];
this
.
SelectedDataIndex
=
this
.
data
[
0
];
this
.
bindClickLegendHandle
();
}
}
},
},
clickHandle
(
ev
)
{
clickHandle
(
ev
)
{
...
@@ -130,6 +132,42 @@ export default {
...
@@ -130,6 +132,42 @@ export default {
this
.
SelectedDataIndex
=
data
;
this
.
SelectedDataIndex
=
data
;
this
.
changeSelected
(
data
);
this
.
changeSelected
(
data
);
this
.
changeServiceHandle
(
data
);
this
.
changeServiceHandle
(
data
);
}
else
{
let
selected
=
this
.
chartGeom
.
_getSelectedShapes
();
if
(
selected
&&
selected
.
length
)
{
this
.
chartGeom
.
clearActivedShapes
();
this
.
chartGeom
.
clearSelected
();
}
else
{
this
.
chartGeom
.
setSelected
(
data
);
}
}
},
bindClickLegendHandle
()
{
let
ulDom
=
document
.
querySelector
(
'.legend-SeviceRatio'
);
ulDom
.
removeEventListener
(
'click'
,
this
.
clickLegendHandle
);
ulDom
.
addEventListener
(
'click'
,
this
.
clickLegendHandle
);
},
clickLegendHandle
(
ev
)
{
let
liDom
=
null
;
if
(
ev
.
target
.
tagName
===
'LI'
)
{
liDom
=
ev
.
target
;
}
else
{
liDom
=
ev
.
target
.
parentElement
;
}
const
index
=
Number
(
liDom
.
dataset
.
index
);
if
(
isNaN
(
index
))
{
return
;
}
this
.
chartGeom
.
clearActivedShapes
();
const
data
=
this
.
data
[
index
];
console
.
log
(
liDom
,
data
);
if
(
this
.
SelectedDataIndex
.
serviceId
!==
data
.
serviceId
)
{
this
.
SelectedDataIndex
=
data
;
this
.
chartGeom
.
setSelected
(
data
);
this
.
changeSelected
(
data
);
}
}
},
},
changeSelected
(
data
)
{
changeSelected
(
data
)
{
...
...
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