Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
aa4420b2
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,发现更多精彩内容 >>
提交
aa4420b2
编写于
8月 15, 2017
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak series-map label, support position and formatter.
上级
e865e322
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
59 addition
and
10 deletion
+59
-10
src/chart/map/MapView.js
src/chart/map/MapView.js
+22
-5
src/component/helper/MapDraw.js
src/component/helper/MapDraw.js
+8
-3
test/geoLine.html
test/geoLine.html
+11
-1
test/map.html
test/map.html
+18
-1
未找到文件。
src/chart/map/MapView.js
浏览文件 @
aa4420b2
...
...
@@ -2,6 +2,7 @@ define(function (require) {
// var zrUtil = require('zrender/core/util');
var
graphic
=
require
(
'
../../util/graphic
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
MapDraw
=
require
(
'
../../component/helper/MapDraw
'
);
...
...
@@ -98,14 +99,15 @@ define(function (require) {
r
:
3
},
silent
:
true
,
z2
:
10
// Do not overlap the first series, on which labels are displayed.
z2
:
!
offset
?
10
:
8
});
// First data on the same region
if
(
!
offset
)
{
var
fullData
=
mapModel
.
mainSeries
.
getData
();
var
name
=
originalData
.
getName
(
idx
);
var
labelText
=
name
;
var
fullIndex
=
fullData
.
indexOfName
(
name
);
var
itemModel
=
originalData
.
getItemModel
(
idx
);
...
...
@@ -116,16 +118,31 @@ define(function (require) {
var
onEmphasis
=
function
()
{
var
hoverStyle
=
graphic
.
setTextStyle
({},
hoverLabelModel
,
{
text
:
hoverLabelModel
.
get
(
'
show
'
)
?
labelText
:
null
text
:
hoverLabelModel
.
get
(
'
show
'
)
?
mapModel
.
getFormattedLabel
(
idx
,
'
emphasis
'
)
:
null
},
{
isRectText
:
true
,
forMerge
:
true
});
circle
.
style
.
extendFrom
(
hoverStyle
);
// Make label upper than others if overlaps.
circle
.
__mapOriginalZ2
=
circle
.
z2
;
circle
.
z2
+=
1
;
};
var
onNormal
=
function
()
{
graphic
.
setTextStyle
(
circle
.
style
,
labelModel
,
{
text
:
labelModel
.
get
(
'
show
'
)
?
labelText
:
null
,
textPosition
:
'
bottom
'
text
:
labelModel
.
get
(
'
show
'
)
?
zrUtil
.
retrieve2
(
mapModel
.
getFormattedLabel
(
idx
,
'
normal
'
),
name
)
:
null
,
textPosition
:
labelModel
.
getShallow
(
'
position
'
)
||
'
bottom
'
},
{
isRectText
:
true
});
if
(
circle
.
__mapOriginalZ2
!=
null
)
{
circle
.
z2
=
circle
.
__mapOriginalZ2
;
circle
.
__mapOriginalZ2
=
null
;
}
};
polygonGroups
.
on
(
'
mouseover
'
,
onEmphasis
)
...
...
src/component/helper/MapDraw.js
浏览文件 @
aa4420b2
...
...
@@ -236,8 +236,13 @@ define(function (require) {
||
(
itemLayout
&&
itemLayout
.
showLabel
)
)
{
var
query
=
data
?
dataIdx
:
region
.
name
;
var
formattedStr
=
mapOrGeoModel
.
getFormattedLabel
(
query
,
'
normal
'
);
var
hoverFormattedStr
=
mapOrGeoModel
.
getFormattedLabel
(
query
,
'
emphasis
'
);
var
formattedStr
;
var
hoverFormattedStr
;
// Consider dataIdx not found.
if
(
!
data
||
dataIdx
>=
0
)
{
formattedStr
=
mapOrGeoModel
.
getFormattedLabel
(
query
,
'
normal
'
);
hoverFormattedStr
=
mapOrGeoModel
.
getFormattedLabel
(
query
,
'
emphasis
'
);
}
var
textEl
=
new
graphic
.
Text
({
position
:
region
.
center
.
slice
(),
scale
:
[
1
/
scale
[
0
],
1
/
scale
[
1
]],
...
...
@@ -252,7 +257,7 @@ define(function (require) {
});
graphic
.
setTextStyle
(
textEl
.
hoverStyle
=
{},
hoverLabelModel
,
{
text
:
hoverShowLabel
?
(
hoverFormattedStr
||
region
.
name
)
:
null
text
:
hoverShowLabel
?
hoverFormattedStr
:
null
},
{
forMerge
:
true
});
regionGroup
.
add
(
textEl
);
...
...
test/geoLine.html
浏览文件 @
aa4420b2
...
...
@@ -326,8 +326,18 @@
geo
:
{
map
:
'
china
'
,
label
:
{
normal
:
{
show
:
true
,
formatter
:
'
{a}
'
,
// position: 'inside',
backgroundColor
:
'
#fff
'
,
padding
:
[
3
,
5
],
borderRadius
:
3
,
borderWidth
:
1
,
borderColor
:
'
rgba(0,0,0,0.5)
'
,
color
:
'
#777
'
},
emphasis
:
{
show
:
false
}
},
selectedMode
:
'
single
'
,
...
...
test/map.html
浏览文件 @
aa4420b2
...
...
@@ -82,7 +82,24 @@
},
label
:
{
normal
:
{
show
:
true
show
:
true
,
formatter
:
'
{b}:{value|{c}}
'
,
// position: 'inside',
backgroundColor
:
'
#fff
'
,
padding
:
[
3
,
5
],
borderRadius
:
3
,
borderWidth
:
1
,
borderColor
:
'
rgba(0,0,0,0.5)
'
,
color
:
'
#777
'
,
rich
:
{
value
:
{
color
:
'
#019D2D
'
,
fontSize
:
14
,
// fontWeight: 'bold'
// textBorderWidth: 2,
// textBorderColor: '#000'
}
}
},
emphasis
:
{
show
:
true
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录