Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
0dd3eee7
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,发现更多精彩内容 >>
提交
0dd3eee7
编写于
5月 16, 2016
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak link list
上级
c9fa43d1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
47 deletion
+45
-47
src/data/Graph.js
src/data/Graph.js
+0
-2
src/data/List.js
src/data/List.js
+5
-14
src/data/helper/linkList.js
src/data/helper/linkList.js
+40
-31
未找到文件。
src/data/Graph.js
浏览文件 @
0dd3eee7
...
...
@@ -303,12 +303,10 @@ define(function(require) {
nodes
[
data
.
getRawIndex
(
i
)].
dataIndex
=
i
;
}
edgeData
.
silent
=
true
;
edgeData
.
filterSelf
(
function
(
idx
)
{
var
edge
=
edges
[
edgeData
.
getRawIndex
(
idx
)];
return
edge
.
node1
.
dataIndex
>=
0
&&
edge
.
node2
.
dataIndex
>=
0
;
});
edgeData
.
silent
=
false
;
// Update edge
for
(
var
i
=
0
,
len
=
edges
.
length
;
i
<
len
;
i
++
)
{
...
...
src/data/List.js
浏览文件 @
0dd3eee7
...
...
@@ -98,11 +98,6 @@ define(function (require) {
*/
this
.
dataType
;
/**
* @type {boolean}
*/
this
.
silent
=
false
;
/**
* Indices stores the indices of data subset after filtered.
* This data subset will be used in chart.
...
...
@@ -668,8 +663,6 @@ define(function (require) {
// Reset data extent
this
.
_extent
=
{};
!
this
.
silent
&&
this
.
__onChange
();
return
this
;
};
...
...
@@ -765,8 +758,6 @@ define(function (require) {
}
},
stack
,
context
);
!
this
.
silent
&&
this
.
__onTransfer
(
list
);
return
list
;
};
...
...
@@ -813,8 +804,6 @@ define(function (require) {
indices
.
push
(
idx
);
}
!
this
.
silent
&&
this
.
__onTransfer
(
list
);
return
list
;
};
...
...
@@ -1038,8 +1027,6 @@ define(function (require) {
list
.
indices
=
this
.
indices
.
slice
();
!
this
.
silent
&&
this
.
__onTransfer
(
list
);
return
list
;
};
...
...
@@ -1061,7 +1048,11 @@ define(function (require) {
};
};
listProto
.
__onTransfer
=
listProto
.
__onChange
=
zrUtil
.
noop
;
// Methods that create a new list based on this list should be listed here.
// Notice that those method should `RETURN` the new list.
listProto
.
TRANSFERABLE_METHODS
=
[
'
cloneShallow
'
,
'
downSample
'
,
'
map
'
];
// Methods that change indices of this list should be listed here.
listProto
.
CHANGABLE_METHODS
=
[
'
filterSelf
'
];
return
List
;
});
\ No newline at end of file
src/data/helper/linkList.js
浏览文件 @
0dd3eee7
...
...
@@ -41,45 +41,54 @@ define(function (require) {
// Porxy data original methods.
each
(
datas
,
function
(
data
)
{
each
(
injections
,
function
(
injection
,
methodName
)
{
data
.
wrapMethod
(
methodName
,
zrUtil
.
curry
(
i
njection
,
opt
));
each
(
mainData
.
TRANSFERABLE_METHODS
,
function
(
methodName
)
{
data
.
wrapMethod
(
methodName
,
zrUtil
.
curry
(
transferI
njection
,
opt
));
});
});
// Beyond transfer, additional features should be added to `cloneShallow`.
mainData
.
wrapMethod
(
'
cloneShallow
'
,
zrUtil
.
curry
(
cloneShallowInjection
,
opt
));
// Only mainData trigger change, because struct.update may trigger
// another changable methods, which may bring about dead lock.
each
(
mainData
.
CHANGABLE_METHODS
,
function
(
methodName
)
{
mainData
.
wrapMethod
(
methodName
,
zrUtil
.
curry
(
changeInjection
,
opt
));
});
// Make sure datas contains mainData.
zrUtil
.
assert
(
datas
[
mainData
.
dataType
]
===
mainData
);
}
var
injections
=
{
__onTransfer
:
function
(
opt
,
res
,
newData
)
{
if
(
isMainData
(
this
))
{
// Transfer datas to new main data.
var
datas
=
zrUtil
.
extend
({},
this
[
DATAS
]);
datas
[
this
.
dataType
]
=
newData
;
linkAll
(
newData
,
datas
,
opt
);
}
else
{
// Modify the reference in main data to point newData.
linkSingle
(
newData
,
this
.
dataType
,
this
[
MAIN_DATA
],
opt
);
}
},
__onChange
:
function
(
opt
)
{
opt
.
struct
&&
opt
.
struct
.
update
(
this
);
},
cloneShallow
:
function
(
opt
,
newData
)
{
// cloneShallow, which brings about some fragilities, may be inappropriate
// to be exposed as an API. So for implementation simplicity we can make
// the restriction that cloneShallow of not-mainData should not be invoked
// outside, but only be invoked here.
isMainData
(
this
)
&&
each
(
newData
[
DATAS
],
function
(
data
,
dataType
)
{
data
!==
newData
&&
linkSingle
(
data
.
cloneShallow
(),
dataType
,
newData
,
opt
);
});
return
newData
;
function
transferInjection
(
opt
,
res
)
{
if
(
isMainData
(
this
))
{
// Transfer datas to new main data.
var
datas
=
zrUtil
.
extend
({},
this
[
DATAS
]);
datas
[
this
.
dataType
]
=
res
;
linkAll
(
res
,
datas
,
opt
);
}
else
{
// Modify the reference in main data to point newData.
linkSingle
(
res
,
this
.
dataType
,
this
[
MAIN_DATA
],
opt
);
}
};
return
res
;
}
function
changeInjection
(
opt
,
res
)
{
opt
.
struct
&&
opt
.
struct
.
update
(
this
);
return
res
;
}
function
cloneShallowInjection
(
opt
,
res
)
{
// cloneShallow, which brings about some fragilities, may be inappropriate
// to be exposed as an API. So for implementation simplicity we can make
// the restriction that cloneShallow of not-mainData should not be invoked
// outside, but only be invoked here.
each
(
res
[
DATAS
],
function
(
data
,
dataType
)
{
data
!==
res
&&
linkSingle
(
data
.
cloneShallow
(),
dataType
,
res
,
opt
);
});
return
res
;
}
/**
* Supplement method to List.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录