Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
32c35e58
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,发现更多精彩内容 >>
提交
32c35e58
编写于
1月 16, 2019
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable triggerEvent for angleAxis label. Fix #9765
上级
856a2856
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
18 deletion
+41
-18
src/component/axis/AngleAxisView.js
src/component/axis/AngleAxisView.js
+13
-1
src/component/axis/AxisBuilder.js
src/component/axis/AxisBuilder.js
+13
-13
test/bar-polar-basic.html
test/bar-polar-basic.html
+4
-1
test/ut/spec/component/helper/sliderMove.js
test/ut/spec/component/helper/sliderMove.js
+11
-3
未找到文件。
src/component/axis/AngleAxisView.js
浏览文件 @
32c35e58
...
...
@@ -21,6 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
import
*
as
graphic
from
'
../../util/graphic
'
;
import
Model
from
'
../../model/Model
'
;
import
AxisView
from
'
./AxisView
'
;
import
AxisBuilder
from
'
./AxisBuilder
'
;
var
elementList
=
[
'
axisLine
'
,
'
axisLabel
'
,
'
axisTick
'
,
'
splitLine
'
,
'
splitArea
'
];
...
...
@@ -145,6 +146,7 @@ export default AxisView.extend({
var
commonLabelModel
=
angleAxisModel
.
getModel
(
'
axisLabel
'
);
var
labelMargin
=
commonLabelModel
.
get
(
'
margin
'
);
var
triggerEvent
=
angleAxisModel
.
get
(
'
triggerEvent
'
);
// Use length of ticksAngles because it may remove the last tick to avoid overlapping
zrUtil
.
each
(
labels
,
function
(
labelItem
,
idx
)
{
...
...
@@ -167,7 +169,9 @@ export default AxisView.extend({
);
}
var
textEl
=
new
graphic
.
Text
({
silent
:
true
});
var
textEl
=
new
graphic
.
Text
({
silent
:
AxisBuilder
.
isLabelSilent
(
angleAxisModel
)
});
this
.
group
.
add
(
textEl
);
graphic
.
setTextStyle
(
textEl
.
style
,
labelModel
,
{
x
:
p
[
0
],
...
...
@@ -177,6 +181,14 @@ export default AxisView.extend({
textAlign
:
labelTextAlign
,
textVerticalAlign
:
labelTextVerticalAlign
});
// Pack data for mouse event
if
(
triggerEvent
)
{
textEl
.
eventData
=
AxisBuilder
.
makeAxisEventDataBase
(
angleAxisModel
);
textEl
.
eventData
.
targetType
=
'
axisLabel
'
;
textEl
.
eventData
.
value
=
labelItem
.
rawLabel
;
}
},
this
);
},
...
...
src/component/axis/AxisBuilder.js
浏览文件 @
32c35e58
...
...
@@ -30,15 +30,6 @@ import {shouldShowAllLabels} from '../../coord/axisHelper';
var
PI
=
Math
.
PI
;
function
makeAxisEventDataBase
(
axisModel
)
{
var
eventData
=
{
componentType
:
axisModel
.
mainType
,
componentIndex
:
axisModel
.
componentIndex
};
eventData
[
axisModel
.
mainType
+
'
Index
'
]
=
axisModel
.
componentIndex
;
return
eventData
;
}
/**
* A final axis is translated and rotated from a "standard axis".
* So opt.position and opt.rotation is required.
...
...
@@ -354,7 +345,7 @@ var builders = {
position
:
pos
,
rotation
:
labelLayout
.
rotation
,
silent
:
isSilent
(
axisModel
),
silent
:
is
Label
Silent
(
axisModel
),
z2
:
1
,
tooltip
:
(
tooltipOpt
&&
tooltipOpt
.
show
)
?
extend
({
...
...
@@ -393,6 +384,15 @@ var builders = {
};
var
makeAxisEventDataBase
=
AxisBuilder
.
makeAxisEventDataBase
=
function
(
axisModel
)
{
var
eventData
=
{
componentType
:
axisModel
.
mainType
,
componentIndex
:
axisModel
.
componentIndex
};
eventData
[
axisModel
.
mainType
+
'
Index
'
]
=
axisModel
.
componentIndex
;
return
eventData
;
};
/**
* @public
* @static
...
...
@@ -470,14 +470,14 @@ function endTextLayout(opt, textPosition, textRotate, extent) {
};
}
function
isSilent
(
axisModel
)
{
var
isLabelSilent
=
AxisBuilder
.
isLabelSilent
=
function
(
axisModel
)
{
var
tooltipOpt
=
axisModel
.
get
(
'
tooltip
'
);
return
axisModel
.
get
(
'
silent
'
)
// Consider mouse cursor, add these restrictions.
||
!
(
axisModel
.
get
(
'
triggerEvent
'
)
||
(
tooltipOpt
&&
tooltipOpt
.
show
)
);
}
}
;
function
fixMinMaxLabelShow
(
axisModel
,
labelEls
,
tickEls
)
{
if
(
shouldShowAllLabels
(
axisModel
.
axis
))
{
...
...
@@ -645,7 +645,7 @@ function buildAxisLabel(axisBuilder, axisModel, opt) {
var
rawCategoryData
=
axisModel
.
getCategories
(
true
);
var
labelEls
=
[];
var
silent
=
isSilent
(
axisModel
);
var
silent
=
is
Label
Silent
(
axisModel
);
var
triggerEvent
=
axisModel
.
get
(
'
triggerEvent
'
);
each
(
labels
,
function
(
labelItem
,
index
)
{
...
...
test/bar-polar-basic.html
浏览文件 @
32c35e58
...
...
@@ -36,6 +36,7 @@ under the License.
background
:
#fff
;
}
</style>
<h3>
click axis labe should console log
</h3>
<div
id=
"main"
></div>
<script>
...
...
@@ -50,11 +51,13 @@ under the License.
chart
.
setOption
({
angleAxis
:
{
triggerEvent
:
true
},
radiusAxis
:
{
type
:
'
category
'
,
data
:
[
'
周一
'
,
'
周二
'
,
'
周三
'
,
'
周四
'
,
'
周五
'
,
'
周六
'
,
'
周日
'
],
z
:
10
z
:
10
,
triggerEvent
:
true
},
polar
:
{
},
...
...
test/ut/spec/component/helper/sliderMove.js
浏览文件 @
32c35e58
...
...
@@ -42,14 +42,22 @@ describe('component/helper/sliderMove', function () {
// normalize by maxSpec
expect
(
sliderMove
(
0
,
[
20
,
42
],
[
20
,
50
],
0
,
null
,
10
)).
toEqual
([
20
,
30
]);
// Do not move
expect
(
sliderMove
(
0
,
[
-
10
,
70
],
[
20
,
50
],
'
all
'
)).
toEqual
([
20
,
50
]);
// minSpan bigger than extent
expect
(
sliderMove
(
4
,
[
20
,
25
],
[
10
,
50
],
0
,
300
)).
toEqual
([
10
,
50
]);
// maxSpan smaller than minSpan
expect
(
sliderMove
(
4
,
[
20
,
25
],
[
10
,
50
],
0
,
6
,
3
)).
toEqual
([
24
,
30
]);
// extent small then input range
expect
(
sliderMove
(
0
,
[
-
10
,
70
],
[
20
,
50
],
'
all
'
)).
toEqual
([
20
,
50
]);
expect
(
sliderMove
(
0
,
[
-
10
,
14
],
[
1
,
101
],
'
all
'
)).
toEqual
([
1
,
25
]);
expect
(
sliderMove
(
0
,
[
99
,
110
],
[
1
,
101
],
'
all
'
)).
toEqual
([
90
,
101
]);
expect
(
sliderMove
(
0
,
[
-
10
,
14
],
[
1
,
101
],
'
all
'
,
null
,
16
)).
toEqual
([
1
,
17
]);
expect
(
sliderMove
(
0
,
[
-
10
,
14
],
[
1
,
101
],
'
all
'
,
15
,
16
)).
toEqual
([
1
,
17
]);
expect
(
sliderMove
(
0
,
[
-
10
,
14
],
[
1
,
101
],
'
all
'
,
50
,
null
)).
toEqual
([
1
,
51
]);
expect
(
sliderMove
(
0
,
[
-
10
,
14
],
[
1
,
101
],
'
all
'
,
50
,
55
)).
toEqual
([
1
,
51
]);
expect
(
sliderMove
(
0
,
[
-
10
,
14
],
[
1
,
101
],
'
all
'
,
10
,
55
)).
toEqual
([
1
,
25
]);
});
testCase
(
'
rigid_move
'
,
function
(
sliderMove
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录