Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
f69b6d76
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,发现更多精彩内容 >>
提交
f69b6d76
编写于
9月 09, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Line symbol animation
上级
59427b38
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
61 addition
and
27 deletion
+61
-27
src/chart/line/LineSeries.js
src/chart/line/LineSeries.js
+1
-1
src/chart/line/LineView.js
src/chart/line/LineView.js
+47
-19
src/chart/line/lineAnimationDiff.js
src/chart/line/lineAnimationDiff.js
+8
-1
src/chart/scatter/ScatterView.js
src/chart/scatter/ScatterView.js
+2
-2
src/component/axis.js
src/component/axis.js
+3
-3
src/component/dataZoom/dataZoomAction.js
src/component/dataZoom/dataZoomAction.js
+0
-1
未找到文件。
src/chart/line/LineSeries.js
浏览文件 @
f69b6d76
...
...
@@ -59,7 +59,7 @@ define(function(require) {
},
// smooth: false,
symbol
:
'
emptyCircle
'
,
// 拐点图形类型
symbolSize
:
2
,
// 拐点图形大小
symbolSize
:
4
,
// 拐点图形大小
// symbolRotate: null, // 拐点图形旋转控制
showAllSymbol
:
false
// 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略)
}
...
...
src/chart/line/LineView.js
浏览文件 @
f69b6d76
...
...
@@ -5,6 +5,7 @@ define(function(require) {
'
use strict
'
;
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
vector
=
require
(
'
zrender/core/vector
'
);
var
DataSymbol
=
require
(
'
../helper/DataSymbol
'
);
var
lineAnimationDiff
=
require
(
'
./lineAnimationDiff
'
);
...
...
@@ -61,6 +62,11 @@ define(function(require) {
points
.
push
(
Array
.
prototype
.
slice
.
call
(
points
[
0
]));
}
// Draw symbols, enable animation on the first draw
var
dataSymbol
=
this
.
_dataSymbol
;
dataSymbol
.
z
=
seriesModel
.
get
(
'
z
'
)
+
1
;
dataSymbol
.
updateData
(
data
,
!
this
.
_data
);
// Initialization animation
if
(
!
this
.
_data
)
{
var
polyline
=
new
api
.
Polyline
({
...
...
@@ -70,7 +76,8 @@ define(function(require) {
style
:
zrUtil
.
extend
(
lineStyleNormalModel
.
getLineStyle
(),
{
stroke
:
seriesModel
.
getVisual
(
'
color
'
)
stroke
:
seriesModel
.
getVisual
(
'
color
'
),
lineJoin
:
'
bevel
'
}
)
});
...
...
@@ -90,32 +97,53 @@ define(function(require) {
else
{
// In the case data zoom triggerred refreshing frequently
// Data may not change if line has a category axis. So it should animate nothing
if
(
!
isPointsSame
(
this
.
_pointsWithName
,
pointsWithName
))
{
var
diff
=
lineAnimationDiff
(
this
.
_pointsWithName
,
pointsWithName
);
this
.
_polyline
.
shape
.
points
=
diff
.
current
;
// FIXME Handle the situation of adding and removing data
this
.
_polyline
.
animateTo
({
shape
:
{
points
:
diff
.
next
}
},
300
,
'
cubicOut
'
);
this
.
_updateAnimation
(
data
,
pointsWithName
);
// Add back
this
.
group
.
add
(
this
.
_polyline
);
}
// Add back
group
.
add
(
this
.
_polyline
);
}
// var dataSymbol = this._dataSymbol;
// dataSymbol.z = seriesModel.get('z') + 1;
// // Draw symbols
// dataSymbol.updateData(data);
this
.
_data
=
data
;
this
.
_pointsWithName
=
pointsWithName
;
},
_animateLine
:
function
(
oldData
,
newData
)
{
_updateAnimation
:
function
(
data
,
pointsWithName
)
{
var
polyline
=
this
.
_polyline
;
var
diff
=
lineAnimationDiff
(
this
.
_pointsWithName
,
pointsWithName
);
polyline
.
shape
.
points
=
diff
.
current
;
// FIXME Handle the situation of adding and removing data
polyline
.
animateTo
({
shape
:
{
points
:
diff
.
next
}
},
300
,
'
cubicOut
'
);
var
updatedDataIndices
=
[];
var
diffStatus
=
diff
.
status
;
var
symbolElements
=
this
.
_dataSymbol
.
getSymbolElements
();
for
(
var
i
=
0
;
i
<
diffStatus
.
length
;
i
++
)
{
if
(
diffStatus
[
i
]
===
'
=
'
)
{
updatedDataIndices
.
push
(
i
);
}
}
if
(
polyline
.
animators
)
{
polyline
.
animators
[
0
].
during
(
function
()
{
// Symbol elements may be more than updatedDataIndices if there is new added data
for
(
var
i
=
0
;
i
<
updatedDataIndices
.
length
;
i
++
)
{
vector
.
copy
(
symbolElements
[
i
].
position
,
// synchronizing whith the point on line
polyline
.
shape
.
points
[
updatedDataIndices
[
i
]]
);
symbolElements
[
i
].
dirty
();
}
});
}
},
_createGridClipShape
:
function
(
cartesian
,
api
,
cb
)
{
...
...
@@ -173,7 +201,7 @@ define(function(require) {
remove
:
function
()
{
this
.
group
.
remove
(
this
.
_polyline
);
this
.
_dataSymbol
.
remove
();
this
.
_dataSymbol
.
remove
(
true
);
}
});
});
\ No newline at end of file
src/chart/line/lineAnimationDiff.js
浏览文件 @
f69b6d76
...
...
@@ -10,6 +10,7 @@ define(function (require) {
var
oldPoints
=
[];
var
newPoints
=
[];
var
status
=
[];
// FIXME One data ?
var
diff
=
arrayDiff
(
oldData
,
newData
,
nameCompare
);
...
...
@@ -20,6 +21,10 @@ define(function (require) {
for
(
var
i
=
0
;
i
<
diffCount
;
i
++
)
{
var
diffItem
=
diff
[
i
];
status
.
push
(
diffItem
.
cmd
);
// FIXME, animation is not so perfect when dataZoom window moves fast
// Which is in case remvoing or add more than one data in the tail or head
switch
(
diffItem
.
cmd
)
{
case
'
=
'
:
oldPoints
.
push
(
oldData
[
diffItem
.
idx
].
point
);
...
...
@@ -53,13 +58,15 @@ define(function (require) {
];
oldPoints
.
push
(
oldData
[
diffItem
.
idx
].
point
);
// oldPoints.push(siblingDataNotRemove.point);
newPoints
.
push
(
siblingDataNotRemove
.
point
);
}
}
return
{
current
:
oldPoints
,
next
:
newPoints
next
:
newPoints
,
status
:
status
};
}
});
\ No newline at end of file
src/chart/scatter/ScatterView.js
浏览文件 @
f69b6d76
...
...
@@ -12,11 +12,11 @@ define(function (require) {
},
render
:
function
(
seriesModel
,
ecModel
,
api
)
{
this
.
_dataSymbol
.
updateData
(
seriesModel
.
getData
());
this
.
_dataSymbol
.
updateData
(
seriesModel
.
getData
()
,
true
);
},
remove
:
function
()
{
this
.
_dataSymbol
.
remove
();
this
.
_dataSymbol
.
remove
(
true
);
}
});
});
\ No newline at end of file
src/component/axis.js
浏览文件 @
f69b6d76
// TODO Split line interval
//
TODO
Axis tick interval
//
TODO
Axis name
//
TODO Axis splitNumber, min, max
//
Axis tick interval
//
Axis name
//
boundaryGap
define
(
function
(
require
)
{
'
use strict
'
;
...
...
src/component/dataZoom/dataZoomAction.js
浏览文件 @
f69b6d76
...
...
@@ -4,7 +4,6 @@
define
(
function
(
require
)
{
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
env
=
require
(
'
zrender/core/env
'
);
var
echarts
=
require
(
'
../../echarts
'
);
var
helper
=
require
(
'
./helper
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录