Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
3744fc77
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,发现更多精彩内容 >>
提交
3744fc77
编写于
12月 27, 2017
作者:
O
Ovilia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(sunburst): update animation
上级
7f523d78
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
83 deletion
+39
-83
src/chart/sunburst/SunburstPiece.js
src/chart/sunburst/SunburstPiece.js
+2
-5
src/chart/sunburst/SunburstSeries.js
src/chart/sunburst/SunburstSeries.js
+2
-2
src/chart/sunburst/SunburstView.js
src/chart/sunburst/SunburstView.js
+34
-32
src/chart/sunburst/sunburstLayout.js
src/chart/sunburst/sunburstLayout.js
+1
-1
src/data/TreeDiff.js
src/data/TreeDiff.js
+0
-43
未找到文件。
src/chart/sunburst/SunburstPiece.js
浏览文件 @
3744fc77
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
*
as
graphic
from
'
../../util/graphic
'
;
import
Model
from
'
../../model/Model
'
;
var
NodeHighlightPolicy
=
{
NONE
:
'
none
'
,
// not downplay others
...
...
@@ -69,7 +68,6 @@ SunburstPieceProto.updateData = function (
var
sectorShape
=
zrUtil
.
extend
({},
layout
);
sectorShape
.
label
=
null
;
// Update common style
var
itemStyleModel
=
itemModel
.
getModel
(
'
itemStyle
'
);
var
visualColor
=
getNodeColor
(
node
,
seriesModel
,
ecModel
);
...
...
@@ -127,9 +125,8 @@ SunburstPieceProto.updateData = function (
this
.
_initEvents
(
sector
,
node
,
seriesModel
,
highlightPolicy
);
}
this
.
_seriesModel
=
seriesModel
;
this
.
_ecModel
=
ecModel
;
this
.
_seriesModel
=
seriesModel
||
this
.
_seriesModel
;
this
.
_ecModel
=
ecModel
||
this
.
_ecModel
;
};
SunburstPieceProto
.
onEmphasis
=
function
(
highlightPolicy
)
{
...
...
src/chart/sunburst/SunburstSeries.js
浏览文件 @
3744fc77
...
...
@@ -73,8 +73,8 @@ export default SeriesModel.extend({
// 'ancestor', 'self'
highlightPolicy
:
'
descendant
'
,
// '
zoom
ToNode', 'link', or false
nodeClick
:
'
zoom
ToNode
'
,
// '
root
ToNode', 'link', or false
nodeClick
:
'
root
ToNode
'
,
renderLabelForZeroData
:
false
,
...
...
src/chart/sunburst/SunburstView.js
浏览文件 @
3744fc77
...
...
@@ -10,11 +10,6 @@ var SunburstView = ChartView.extend({
type
:
'
sunburst
'
,
init
:
function
()
{
/**
* @private
* @type {module:echarts/data/Node}
*/
this
.
_oldRoot
;
},
render
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
...
...
@@ -26,17 +21,19 @@ var SunburstView = ChartView.extend({
var
virtualRoot
=
seriesModel
.
getData
().
tree
.
root
;
var
oldRoot
=
this
.
_oldRoot
;
var
newRoot
=
seriesModel
.
getViewRoot
();
var
group
=
this
.
group
;
var
renderLabelForZeroData
=
seriesModel
.
get
(
'
renderLabelForZeroData
'
);
dualTravel
(
newRoot
?
[
newRoot
]
:
[],
oldRoot
?
[
oldRoot
]
:
[]
);
var
newChildren
=
[];
newRoot
.
eachNode
(
function
(
node
)
{
newChildren
.
push
(
node
);
});
var
oldChildren
=
this
.
_oldChildren
||
[];
dualTravel
(
newChildren
,
oldChildren
);
renderRollUp
(
virtualRoot
,
newRoot
);
...
...
@@ -56,7 +53,7 @@ var SunburstView = ChartView.extend({
this
.
_initEvents
();
this
.
_old
Root
=
newRoot
;
this
.
_old
Children
=
newChildren
;
function
dualTravel
(
newChildren
,
oldChildren
)
{
if
(
newChildren
.
length
===
0
&&
oldChildren
.
length
===
0
)
{
...
...
@@ -78,11 +75,6 @@ var SunburstView = ChartView.extend({
var
oldNode
=
oldId
==
null
?
null
:
oldChildren
[
oldId
];
doRenderNode
(
newNode
,
oldNode
);
dualTravel
(
newNode
&&
newNode
.
children
||
[],
oldNode
&&
oldNode
.
children
||
[]
);
}
}
...
...
@@ -92,7 +84,7 @@ var SunburstView = ChartView.extend({
newNode
=
null
;
}
if
(
newNode
!==
virtualRoot
)
{
if
(
newNode
!==
virtualRoot
&&
oldNode
!==
virtualRoot
)
{
if
(
oldNode
&&
oldNode
.
piece
)
{
if
(
newNode
)
{
// Update
...
...
@@ -125,13 +117,10 @@ var SunburstView = ChartView.extend({
group
.
remove
(
node
.
piece
);
node
.
piece
=
null
;
}
zrUtil
.
each
(
node
.
children
,
function
(
child
)
{
removeNode
(
child
);
});
}
function
renderRollUp
(
virtualRoot
,
viewRoot
)
{
if
(
vi
rtualRoot
!==
viewRoot
)
{
if
(
vi
ewRoot
.
depth
>
0
)
{
// Render
if
(
virtualRoot
.
piece
)
{
// Update
...
...
@@ -148,9 +137,14 @@ var SunburstView = ChartView.extend({
group
.
add
(
virtualRoot
.
piece
);
}
virtualRoot
.
piece
.
on
(
'
click
'
,
function
(
e
)
{
if
(
viewRoot
.
piece
.
_onclickEvent
)
{
viewRoot
.
piece
.
off
(
'
click
'
,
viewRoot
.
piece
.
_onclickEvent
);
}
var
event
=
function
(
e
)
{
that
.
_rootToNode
(
viewRoot
.
parentNode
);
});
};
viewRoot
.
piece
.
_onclickEvent
=
event
;
virtualRoot
.
piece
.
on
(
'
click
'
,
event
);
}
else
if
(
virtualRoot
.
piece
)
{
// Remove
...
...
@@ -169,7 +163,7 @@ var SunburstView = ChartView.extend({
_initEvents
:
function
()
{
var
that
=
this
;
this
.
group
.
on
(
'
click
'
,
function
(
e
)
{
var
event
=
function
(
e
)
{
var
nodeClick
=
that
.
seriesModel
.
get
(
'
nodeClick
'
,
true
);
if
(
!
nodeClick
)
{
return
;
...
...
@@ -181,7 +175,7 @@ var SunburstView = ChartView.extend({
if
(
!
targetFound
&&
node
.
piece
&&
node
.
piece
.
childAt
(
0
)
===
e
.
target
)
{
if
(
nodeClick
===
'
zoom
ToNode
'
)
{
if
(
nodeClick
===
'
root
ToNode
'
)
{
that
.
_rootToNode
(
node
);
}
else
if
(
nodeClick
===
'
link
'
)
{
...
...
@@ -196,19 +190,27 @@ var SunburstView = ChartView.extend({
targetFound
=
true
;
}
});
});
};
if
(
this
.
group
.
_onclickEvent
)
{
this
.
group
.
off
(
'
click
'
,
this
.
group
.
_onclickEvent
);
}
this
.
group
.
on
(
'
click
'
,
event
);
this
.
group
.
_onclickEvent
=
event
;
},
/**
* @private
*/
_rootToNode
:
function
(
node
)
{
this
.
api
.
dispatchAction
({
type
:
ROOT_TO_NODE_ACTION
,
from
:
this
.
uid
,
seriesId
:
this
.
seriesModel
.
id
,
targetNode
:
node
});
if
(
node
!==
this
.
seriesModel
.
getViewRoot
())
{
this
.
api
.
dispatchAction
({
type
:
ROOT_TO_NODE_ACTION
,
from
:
this
.
uid
,
seriesId
:
this
.
seriesModel
.
id
,
targetNode
:
node
});
}
},
/**
...
...
src/chart/sunburst/sunburstLayout.js
浏览文件 @
3744fc77
...
...
@@ -46,7 +46,7 @@ export default function (seriesType, ecModel, api, payload) {
// Sum may be 0
var
unitRadian
=
Math
.
PI
/
(
sum
||
validDataCount
)
*
2
;
var
renderRollupNode
=
treeRoot
!==
virtualRoot
;
var
renderRollupNode
=
treeRoot
.
depth
>
0
;
var
levels
=
treeRoot
.
height
-
(
renderRollupNode
?
-
1
:
1
);
var
rPerLevel
=
(
r
-
r0
)
/
(
levels
||
1
);
...
...
src/data/TreeDiff.js
已删除
100644 → 0
浏览文件 @
7f523d78
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
DataDiff
from
'
./DataDiffer
'
;
/**
* @param {Array} oldArr
* @param {Array} newArr
* @param {Function} oldKeyGetter
* @param {Function} newKeyGetter
* @param {Object} [context] Can be visited by this.context in callback.
*/
function
TreeDiff
(
oldArr
,
newArr
,
oldKeyGetter
,
newKeyGetter
,
context
)
{
DataDiff
.
apply
(
this
,
arguments
);
}
TreeDiff
.
prototype
.
_initIndexMap
=
function
(
arr
,
map
,
keyArr
,
keyGetterName
,
dataDiffer
)
{
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
// Add prefix to avoid conflict with Object.prototype.
var
key
=
'
_ec_
'
+
dataDiffer
[
keyGetterName
](
arr
[
i
],
i
);
var
existence
=
map
[
key
];
if
(
existence
==
null
)
{
map
[
key
]
=
keyArr
.
length
;
keyArr
.
push
(
key
);
}
else
{
if
(
!
existence
.
length
)
{
map
[
key
]
=
existence
=
[
existence
];
}
existence
.
push
(
i
);
}
if
(
arr
[
i
].
children
&&
arr
[
i
].
children
.
length
>
0
)
{
this
.
_initIndexMap
(
arr
[
i
].
children
,
map
,
keyArr
,
keyGetterName
,
dataDiffer
);
}
}
};
zrUtil
.
inherits
(
TreeDiff
,
DataDiff
);
export
default
TreeDiff
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录