Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
1fe431ea
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,发现更多精彩内容 >>
提交
1fe431ea
编写于
12月 07, 2016
作者:
1
100pah
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[graph] focusNodeAdjacency action.
上级
60c6a4b6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
107 addition
and
34 deletion
+107
-34
src/chart/graph.js
src/chart/graph.js
+1
-1
src/chart/graph/GraphView.js
src/chart/graph/GraphView.js
+27
-10
src/chart/graph/graphAction.js
src/chart/graph/graphAction.js
+27
-1
src/echarts.js
src/echarts.js
+23
-18
src/model/Global.js
src/model/Global.js
+3
-3
test/graph.html
test/graph.html
+26
-1
未找到文件。
src/chart/graph.js
浏览文件 @
1fe431ea
...
...
@@ -6,7 +6,7 @@ define(function (require) {
require
(
'
./graph/GraphSeries
'
);
require
(
'
./graph/GraphView
'
);
require
(
'
./graph/
roam
Action
'
);
require
(
'
./graph/
graph
Action
'
);
echarts
.
registerProcessor
(
require
(
'
./graph/categoryFilter
'
));
...
...
src/chart/graph/GraphView.js
浏览文件 @
1fe431ea
...
...
@@ -102,12 +102,25 @@ define(function (require) {
}
el
.
setDraggable
(
draggable
&&
forceLayout
);
el
.
off
(
'
mouseover
'
,
this
.
_focusNodeAdjacency
);
el
.
off
(
'
mouseout
'
,
this
.
_unfocusAll
);
el
.
off
(
'
mouseover
'
,
el
.
__focusNodeAdjacency
);
el
.
off
(
'
mouseout
'
,
el
.
__unfocusNodeAdjacency
);
if
(
itemModel
.
get
(
'
focusNodeAdjacency
'
))
{
el
.
on
(
'
mouseover
'
,
this
.
_focusNodeAdjacency
,
this
);
el
.
on
(
'
mouseout
'
,
this
.
_unfocusAll
,
this
);
el
.
on
(
'
mouseover
'
,
el
.
__focusNodeAdjacency
=
function
()
{
api
.
dispatchAction
({
type
:
'
focusNodeAdjacency
'
,
seriesId
:
seriesModel
.
id
,
dataIndex
:
el
.
dataIndex
});
});
el
.
on
(
'
mouseout
'
,
el
.
__unfocusNodeAdjacency
=
function
()
{
api
.
dispatchAction
({
type
:
'
unfocusNodeAdjacency
'
,
seriesId
:
seriesModel
.
id
});
});
}
},
this
);
var
circularRotateLabel
=
seriesModel
.
get
(
'
layout
'
)
===
'
circular
'
&&
seriesModel
.
get
(
'
circular.rotateLabel
'
);
...
...
@@ -146,11 +159,16 @@ define(function (require) {
this
.
_controller
&&
this
.
_controller
.
dispose
();
},
_focusNodeAdjacency
:
function
(
e
)
{
focusNodeAdjacency
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
var
data
=
this
.
_model
.
getData
();
var
dataIndex
=
payload
.
dataIndex
;
var
el
=
data
.
getItemGraphicEl
(
dataIndex
);
if
(
!
el
)
{
return
;
}
var
graph
=
data
.
graph
;
var
el
=
e
.
target
;
var
dataIndex
=
el
.
dataIndex
;
var
dataType
=
el
.
dataType
;
function
fadeOutItem
(
item
,
opacityPath
)
{
...
...
@@ -200,9 +218,8 @@ define(function (require) {
}
},
_unfocusAll
:
function
()
{
var
data
=
this
.
_model
.
getData
();
var
graph
=
data
.
graph
;
unfocusNodeAdjacency
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
var
graph
=
this
.
_model
.
getData
().
graph
;
graph
.
eachNode
(
function
(
node
)
{
var
opacity
=
getItemOpacity
(
node
,
nodeOpacityPath
);
node
.
getGraphicEl
().
traverse
(
function
(
child
)
{
...
...
src/chart/graph/
roam
Action.js
→
src/chart/graph/
graph
Action.js
浏览文件 @
1fe431ea
...
...
@@ -18,7 +18,6 @@ define(function (require) {
* @property {number} [originX]
* @property {number} [originY]
*/
echarts
.
registerAction
(
actionInfo
,
function
(
payload
,
ecModel
)
{
ecModel
.
eachComponent
({
mainType
:
'
series
'
,
query
:
payload
},
function
(
seriesModel
)
{
var
coordSys
=
seriesModel
.
coordinateSystem
;
...
...
@@ -32,4 +31,31 @@ define(function (require) {
&&
seriesModel
.
setZoom
(
res
.
zoom
);
});
});
/**
* @payload
* @property {number} [seriesIndex]
* @property {string} [seriesId]
* @property {string} [seriesName]
* @property {number} [dataIndex]
*/
echarts
.
registerAction
({
type
:
'
focusNodeAdjacency
'
,
event
:
'
focusNodeAdjacency
'
,
update
:
'
series.graph:focusNodeAdjacency
'
},
function
()
{});
/**
* @payload
* @property {number} [seriesIndex]
* @property {string} [seriesId]
* @property {string} [seriesName]
*/
echarts
.
registerAction
({
type
:
'
unfocusNodeAdjacency
'
,
event
:
'
unfocusNodeAdjacency
'
,
update
:
'
series.graph:unfocusNodeAdjacency
'
},
function
()
{});
});
\ No newline at end of file
src/echarts.js
浏览文件 @
1fe431ea
...
...
@@ -773,24 +773,29 @@ define(function (require) {
/**
* @private
*/
function
updateDirectly
(
method
,
payload
,
mainType
,
subType
)
{
var
ecModel
=
this
.
_model
;
// dispatchAction before setOption
if
(
!
ecModel
)
{
return
;
function
updateDirectly
(
ecIns
,
method
,
payload
,
mainType
,
subType
,
restrict
)
{
var
ecModel
=
ecIns
.
_model
;
var
query
;
if
(
restrict
)
{
query
=
{};
query
[
mainType
+
'
Id
'
]
=
payload
[
mainType
+
'
Id
'
];
query
[
mainType
+
'
Index
'
]
=
payload
[
mainType
+
'
Index
'
];
query
[
mainType
+
'
Name
'
]
=
payload
[
mainType
+
'
Name
'
];
}
var
condition
=
{
mainType
:
mainType
,
query
:
payload
};
var
condition
=
{
mainType
:
mainType
,
query
:
query
};
subType
&&
(
condition
.
subType
=
subType
);
// subType may be '' by parseClassType;
ecModel
.
eachComponent
(
condition
,
function
(
model
,
index
)
{
var
view
=
this
[
// If dispatchAction before setOption, do nothing.
ecModel
&&
ecModel
.
eachComponent
(
condition
,
function
(
model
,
index
)
{
var
view
=
ecIns
[
mainType
===
'
series
'
?
'
_chartsMap
'
:
'
_componentsMap
'
][
model
.
__viewId
];
if
(
view
&&
view
.
__alive
)
{
view
[
method
](
model
,
ecModel
,
thi
s
.
_api
,
payload
);
view
[
method
](
model
,
ecModel
,
ecIn
s
.
_api
,
payload
);
}
},
thi
s
);
},
ecIn
s
);
}
/**
...
...
@@ -920,9 +925,9 @@ define(function (require) {
var
actionWrap
=
actions
[
payloadType
];
var
actionInfo
=
actionWrap
.
actionInfo
;
var
c
omponen
tType
=
(
actionInfo
.
update
||
'
update
'
).
split
(
'
:
'
);
var
updateMethod
=
c
omponen
tType
.
pop
();
c
omponentType
=
componentType
[
0
]
&&
parseClassType
(
componen
tType
[
0
]);
var
c
p
tType
=
(
actionInfo
.
update
||
'
update
'
).
split
(
'
:
'
);
var
updateMethod
=
c
p
tType
.
pop
();
c
ptType
=
cptType
[
0
]
&&
parseClassType
(
cp
tType
[
0
]);
this
[
IN_MAIN_PROCESS
]
=
true
;
...
...
@@ -955,14 +960,14 @@ define(function (require) {
// light update does not perform data process, layout and visual.
if
(
isHighDown
)
{
// method, payload, mainType, subType
updateDirectly
.
call
(
this
,
updateMethod
,
batchItem
,
'
series
'
);
updateDirectly
(
this
,
updateMethod
,
batchItem
,
'
series
'
);
}
else
if
(
c
omponen
tType
)
{
updateDirectly
.
call
(
this
,
updateMethod
,
batchItem
,
componentType
.
main
,
componentType
.
sub
);
else
if
(
c
p
tType
)
{
updateDirectly
(
this
,
updateMethod
,
batchItem
,
cptType
.
main
,
cptType
.
sub
,
true
);
}
}
if
(
updateMethod
!==
'
none
'
&&
!
isHighDown
&&
!
c
omponen
tType
)
{
if
(
updateMethod
!==
'
none
'
&&
!
isHighDown
&&
!
c
p
tType
)
{
// Still dirty
if
(
this
[
OPTION_UPDATED
])
{
// FIXME Pass payload ?
...
...
src/model/Global.js
浏览文件 @
1fe431ea
...
...
@@ -383,9 +383,9 @@ define(function (require) {
var
idAttr
=
mainType
+
'
Id
'
;
var
nameAttr
=
mainType
+
'
Name
'
;
return
q
&&
(
q
.
hasOwnProperty
(
indexAttr
)
||
q
.
hasOwnProperty
(
idAttr
)
||
q
.
hasOwnProperty
(
nameAttr
)
q
[
indexAttr
]
!=
null
||
q
[
idAttr
]
!=
null
||
q
[
nameAttr
]
!=
null
)
?
{
mainType
:
mainType
,
...
...
test/graph.html
浏览文件 @
1fe431ea
...
...
@@ -114,7 +114,21 @@
chart
.
setOption
(
option
);
var
config
=
{
layout
:
'
none
'
layout
:
'
none
'
,
focusNodeAdjacency
:
true
,
manualFocusNodeAdjacency
:
function
()
{
chart
.
dispatchAction
({
type
:
'
focusNodeAdjacency
'
,
seriesName
:
'
Les Miserables
'
,
dataIndex
:
2
});
},
manualUnfocusNodeAdjacency
:
function
()
{
chart
.
dispatchAction
({
type
:
'
unfocusNodeAdjacency
'
,
seriesName
:
'
Les Miserables
'
});
}
};
chart
.
on
(
'
click
'
,
function
(
params
)
{
...
...
@@ -131,6 +145,17 @@
}]
});
});
gui
.
add
(
config
,
'
focusNodeAdjacency
'
)
.
onChange
(
function
(
value
)
{
chart
.
setOption
({
series
:
[{
name
:
'
Les Miserables
'
,
focusNodeAdjacency
:
value
}]
});
});
gui
.
add
(
config
,
'
manualFocusNodeAdjacency
'
);
gui
.
add
(
config
,
'
manualUnfocusNodeAdjacency
'
);
});
});
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录