Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
59427b38
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,发现更多精彩内容 >>
提交
59427b38
编写于
9月 09, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Line animation. clear visual and layout after restore
上级
9436dcf7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
162 addition
and
31 deletion
+162
-31
src/chart/bar/BarView.js
src/chart/bar/BarView.js
+9
-3
src/chart/helper/DataSymbol.js
src/chart/helper/DataSymbol.js
+22
-11
src/chart/line/LineView.js
src/chart/line/LineView.js
+45
-12
src/chart/line/lineAnimationDiff.js
src/chart/line/lineAnimationDiff.js
+65
-0
src/data/List.js
src/data/List.js
+6
-1
src/model/Model.js
src/model/Model.js
+4
-0
src/model/Series.js
src/model/Series.js
+10
-2
src/visual/defaultColor.js
src/visual/defaultColor.js
+1
-2
未找到文件。
src/chart/bar/BarView.js
浏览文件 @
59427b38
...
...
@@ -71,9 +71,15 @@ define(function (require) {
group
.
add
(
el
);
})
.
remove
(
function
(
dataItem
,
idx
)
{
if
(
dataItem
.
__el
)
{
group
.
remove
(
dataItem
.
__el
);
}
var
el
=
dataItem
.
__el
;
el
.
animateTo
({
shape
:
{
width
:
0
}
},
300
,
'
cubicOut
'
,
function
()
{
group
.
remove
(
el
);
});
})
.
execute
();
...
...
src/chart/helper/DataSymbol.js
浏览文件 @
59427b38
...
...
@@ -11,6 +11,11 @@ define(function (require) {
this
.
z
=
0
;
this
.
zlevel
=
0
;
this
.
animation
=
{
easing
:
'
cubicOut
'
,
duration
:
300
}
}
DataSymbol
.
prototype
=
{
...
...
@@ -22,14 +27,15 @@ define(function (require) {
updateData
:
function
(
data
)
{
var
group
=
this
.
group
;
var
animationConfig
=
this
.
animation
;
data
.
diff
(
this
.
_data
)
.
add
(
function
(
dataItem
)
{
// 空数据
// TODO
//
if (dataItem.getValue() == null) {
//
return;
//
}
if
(
dataItem
.
getValue
()
==
null
)
{
return
;
}
var
layout
=
dataItem
.
layout
;
var
color
=
dataItem
.
getVisual
(
'
color
'
);
...
...
@@ -56,14 +62,14 @@ define(function (require) {
// 空数据
// TODO
//
if (newData.getValue() == null) {
// group.remove(oldData.__
el);
//
return;
//
}
if
(
newData
.
getValue
()
==
null
)
{
group
.
remove
(
el
);
return
;
}
el
.
animateTo
({
scale
:
[
symbolSize
,
symbolSize
],
position
:
[
layout
.
x
,
layout
.
y
]
},
500
,
'
cubicOut
'
);
},
animationConfig
.
duration
,
animationConfig
.
easing
);
newData
.
__el
=
el
;
...
...
@@ -71,8 +77,13 @@ define(function (require) {
group
.
add
(
el
);
})
.
remove
(
function
(
dataItem
)
{
if
(
dataItem
.
__el
)
{
group
.
remove
(
dataItem
.
__el
);
var
el
=
dataItem
.
__el
;
if
(
el
)
{
el
.
animateTo
({
scale
:
[
0
,
0
]
},
200
,
'
cubicOut
'
,
function
()
{
group
.
remove
(
el
);
});
}
})
.
execute
();
...
...
@@ -104,7 +115,7 @@ define(function (require) {
el
.
animateTo
({
scale
:
[
0
,
0
]
},
200
,
'
cubicOut
'
,
function
()
{
group
.
remove
(
dataItem
.
__
el
);
group
.
remove
(
el
);
});
});
}
...
...
src/chart/line/LineView.js
浏览文件 @
59427b38
// TODO Area
// TODO Null data
define
(
function
(
require
)
{
'
use strict
'
;
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
DataSymbol
=
require
(
'
../helper/DataSymbol
'
);
var
lineAnimationDiff
=
require
(
'
./lineAnimationDiff
'
);
function
isPointsSame
(
points1
,
points2
)
{
if
(
points1
.
length
!==
points2
.
length
)
{
return
;
}
for
(
var
i
=
0
;
i
<
points1
.
length
;
i
++
)
{
var
p1
=
points1
[
i
].
point
;
var
p2
=
points2
[
i
].
point
;
if
(
p1
[
0
]
!==
p2
[
0
]
||
p1
[
1
]
!==
p2
[
1
])
{
return
;
}
}
return
true
;
}
return
require
(
'
../../echarts
'
).
extendChartView
({
...
...
@@ -25,6 +42,13 @@ define(function(require) {
return
[
layout
.
x
,
layout
.
y
];
}
});
var
pointsWithName
=
data
.
map
(
function
(
dataItem
,
idx
)
{
return
{
name
:
dataItem
.
name
,
point
:
points
[
idx
]
};
});
var
coordinateSystem
=
seriesModel
.
coordinateSystem
;
var
isCoordinateSystemPolar
=
coordinateSystem
.
type
===
'
polar
'
;
...
...
@@ -64,25 +88,34 @@ define(function(require) {
this
.
_polyline
=
polyline
;
}
else
{
// FIXME Handle the situation of adding and removing data
this
.
_polyline
.
animateTo
({
shape
:
{
points
:
points
}
},
500
,
'
cubicOut
'
);
// this._polyline.shape.points = points;
// this._polyline.dirty(true);
// 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
'
);
}
// Add back
group
.
add
(
this
.
_polyline
);
}
var
dataSymbol
=
this
.
_dataSymbol
;
dataSymbol
.
z
=
seriesModel
.
get
(
'
z
'
)
+
1
;
// Draw symbols
dataSymbol
.
updateData
(
data
);
//
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
)
{
},
_createGridClipShape
:
function
(
cartesian
,
api
,
cb
)
{
...
...
src/chart/line/lineAnimationDiff.js
0 → 100644
浏览文件 @
59427b38
define
(
function
(
require
)
{
var
arrayDiff
=
require
(
'
zrender/core/arrayDiff
'
);
function
nameCompare
(
a
,
b
)
{
return
a
.
name
===
b
.
name
;
}
return
function
(
oldData
,
newData
)
{
var
oldPoints
=
[];
var
newPoints
=
[];
// FIXME One data ?
var
diff
=
arrayDiff
(
oldData
,
newData
,
nameCompare
);
var
prevDiffNotRemove
;
var
diffCount
=
diff
.
length
;
for
(
var
i
=
0
;
i
<
diffCount
;
i
++
)
{
var
diffItem
=
diff
[
i
];
switch
(
diffItem
.
cmd
)
{
case
'
=
'
:
oldPoints
.
push
(
oldData
[
diffItem
.
idx
].
point
);
newPoints
.
push
(
newData
[
diffItem
.
idx1
].
point
);
prevDiffNotRemove
=
diffItem
;
break
;
case
'
+
'
:
// Like growing from sibling data animation
// var siblingData = newData[diffItem.idx + 1] || newData[diffItem.idx - 1];
// Keep static
oldPoints
.
push
(
newData
[
diffItem
.
idx
].
point
);
newPoints
.
push
(
newData
[
diffItem
.
idx
].
point
);
prevDiffNotRemove
=
diffItem
;
break
;
case
'
-
'
:
// Like merging into sibling data animation
var
siblingDiffNotRemove
=
prevDiffNotRemove
;
if
(
!
siblingDiffNotRemove
)
{
// If first element is removing, Find next diff which is not removing
for
(
var
k
=
i
+
1
;
k
<
diffCount
;
k
++
)
{
if
(
diff
[
k
].
cmd
!==
'
-
'
)
{
siblingDiffNotRemove
=
diff
[
k
];
break
;
}
}
}
var
siblingDataNotRemove
=
newData
[
siblingDiffNotRemove
.
cmd
===
'
+
'
?
siblingDiffNotRemove
.
idx
:
siblingDiffNotRemove
.
idx1
];
oldPoints
.
push
(
oldData
[
diffItem
.
idx
].
point
);
newPoints
.
push
(
siblingDataNotRemove
.
point
);
}
}
return
{
current
:
oldPoints
,
next
:
newPoints
};
}
});
\ No newline at end of file
src/data/List.js
浏览文件 @
59427b38
...
...
@@ -332,9 +332,14 @@ define(function(require) {
// FIXME
// All list have the same entries may have problem
// When processor modify the data besides data index
// Reset data index
for
(
var
i
=
0
;
i
<
list
.
elements
.
length
;
i
++
)
{
list
.
elements
[
i
].
setDataIndex
(
i
);
var
el
=
list
.
elements
[
i
];
// Reset
el
.
setDataIndex
(
i
);
el
.
clearVisual
();
el
.
layout
=
null
;
}
return
list
;
}
...
...
src/model/Model.js
浏览文件 @
59427b38
...
...
@@ -121,6 +121,10 @@ define(function (require) {
this
.
_visual
[
key
]
=
val
;
},
clearVisual
:
function
()
{
this
.
_visual
=
null
;
},
restoreData
:
function
()
{},
// Pending
...
...
src/model/Series.js
浏览文件 @
59427b38
...
...
@@ -60,7 +60,11 @@ define(function(require) {
},
mergeOption
:
function
(
newSeriesOption
,
ecModel
)
{
this
.
_data
=
this
.
getInitialData
(
newSeriesOption
,
ecModel
);
var
data
=
this
.
getInitialData
(
newSeriesOption
,
ecModel
);
// TODO Merge data?
if
(
data
)
{
this
.
_data
=
data
;
}
},
/**
...
...
@@ -73,8 +77,12 @@ define(function(require) {
return
this
.
_data
;
},
// PENDING Clear visual and layout ?
restoreData
:
function
()
{
// PENDING
// Legend may have wrong symbol if visual is cleared
// this.clearVisual();
this
.
_data
=
this
.
_dataBeforeProcessing
.
cloneShallow
();
}
});
...
...
src/visual/defaultColor.js
浏览文件 @
59427b38
...
...
@@ -4,8 +4,7 @@ define(function (require) {
ecModel
.
eachSeries
(
function
(
seriesModel
)
{
var
colorList
=
ecModel
.
get
(
'
color
'
);
seriesModel
.
setVisual
(
'
color
'
,
seriesModel
.
get
(
'
itemStyle.normal.color
'
)
||
colorList
[
seriesModel
.
seriesIndex
]
'
color
'
,
colorList
[
seriesModel
.
seriesIndex
]
);
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录