Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
f9bbe5df
I
incubator-echarts
项目概览
missman
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
f9bbe5df
编写于
10月 18, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize symbol create in line
上级
eec38cd1
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
213 addition
and
22 deletion
+213
-22
src/chart/helper/DataSymbol.js
src/chart/helper/DataSymbol.js
+29
-11
src/chart/line/LineView.js
src/chart/line/LineView.js
+17
-9
src/chart/scatter/ScatterSeries.js
src/chart/scatter/ScatterSeries.js
+1
-1
src/data/List.js
src/data/List.js
+3
-1
test/area2.html
test/area2.html
+163
-0
未找到文件。
src/chart/helper/DataSymbol.js
浏览文件 @
f9bbe5df
...
...
@@ -40,7 +40,9 @@ define(function (require) {
symbolType
,
x
,
y
,
w
,
h
,
color
);
symbolEl
.
position
=
point
;
var
symbolElPos
=
symbolEl
.
position
;
symbolElPos
[
0
]
=
point
[
0
];
symbolElPos
[
1
]
=
point
[
1
];
symbolEl
.
z2
=
100
;
...
...
@@ -69,7 +71,15 @@ define(function (require) {
return
this
.
_data
;
},
updateData
:
function
(
data
,
seriesModel
,
enableAnimation
)
{
/**
* @param {module:echarts/data/List} data
* @param {module:echarts/model/Series} seriesModel
* @param {boolean} enableAnimation
* @param {Array.<boolean>} [ignoreMap]
*/
updateData
:
function
(
data
,
seriesModel
,
enableAnimation
,
ignoreMap
)
{
var
group
=
this
.
group
;
var
oldData
=
this
.
_data
;
...
...
@@ -82,20 +92,24 @@ define(function (require) {
return
;
}
var
symbolEl
=
createSymbol
(
data
,
newIdx
,
enableAnimation
);
if
(
!
(
ignoreMap
&&
ignoreMap
[
newIdx
]))
{
var
symbolEl
=
createSymbol
(
data
,
newIdx
,
enableAnimation
);
if
(
symbolEl
)
{
data
.
setItemGraphicEl
(
newIdx
,
symbolEl
);
if
(
symbolEl
)
{
data
.
setItemGraphicEl
(
newIdx
,
symbolEl
);
group
.
add
(
symbolEl
);
group
.
add
(
symbolEl
);
}
}
})
.
update
(
function
(
newIdx
,
oldIdx
)
{
var
el
=
oldData
.
getItemGraphicEl
(
oldIdx
);
// Empty data
if
(
!
data
.
hasValue
(
newIdx
))
{
if
(
!
data
.
hasValue
(
newIdx
)
||
(
ignoreMap
&&
ignoreMap
[
newIdx
])
)
{
group
.
remove
(
el
);
return
;
}
...
...
@@ -107,7 +121,10 @@ define(function (require) {
var
symbolType
=
data
.
getItemVisual
(
newIdx
,
'
symbol
'
);
// Symbol changed
if
(
oldData
.
getItemVisual
(
oldIdx
,
'
symbol
'
)
!==
symbolType
)
{
if
(
oldData
.
getItemVisual
(
oldIdx
,
'
symbol
'
)
!==
symbolType
||
(
!
el
&&
!
(
ignoreMap
&&
ignoreMap
[
newIdx
]))
)
{
// Remove the old one
el
&&
group
.
remove
(
el
);
el
=
createSymbol
(
data
,
newIdx
,
enableAnimation
);
...
...
@@ -138,7 +155,7 @@ define(function (require) {
el
.
setColor
(
newColor
);
// TODO Merge animateTo and attr methods into one
newTarget
.
position
=
point
.
slice
()
;
newTarget
.
position
=
point
;
if
(
!
isAroundEqual
(
el
.
scale
[
0
],
1
))
{
// May have scale 0
newTarget
.
scale
=
[
1
,
1
];
}
...
...
@@ -146,6 +163,7 @@ define(function (require) {
el
.
animateTo
(
newTarget
,
300
,
'
cubicOut
'
);
}
else
{
newTarget
.
position
=
point
.
slice
();
// May still have animation. Must stop
el
.
stopAnimation
();
el
.
attr
(
newTarget
);
...
...
src/chart/line/LineView.js
浏览文件 @
f9bbe5df
...
...
@@ -109,13 +109,19 @@ define(function(require) {
var
isAreaChart
=
!
areaStyleModel
.
isEmpty
();
var
stackedOnPoints
=
getStackedOnPoints
(
coordSys
,
data
);
var
symbolIgnoreMap
=
!
isCoordSysPolar
&&
!
seriesModel
.
get
(
'
showAllSymbol
'
)
&&
this
.
_getSymbolIgnored
(
data
,
coordSys
);
// Initialization animation or coordinate system changed
if
(
!
(
polyline
&&
prevCoordSys
.
type
===
coordSys
.
type
&&
hasAnimation
)
)
{
dataSymbol
.
updateData
(
data
,
seriesModel
,
hasAnimation
);
dataSymbol
.
updateData
(
data
,
seriesModel
,
hasAnimation
,
symbolIgnoreMap
);
polyline
=
this
.
_newPolyline
(
group
,
points
,
coordSys
,
hasAnimation
);
if
(
isAreaChart
)
{
...
...
@@ -128,7 +134,9 @@ define(function(require) {
}
else
{
dataSymbol
.
updateData
(
data
,
seriesModel
,
false
);
dataSymbol
.
updateData
(
data
,
seriesModel
,
false
,
symbolIgnoreMap
);
// Update clipPath
// FIXME Clip path used by more than one elements
...
...
@@ -194,9 +202,6 @@ define(function(require) {
this
.
_coordSys
=
coordSys
;
this
.
_stackedOnPoints
=
stackedOnPoints
;
this
.
_points
=
points
;
!
isCoordSysPolar
&&
!
seriesModel
.
get
(
'
showAllSymbol
'
)
&&
this
.
_updateSymbolDisplay
(
data
,
coordSys
);
},
/**
...
...
@@ -265,17 +270,20 @@ define(function(require) {
/**
* @private
*/
_updateSymbolDisplay
:
function
(
data
,
coordSys
)
{
var
categoryAxis
=
coordSys
.
getAxesByScale
(
'
ordinal
'
)[
0
]
_getSymbolIgnored
:
function
(
data
,
coordSys
)
{
var
categoryAxis
=
coordSys
.
getAxesByScale
(
'
ordinal
'
)[
0
];
var
ignoreMap
;
// `getLabelInterval` is provided by echarts/component/axis
if
(
categoryAxis
&&
categoryAxis
.
getLabelInterval
)
{
ignoreMap
=
[];
var
labelInterval
=
categoryAxis
.
getLabelInterval
();
data
.
each
ItemGraphicEl
(
function
(
el
,
idx
)
{
el
.
ignore
=
(
typeof
labelInterval
===
'
function
'
)
data
.
each
(
function
(
idx
)
{
ignoreMap
[
idx
]
=
(
typeof
labelInterval
===
'
function
'
)
&&
!
labelInterval
(
idx
,
categoryAxis
.
scale
.
getItem
(
idx
))
||
idx
%
(
labelInterval
+
1
);
});
}
return
ignoreMap
;
},
/**
...
...
src/chart/scatter/ScatterSeries.js
浏览文件 @
f9bbe5df
...
...
@@ -15,7 +15,7 @@ define(function (require) {
var
list
=
createListFromArray
(
option
.
data
,
this
,
ecModel
);
// Not holding the data anymore so it can be removed in momory
// PENDING
option
.
data
=
null
;
//
option.data = null;
return
list
;
},
...
...
src/data/List.js
浏览文件 @
f9bbe5df
...
...
@@ -197,7 +197,9 @@ define(function (require) {
var
value1D
=
dimensions
.
length
===
1
;
// Use the first data to indicate data type;
var
isValueArray
=
zrUtil
.
isArray
(
data
[
0
].
value
==
null
?
data
[
0
]
:
data
[
0
].
value
);
var
isValueArray
=
data
[
0
]
!=
null
&&
zrUtil
.
isArray
(
data
[
0
].
value
==
null
?
data
[
0
]
:
data
[
0
].
value
);
for
(
var
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
var
value
=
data
[
idx
];
// Each data item contains value and option
...
...
test/area2.html
0 → 100644
浏览文件 @
f9bbe5df
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录