Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
066d7c41
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,发现更多精彩内容 >>
提交
066d7c41
编写于
1月 13, 2019
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix that emphasis listener added repeatly.
上级
7d2908fb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
79 addition
and
32 deletion
+79
-32
src/chart/map/MapView.js
src/chart/map/MapView.js
+70
-30
test/map.html
test/map.html
+9
-2
未找到文件。
src/chart/map/MapView.js
浏览文件 @
066d7c41
...
...
@@ -22,6 +22,9 @@ import * as zrUtil from 'zrender/src/core/util';
import
*
as
graphic
from
'
../../util/graphic
'
;
import
MapDraw
from
'
../../component/helper/MapDraw
'
;
var
HIGH_DOWN_PROP
=
'
__seriesMapHighDown
'
;
var
RECORD_VERSION_PROP
=
'
__seriesMapCallKey
'
;
export
default
echarts
.
extendChartView
({
type
:
'
map
'
,
...
...
@@ -139,7 +142,7 @@ export default echarts.extendChartView({
var
labelModel
=
itemModel
.
getModel
(
'
label
'
);
var
hoverLabelModel
=
itemModel
.
getModel
(
'
emphasis.label
'
);
var
polygonGroups
=
fullData
.
getItemGraphicEl
(
fullIndex
);
var
regionGroup
=
fullData
.
getItemGraphicEl
(
fullIndex
);
// `getFormattedLabel` needs to use `getData` inside. Here
// `mapModel.getData()` is shallow cloned from `mainSeries.getData()`.
...
...
@@ -157,37 +160,74 @@ export default echarts.extendChartView({
normalText
);
var
onEmphasis
=
function
()
{
var
hoverStyle
=
graphic
.
setTextStyle
({},
hoverLabelModel
,
{
text
:
hoverLabelModel
.
get
(
'
show
'
)
?
emphasisText
:
null
},
{
isRectText
:
true
,
useInsideStyle
:
false
},
true
);
circle
.
style
.
extendFrom
(
hoverStyle
);
// Make label upper than others if overlaps.
circle
.
__mapOriginalZ2
=
circle
.
z2
;
circle
.
z2
+=
graphic
.
Z2_EMPHASIS_LIFT
;
};
var
onNormal
=
function
()
{
graphic
.
setTextStyle
(
circle
.
style
,
labelModel
,
{
text
:
labelModel
.
get
(
'
show
'
)
?
normalText
:
null
,
textPosition
:
labelModel
.
getShallow
(
'
position
'
)
||
'
bottom
'
},
{
isRectText
:
true
,
useInsideStyle
:
false
});
if
(
circle
.
__mapOriginalZ2
!=
null
)
{
circle
.
z2
=
circle
.
__mapOriginalZ2
;
circle
.
__mapOriginalZ2
=
null
;
}
};
polygonGroups
.
on
(
'
mouseover
'
,
onEmphasis
)
.
on
(
'
mouseout
'
,
onNormal
)
.
on
(
'
emphasis
'
,
onEmphasis
)
.
on
(
'
normal
'
,
onNormal
);
onNormal
(
);
var
highDownRecord
=
regionGroup
[
HIGH_DOWN_PROP
];
var
recordVersion
=
Math
.
random
();
// Prevent from register listeners duplicatedly when roaming.
if
(
!
highDownRecord
)
{
highDownRecord
=
regionGroup
[
HIGH_DOWN_PROP
]
=
{};
var
onEmphasis
=
zrUtil
.
curry
(
onRegionHighDown
,
true
)
;
var
onNormal
=
zrUtil
.
curry
(
onRegionHighDown
,
false
)
;
regionGroup
.
on
(
'
mouseover
'
,
onEmphasis
)
.
on
(
'
mouseout
'
,
onNormal
)
.
on
(
'
emphasis
'
,
onEmphasis
)
.
on
(
'
normal
'
,
onNormal
);
}
// Prevent removed regions effect current grapics.
regionGroup
[
RECORD_VERSION_PROP
]
=
recordVersion
;
zrUtil
.
extend
(
highDownRecord
,
{
recordVersion
:
recordVersion
,
circle
:
circle
,
labelModel
:
labelModel
,
hoverLabelModel
:
hoverLabelModel
,
emphasisText
:
emphasisText
,
normalText
:
normalText
});
// FIXME
// Consider set option when emphasis.
enterRegionHighDown
(
highDownRecord
,
false
);
}
group
.
add
(
circle
);
});
}
});
\ No newline at end of file
});
function
onRegionHighDown
(
toHighOrDown
)
{
var
highDownRecord
=
this
[
HIGH_DOWN_PROP
];
if
(
highDownRecord
&&
highDownRecord
.
recordVersion
===
this
[
RECORD_VERSION_PROP
])
{
enterRegionHighDown
(
highDownRecord
,
toHighOrDown
);
}
}
function
enterRegionHighDown
(
highDownRecord
,
toHighOrDown
)
{
var
circle
=
highDownRecord
.
circle
;
var
labelModel
=
highDownRecord
.
labelModel
;
var
hoverLabelModel
=
highDownRecord
.
hoverLabelModel
;
var
emphasisText
=
highDownRecord
.
emphasisText
;
var
normalText
=
highDownRecord
.
normalText
;
if
(
toHighOrDown
)
{
circle
.
style
.
extendFrom
(
graphic
.
setTextStyle
({},
hoverLabelModel
,
{
text
:
hoverLabelModel
.
get
(
'
show
'
)
?
emphasisText
:
null
},
{
isRectText
:
true
,
useInsideStyle
:
false
},
true
)
);
// Make label upper than others if overlaps.
circle
.
__mapOriginalZ2
=
circle
.
z2
;
circle
.
z2
+=
graphic
.
Z2_EMPHASIS_LIFT
;
}
else
{
graphic
.
setTextStyle
(
circle
.
style
,
labelModel
,
{
text
:
labelModel
.
get
(
'
show
'
)
?
normalText
:
null
,
textPosition
:
labelModel
.
getShallow
(
'
position
'
)
||
'
bottom
'
},
{
isRectText
:
true
,
useInsideStyle
:
false
});
if
(
circle
.
__mapOriginalZ2
!=
null
)
{
circle
.
z2
=
circle
.
__mapOriginalZ2
;
circle
.
__mapOriginalZ2
=
null
;
}
}
}
test/map.html
浏览文件 @
066d7c41
...
...
@@ -310,7 +310,10 @@ under the License.
}
},
emphasis
:
{
label
:
{
show
:
true
}
label
:
{
show
:
true
,
backgroundColor
:
'
#fcf
'
},
},
data
:[
{
name
:
'
北京
'
,
value
:
234
},
...
...
@@ -341,7 +344,10 @@ under the License.
}
},
emphasis
:
{
label
:
{
show
:
true
}
label
:
{
show
:
true
,
backgroundColor
:
'
#ccc
'
}
},
data
:[
{
name
:
'
北京
'
,
value
:
567
},
...
...
@@ -357,6 +363,7 @@ under the License.
title
:
[
'
1. 北京、天津、河北 rich text 正常倾斜(河北竖直)(其他 region 都没数据,显示 NaN)
'
,
'
2. selectedMode: "multiple"
'
,
'
3. hover 时标签底色变红
'
,
'
所有 label 样式一致(例外:没数据的 label 并不 rotate,因为这还没支持)
'
]
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录