Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
7538767f
I
incubator-echarts
项目概览
missman
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
7538767f
编写于
4月 17, 2017
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[axisPointer] modify params of updateAxisPointer, for connection
上级
254e4f94
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
29 deletion
+54
-29
src/component/axisPointer/BaseAxisPointer.js
src/component/axisPointer/BaseAxisPointer.js
+8
-6
src/component/axisPointer/axisTrigger.js
src/component/axisPointer/axisTrigger.js
+46
-23
未找到文件。
src/component/axisPointer/BaseAxisPointer.js
浏览文件 @
7538767f
...
...
@@ -358,16 +358,18 @@ define(function(require) {
}
var
payloadInfo
=
this
.
_payloadInfo
;
var
payload
=
{
var
axisModel
=
this
.
_axisModel
;
this
.
_api
.
dispatchAction
({
type
:
'
updateAxisPointer
'
,
x
:
payloadInfo
.
cursorPoint
[
0
],
y
:
payloadInfo
.
cursorPoint
[
1
],
tooltipOption
:
payloadInfo
.
tooltipOption
,
highDownKey
:
'
axisPointerHandle
'
};
var
axis
=
this
.
_axisModel
.
axis
;
payload
[
axis
.
dim
+
'
AxisId
'
]
=
this
.
_axisModel
.
id
;
this
.
_api
.
dispatchAction
(
payload
);
highDownKey
:
'
axisPointerHandle
'
,
axesInfo
:
[{
axisDim
:
axisModel
.
axis
.
dim
,
axisIndex
:
axisModel
.
componentIndex
}]
});
},
/**
...
...
src/component/axisPointer/axisTrigger.js
浏览文件 @
7538767f
...
...
@@ -17,7 +17,12 @@ define(function(require) {
* @param {string} [currTrigger] 'click' | 'mousemove' | 'leave'
* @param {Array.<number>} [point] x and y, which are mandatory, specify a point to
* tigger axisPointer and tooltip.
* @param {Object} [finder] {xAxisId: ...[], yAxisName: ...[], angleAxisIndex: ...[]}
* @param {Object} [finder] {
* seriesIndex, dataIndex,
* axesInfo: [{
* axisDim: 'x'|'y'|'angle'|..., axisIndex: ..., value: ...
* }, ...]
* }
* These properties, which are optional, restrict target axes.
* @param {Function} dispatchAction
* @param {module:echarts/ExtensionAPI} api
...
...
@@ -30,7 +35,9 @@ define(function(require) {
ecModel
,
api
,
tooltipOption
,
highDownKey
)
{
finder
=
finder
||
{};
if
(
!
point
||
point
[
0
]
==
null
||
point
[
1
]
==
null
)
{
if
(
illegalPoint
(
point
))
{
// Used in the default behavior of `connection`: use the sample seriesIndex
// and dataIndex. And also used in the tooltipView trigger.
point
=
findPointFromSeries
({
seriesIndex
:
finder
.
seriesIndex
,
// Do not use dataIndexInside from other ec instance.
...
...
@@ -38,6 +45,13 @@ define(function(require) {
dataIndex
:
finder
.
dataIndex
},
ecModel
).
point
;
}
var
isIllegalPoint
=
illegalPoint
(
point
);
// Axis and value can be specified when calling dispatchAction({type: 'updateAxisPointer'}).
// Notice: In this case, it is difficult to get the `point` (which is necessary to show
// tooltip, so if point is not given, we just use the point found by sample seriesIndex
// and dataIndex.
var
inputAxesInfo
=
finder
.
axesInfo
;
var
axesInfo
=
coordSysAxesInfo
.
axesInfo
;
var
shouldHide
=
currTrigger
===
'
leave
'
||
illegalPoint
(
point
);
...
...
@@ -54,12 +68,19 @@ define(function(require) {
// Process for triggered axes.
each
(
coordSysAxesInfo
.
coordSysMap
,
function
(
coordSys
,
coordSysKey
)
{
var
coordSysContainsPoint
=
coordSys
.
containPoint
(
point
);
// If a point given, it must be contained by the coordinate system.
var
coordSysContainsPoint
=
isIllegalPoint
||
coordSys
.
containPoint
(
point
);
each
(
coordSysAxesInfo
.
coordSysAxesInfo
[
coordSysKey
],
function
(
axisInfo
,
key
)
{
var
axis
=
axisInfo
.
axis
;
if
(
!
shouldHide
&&
coordSysContainsPoint
&&
!
notTargetAxis
(
finder
,
axis
))
{
processOnAxis
(
axisInfo
,
axis
.
pointToData
(
point
),
updaters
,
false
,
outputFinder
);
var
inputAxisInfo
=
findInputAxisInfo
(
inputAxesInfo
,
axisInfo
);
// If no inputAxesInfo, no axis is restricted.
if
(
!
shouldHide
&&
coordSysContainsPoint
&&
(
!
inputAxesInfo
||
inputAxisInfo
))
{
var
val
=
inputAxisInfo
&&
inputAxisInfo
.
value
;
if
(
val
==
null
&&
!
isIllegalPoint
)
{
val
=
axis
.
pointToData
(
point
);
}
val
!=
null
&&
processOnAxis
(
axisInfo
,
val
,
updaters
,
false
,
outputFinder
);
}
});
});
...
...
@@ -88,7 +109,7 @@ define(function(require) {
processOnAxis
(
axesInfo
[
tarKey
],
val
,
updaters
,
true
,
outputFinder
);
});
updateModelActually
(
showValueMap
,
axesInfo
);
updateModelActually
(
showValueMap
,
axesInfo
,
outputFinder
);
dispatchTooltipActually
(
dataByCoordSys
,
point
,
tooltipOption
,
dispatchAction
);
dispatchHighDownActually
(
highlightBatch
,
dispatchAction
,
api
,
highDownKey
);
...
...
@@ -127,7 +148,7 @@ define(function(require) {
}
updaters
.
highlight
(
'
highlight
'
,
payloadBatch
);
updaters
.
showPointer
(
axisInfo
,
newValue
,
payloadBatch
);
updaters
.
showPointer
(
axisInfo
,
newValue
,
payloadBatch
,
outputFinder
);
// Tooltip should always be snapToValue, otherwise there will be
// incorrect "axis value ~ series value" mapping displayed in tooltip.
updaters
.
showTooltip
(
axisInfo
,
payloadInfo
,
snapToValue
);
...
...
@@ -247,7 +268,8 @@ define(function(require) {
highlightBatch
.
push
.
apply
(
highlightBatch
,
batch
);
}
function
updateModelActually
(
showValueMap
,
axesInfo
)
{
function
updateModelActually
(
showValueMap
,
axesInfo
,
outputFinder
)
{
var
outputAxesInfo
=
outputFinder
.
axesInfo
=
[];
// Basic logic: If no 'show' required, 'hide' this axisPointer.
each
(
axesInfo
,
function
(
axisInfo
,
key
)
{
var
option
=
axisInfo
.
axisPointerModel
.
option
;
...
...
@@ -266,6 +288,13 @@ define(function(require) {
// click legend to toggle axis blank.
!
axisInfo
.
useHandle
&&
(
option
.
status
=
'
hide
'
);
}
// If status is 'hide', should be no info in payload.
option
.
status
===
'
show
'
&&
outputAxesInfo
.
push
({
axisDim
:
axisInfo
.
axis
.
dim
,
axisIndex
:
axisInfo
.
axis
.
model
.
componentIndex
,
value
:
option
.
value
});
});
}
...
...
@@ -337,21 +366,15 @@ define(function(require) {
});
}
function
notTargetAxis
(
finder
,
axis
)
{
var
isTarget
=
1
;
// If none of xxxAxisId and xxxAxisName and xxxAxisIndex exists in finder,
// no axis is not target axis.
each
(
finder
,
function
(
value
,
propName
)
{
isTarget
&=
!
(
/^.+
(
AxisId|AxisName|AxisIndex
)
$/
.
test
(
propName
));
});
!
isTarget
&&
each
(
[[
'
AxisId
'
,
'
id
'
],
[
'
AxisIndex
'
,
'
componentIndex
'
],
[
'
AxisName
'
,
'
name
'
]],
function
(
prop
)
{
var
vals
=
modelUtil
.
normalizeToArray
(
finder
[
axis
.
dim
+
prop
[
0
]]);
isTarget
|=
zrUtil
.
indexOf
(
vals
,
axis
.
model
[
prop
[
1
]])
>=
0
;
function
findInputAxisInfo
(
inputAxesInfo
,
axisInfo
)
{
for
(
var
i
=
0
;
i
<
(
inputAxesInfo
||
[]).
length
;
i
++
)
{
var
inputAxisInfo
=
inputAxesInfo
[
i
];
if
(
axisInfo
.
axis
.
dim
===
inputAxisInfo
.
axisDim
&&
axisInfo
.
axis
.
model
.
componentIndex
===
inputAxisInfo
.
axisIndex
)
{
return
inputAxisInfo
;
}
);
return
!
isTarget
;
}
}
function
makeMapperParam
(
axisInfo
)
{
...
...
@@ -365,7 +388,7 @@ define(function(require) {
}
function
illegalPoint
(
point
)
{
return
point
[
0
]
==
null
||
isNaN
(
point
[
0
])
||
point
[
1
]
==
null
||
isNaN
(
point
[
1
]);
return
!
point
||
point
[
0
]
==
null
||
isNaN
(
point
[
0
])
||
point
[
1
]
==
null
||
isNaN
(
point
[
1
]);
}
return
axisTrigger
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录