Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
e2936025
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2936025
编写于
1月 04, 2019
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweak
上级
2b5a3ee4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
129 addition
and
42 deletion
+129
-42
src/chart/funnel/FunnelView.js
src/chart/funnel/FunnelView.js
+11
-14
src/chart/pie/PieView.js
src/chart/pie/PieView.js
+8
-14
src/chart/radar/RadarView.js
src/chart/radar/RadarView.js
+3
-14
test/hoverStyle.html
test/hoverStyle.html
+107
-0
未找到文件。
src/chart/funnel/FunnelView.js
浏览文件 @
e2936025
...
...
@@ -37,21 +37,18 @@ function FunnelPiece(data, idx) {
this
.
add
(
labelLine
);
this
.
add
(
text
);
this
.
updateData
(
data
,
idx
,
true
);
this
.
highDownOnUpdate
=
function
(
fromState
,
toState
)
{
if
(
toState
===
'
emphasis
'
)
{
labelLine
.
ignore
=
labelLine
.
hoverIgnore
;
text
.
ignore
=
text
.
hoverIgnore
;
}
else
{
labelLine
.
ignore
=
labelLine
.
normalIgnore
;
text
.
ignore
=
text
.
normalIgnore
;
}
};
// Hover to change label and labelLine
function
onEmphasis
()
{
labelLine
.
ignore
=
labelLine
.
hoverIgnore
;
text
.
ignore
=
text
.
hoverIgnore
;
}
function
onNormal
()
{
labelLine
.
ignore
=
labelLine
.
normalIgnore
;
text
.
ignore
=
text
.
normalIgnore
;
}
this
.
on
(
'
emphasis
'
,
onEmphasis
)
.
on
(
'
normal
'
,
onNormal
)
.
on
(
'
mouseover
'
,
onEmphasis
)
.
on
(
'
mouseout
'
,
onNormal
);
this
.
updateData
(
data
,
idx
,
true
);
}
var
funnelPieceProto
=
FunnelPiece
.
prototype
;
...
...
src/chart/pie/PieView.js
浏览文件 @
e2936025
...
...
@@ -96,20 +96,6 @@ function PiePiece(data, idx) {
this
.
add
(
text
);
this
.
updateData
(
data
,
idx
,
true
);
// Hover to change label and labelLine
function
onEmphasis
()
{
polyline
.
ignore
=
polyline
.
hoverIgnore
;
text
.
ignore
=
text
.
hoverIgnore
;
}
function
onNormal
()
{
polyline
.
ignore
=
polyline
.
normalIgnore
;
text
.
ignore
=
text
.
normalIgnore
;
}
this
.
on
(
'
emphasis
'
,
onEmphasis
)
.
on
(
'
normal
'
,
onNormal
)
.
on
(
'
mouseover
'
,
onEmphasis
)
.
on
(
'
mouseout
'
,
onNormal
);
}
var
piePieceProto
=
PiePiece
.
prototype
;
...
...
@@ -117,6 +103,8 @@ var piePieceProto = PiePiece.prototype;
piePieceProto
.
updateData
=
function
(
data
,
idx
,
firstCreate
)
{
var
sector
=
this
.
childAt
(
0
);
var
labelLine
=
this
.
childAt
(
1
);
var
labelText
=
this
.
childAt
(
2
);
var
seriesModel
=
data
.
hostModel
;
var
itemModel
=
data
.
getItemModel
(
idx
);
...
...
@@ -184,6 +172,9 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
this
.
highDownOnUpdate
=
(
itemModel
.
get
(
'
hoverAnimation
'
)
&&
seriesModel
.
isAnimationEnabled
())
?
function
(
fromState
,
toState
)
{
if
(
toState
===
'
emphasis
'
)
{
labelLine
.
ignore
=
labelLine
.
hoverIgnore
;
labelText
.
ignore
=
labelText
.
hoverIgnore
;
// Sector may has animation of updating data. Force to move to the last frame
// Or it may stopped on the wrong shape
sector
.
stopAnimation
(
true
);
...
...
@@ -194,6 +185,9 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
},
300
,
'
elasticOut
'
);
}
else
{
labelLine
.
ignore
=
labelLine
.
normalIgnore
;
labelText
.
ignore
=
labelText
.
normalIgnore
;
sector
.
stopAnimation
(
true
);
sector
.
animateTo
({
shape
:
{
...
...
src/chart/radar/RadarView.js
浏览文件 @
e2936025
...
...
@@ -207,20 +207,9 @@ export default echarts.extendChartView({
);
});
function
onEmphasis
()
{
polygon
.
attr
(
'
ignore
'
,
hoverPolygonIgnore
);
}
function
onNormal
()
{
polygon
.
attr
(
'
ignore
'
,
polygonIgnore
);
}
itemGroup
.
off
(
'
mouseover
'
).
off
(
'
mouseout
'
).
off
(
'
normal
'
).
off
(
'
emphasis
'
);
itemGroup
.
on
(
'
emphasis
'
,
onEmphasis
)
.
on
(
'
mouseover
'
,
onEmphasis
)
.
on
(
'
normal
'
,
onNormal
)
.
on
(
'
mouseout
'
,
onNormal
);
itemGroup
.
highDownOnUpdate
=
function
(
fromState
,
toState
)
{
polygon
.
attr
(
'
ignore
'
,
toState
===
'
emphasis
'
?
hoverPolygonIgnore
:
polygonIgnore
);
};
graphic
.
setHoverStyle
(
itemGroup
);
});
...
...
test/hoverStyle.html
浏览文件 @
e2936025
...
...
@@ -65,6 +65,8 @@ under the License.
<div
id=
"main4"
></div>
<div
id=
"main5"
></div>
<div
id=
"main6"
></div>
<div
id=
"main7"
></div>
<div
id=
"main8"
></div>
...
...
@@ -760,5 +762,110 @@ under the License.
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
var
option
=
{
hoverLayerThreshold
:
hoverLayerThreshold
,
tooltip
:
{},
series
:
[{
type
:
'
funnel
'
,
label
:
{
show
:
false
},
emphasis
:
{
label
:
{
show
:
true
}
},
data
:
[
{
value
:
12
,
name
:
'
poiu
'
},
{
value
:
15
,
name
:
'
zxcv
'
},
{
value
:
17
,
name
:
'
casdf
'
}
]
}]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main7
'
,
{
title
:
[
'
Click button highlight dataIndex 0 show label
'
,
'
Then hover and unhover the sector, highlight state will not changed
'
],
option
:
option
,
height
:
200
,
buttons
:
[{
text
:
'
highlight dataIndex 0
'
,
onclick
:
function
()
{
chart
.
dispatchAction
({
type
:
'
highlight
'
,
seriesIndex
:
0
,
dataIndex
:
0
});
}
},
{
text
:
'
downplay dataIndex 0
'
,
onclick
:
function
()
{
chart
.
dispatchAction
({
type
:
'
downplay
'
,
seriesIndex
:
0
,
dataIndex
:
0
});
}
}]
});
});
</script>
<script>
$
.
get
(
'
../map/json/china.json
'
,
function
(
chinaJson
)
{
if
(
typeof
chinaJson
===
'
string
'
)
{
chinaJson
=
eval
(
'
(
'
+
chinaJson
+
'
)
'
);
}
require
([
'
echarts
'
],
function
(
echarts
)
{
echarts
.
registerMap
(
'
china
'
,
chinaJson
);
var
option
=
{
hoverLayerThreshold
:
hoverLayerThreshold
,
tooltip
:
{},
legend
:
{},
geo
:
[{
type
:
'
map
'
,
map
:
'
china
'
,
roam
:
true
,
scaleLimit
:
{
min
:
1.5
,
max
:
10
},
selectedMode
:
'
multiple
'
}]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main8
'
,
{
title
:
[
'
Click button toggleSelected 内蒙古
'
,
'
Then hover and unhover the region, highlight state will not changed
'
],
option
:
option
,
height
:
400
,
buttons
:
[{
text
:
'
toggleSelected 内蒙古
'
,
onclick
:
function
()
{
chart
.
dispatchAction
({
type
:
'
geoToggleSelect
'
,
geoIndex
:
0
,
name
:
'
内蒙古
'
});
}
}]
});
});
});
</script>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录