Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
be853cb1
E
echarts
项目概览
alon@wen
/
echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be853cb1
编写于
9月 25, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Line animation improvement
上级
1914f8b3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
23 deletion
+48
-23
src/chart/line/LineView.js
src/chart/line/LineView.js
+48
-22
src/model/globalDefault.js
src/model/globalDefault.js
+0
-1
未找到文件。
src/chart/line/LineView.js
浏览文件 @
be853cb1
...
...
@@ -23,6 +23,18 @@ define(function(require) {
return
true
;
}
function
getAxisExtentWithGap
(
axis
)
{
var
extent
=
axis
.
getExtent
();
if
(
axis
.
onBand
)
{
// Remove extra 1px to avoid line miter in clipped edge
var
halfBandWidth
=
axis
.
getBandWidth
()
/
2
-
1
;
var
dir
=
extent
[
1
]
>
extent
[
0
]
?
1
:
-
1
;
extent
[
0
]
+=
dir
*
halfBandWidth
;
extent
[
1
]
-=
dir
*
halfBandWidth
;
}
return
extent
;
}
return
require
(
'
../../echarts
'
).
extendChartView
({
type
:
'
line
'
,
...
...
@@ -65,13 +77,20 @@ define(function(require) {
// Draw symbols, enable animation on the first draw
var
dataSymbol
=
this
.
_dataSymbol
;
var
polyline
=
this
.
_polyline
;
var
enableAnimation
=
ecModel
.
get
(
'
animation
'
);
dataSymbol
.
z
=
seriesModel
.
get
(
'
z
'
)
+
1
;
// Initialization animation or coordinate system changed
if
(
!
this
.
_data
||
prevCoordSys
.
type
!==
coordSys
.
type
)
{
if
(
!
(
polyline
&&
prevCoordSys
.
type
===
coordSys
.
type
&&
enableAnimation
)
)
{
dataSymbol
.
updateData
(
data
,
false
);
var
polyline
=
new
api
.
Polyline
({
polyline
=
new
api
.
Polyline
({
shape
:
{
points
:
points
},
...
...
@@ -85,10 +104,11 @@ define(function(require) {
});
// var removeClipPath = zrUtil.bind(polyline.removeClipPath, polyline);
var
categoryAxis
=
coordSys
.
getAxesByScale
(
'
ordinal
'
)[
0
];
var
isHorizontal
=
categoryAxis
.
isHorizontal
();
var
clipPath
=
isCoordSysPolar
?
this
.
_createPolarClipShape
(
coordSys
,
api
)
:
this
.
_createGridClipShape
(
coordSys
,
api
);
?
this
.
_createPolarClipShape
(
coordSys
,
api
,
enableAnimation
,
isHorizontal
)
:
this
.
_createGridClipShape
(
coordSys
,
api
,
enableAnimation
,
isHorizontal
);
polyline
.
setClipPath
(
clipPath
);
...
...
@@ -97,6 +117,12 @@ define(function(require) {
this
.
_polyline
=
polyline
;
}
else
{
// Update clipPath
var
clipPath
=
isCoordSysPolar
?
this
.
_createPolarClipShape
(
coordSys
,
api
)
:
this
.
_createGridClipShape
(
coordSys
,
api
);
polyline
.
setClipPath
(
clipPath
);
dataSymbol
.
updateData
(
data
,
false
);
// In the case data zoom triggerred refreshing frequently
// Data may not change if line has a category axis. So it should animate nothing
...
...
@@ -106,11 +132,12 @@ define(function(require) {
);
}
// Add back
group
.
add
(
this
.
_
polyline
);
group
.
add
(
polyline
);
}
this
.
_data
=
data
;
// Save the coordinate system and data for transition animation when data changed
this
.
_plainDataList
=
plainDataList
;
this
.
_coordSys
=
coordSys
;
},
...
...
@@ -167,34 +194,33 @@ define(function(require) {
}
},
_createGridClipShape
:
function
(
cartesian
,
api
,
cb
)
{
var
xAxis
=
cartesian
.
getAxis
(
'
x
'
);
var
yAxis
=
cartesian
.
getAxis
(
'
y
'
);
var
xExtent
=
xAxis
.
getExtent
();
var
yExtent
=
yAxis
.
getExtent
();
_createGridClipShape
:
function
(
cartesian
,
api
,
animation
,
isHorizontal
)
{
var
xExtent
=
getAxisExtentWithGap
(
cartesian
.
getAxis
(
'
x
'
));
var
yExtent
=
getAxisExtentWithGap
(
cartesian
.
getAxis
(
'
y
'
));
var
clipPath
=
new
api
.
Rect
({
shape
:
{
x
:
xExtent
[
0
],
y
:
yExtent
[
0
],
width
:
0
,
width
:
xExtent
[
1
]
-
xExtent
[
0
]
,
height
:
yExtent
[
1
]
-
yExtent
[
0
]
}
});
clipPath
.
animateTo
({
shape
:
{
x
:
xExtent
[
0
],
y
:
yExtent
[
0
],
width
:
xExtent
[
1
]
-
xExtent
[
0
],
height
:
yExtent
[
1
]
-
yExtent
[
0
]
}
},
1500
,
cb
);
if
(
animation
)
{
clipPath
.
shape
[
isHorizontal
?
'
width
'
:
'
height
'
]
=
0
;
clipPath
.
animateTo
({
shape
:
{
width
:
xExtent
[
1
]
-
xExtent
[
0
],
height
:
yExtent
[
1
]
-
yExtent
[
0
]
}
},
1500
,
animation
);
}
return
clipPath
;
},
_createPolarClipShape
:
function
(
polar
,
api
,
cb
)
{
_createPolarClipShape
:
function
(
polar
,
api
,
animation
)
{
// var angleAxis = polar.getAngleAxis();
var
radiusAxis
=
polar
.
getRadiusAxis
();
...
...
@@ -215,7 +241,7 @@ define(function(require) {
shape
:
{
endAngle
:
Math
.
PI
*
2
}
},
1500
,
cb
);
},
1500
,
animation
);
return
clipPath
;
},
...
...
src/model/globalDefault.js
浏览文件 @
be853cb1
...
...
@@ -62,7 +62,6 @@ define({
'
emptyCircle
'
,
'
emptyRectangle
'
,
'
emptyTriangle
'
,
'
emptyDiamond
'
],
animation
:
true
,
// 过渡动画是否开启
addDataAnimation
:
true
,
// 动态数据接口是否开启动画效果
animationThreshold
:
2000
,
// 动画元素阀值,产生的图形原素超过2000不出动画
animationDuration
:
2000
,
// 过渡动画参数:进入
animationDurationUpdate
:
500
,
// 过渡动画参数:更新
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录