Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
9be4c409
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
9be4c409
编写于
12月 29, 2017
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'next' of
https://github.com/100pah/echarts
into next
上级
1ac815ae
c4594cca
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
25 deletion
+28
-25
src/data/List.js
src/data/List.js
+28
-25
未找到文件。
src/data/List.js
浏览文件 @
9be4c409
...
...
@@ -611,6 +611,15 @@ listProto.get = function (dim, idx, stack) {
return
value
;
};
// FIXME Use `get` on chrome maybe slow(in filterSelf and selectRange).
// Hack a much simpler _getFast
listProto
.
_getFast
=
function
(
dim
,
rawIdx
)
{
var
chunkIndex
=
Math
.
floor
(
rawIdx
/
this
.
_chunkSize
);
var
chunkOffset
=
rawIdx
%
this
.
_chunkSize
;
var
chunkStore
=
this
.
_storage
[
dim
][
chunkIndex
];
return
chunkStore
[
chunkOffset
];
};
/**
* Get value for multi dimensions.
* @param {Array.<string>} [dimensions] If ignored, using all dimensions.
...
...
@@ -1035,22 +1044,24 @@ listProto.filterSelf = function (dimensions, cb, stack, context) {
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
var
keep
;
var
rawIdx
=
this
.
getRawIndex
(
i
);
// Simple optimization
if
(
dimSize
===
0
)
{
keep
=
cb
.
call
(
context
,
i
);
}
else
if
(
dimSize
===
1
)
{
keep
=
cb
.
call
(
context
,
this
.
get
(
dim0
,
i
,
stack
),
i
);
var
val
=
stack
?
this
.
get
(
dim0
,
i
,
true
)
:
this
.
_getFast
(
dim0
,
rawIdx
);
keep
=
cb
.
call
(
context
,
val
,
i
);
}
else
{
for
(
var
k
=
0
;
k
<
dimSize
;
k
++
)
{
value
[
k
]
=
this
.
get
(
dimensions
[
k
],
i
,
stack
);
value
[
k
]
=
stack
?
this
.
get
(
dimensions
[
k
],
i
,
true
)
:
this
.
_getFast
(
dim0
,
rawIdx
);
}
value
[
k
]
=
i
;
keep
=
cb
.
apply
(
context
,
value
);
}
if
(
keep
)
{
newIndices
[
offset
++
]
=
this
.
getRawIndex
(
i
)
;
newIndices
[
offset
++
]
=
rawIdx
;
}
}
...
...
@@ -1086,9 +1097,9 @@ listProto.selectRange = function (range, stack) {
return
;
}
var
c
ount
=
this
.
count
();
var
Ctor
=
getIndicesCtor
(
c
ount
);
var
newIndices
=
new
Ctor
(
c
ount
);
var
originalC
ount
=
this
.
count
();
var
Ctor
=
getIndicesCtor
(
originalC
ount
);
var
newIndices
=
new
Ctor
(
originalC
ount
);
var
offset
=
0
;
var
dim0
=
dimensions
[
0
];
...
...
@@ -1096,20 +1107,9 @@ listProto.selectRange = function (range, stack) {
if
(
dimSize
===
1
)
{
var
min
=
range
[
dim0
][
0
];
var
max
=
range
[
dim0
][
1
];
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
var
val
;
for
(
var
i
=
0
;
i
<
originalCount
;
i
++
)
{
var
rawIndex
=
this
.
getRawIndex
(
i
);
if
(
stack
)
{
val
=
this
.
get
(
dim
,
i
,
true
);
}
else
{
var
storage
=
this
.
_storage
;
var
chunkIndex
=
Math
.
floor
(
i
/
this
.
_chunkSize
);
var
chunkOffset
=
i
%
this
.
_chunkSize
;
var
chunkStore
=
storage
[
dim
][
chunkIndex
];
var
val
=
chunkStore
[
chunkOffset
];
}
var
val
=
stack
?
this
.
get
(
dim0
,
i
,
true
)
:
this
.
_getFast
(
dim0
,
rawIndex
);
if
(
val
>=
min
&&
val
<=
max
)
{
newIndices
[
offset
++
]
=
rawIndex
;
...
...
@@ -1117,12 +1117,13 @@ listProto.selectRange = function (range, stack) {
}
}
else
{
for
(
var
i
=
0
;
i
<
c
ount
;
i
++
)
{
for
(
var
i
=
0
;
i
<
originalC
ount
;
i
++
)
{
var
keep
=
true
;
var
rawIndex
=
this
.
getRawIndex
(
i
);
for
(
var
k
=
0
;
k
<
dimSize
;
k
++
)
{
var
dim
Name
=
dimensions
[
k
];
var
val
=
this
.
get
(
dimName
,
i
,
stack
);
if
(
val
<
range
[
dim
Name
][
0
]
||
val
>
range
[
dimName
][
1
])
{
var
dim
k
=
dimensions
[
k
];
var
val
=
stack
?
this
.
get
(
dimk
,
i
,
true
)
:
this
.
_getFast
(
dim
,
rawIndex
);
if
(
val
<
range
[
dim
k
][
0
]
||
val
>
range
[
dimk
][
1
])
{
keep
=
false
;
}
}
...
...
@@ -1133,7 +1134,7 @@ listProto.selectRange = function (range, stack) {
}
// Set indices after filtered.
if
(
offset
<
c
ount
)
{
if
(
offset
<
originalC
ount
)
{
this
.
_indices
=
newIndices
;
}
this
.
_count
=
offset
;
...
...
@@ -1281,7 +1282,9 @@ listProto.downSample = function (dimension, rate, sampleValue, sampleIndex) {
frameValues
[
k
]
=
dimStore
[
originalChunkIndex
][
originalChunkOffset
];
}
var
value
=
sampleValue
(
frameValues
);
var
sampleFrameIdx
=
this
.
getRawIndex
(
i
+
sampleIndex
(
frameValues
,
value
)
||
0
);
var
sampleFrameIdx
=
this
.
getRawIndex
(
Math
.
min
(
i
+
sampleIndex
(
frameValues
,
value
)
||
0
,
len
-
1
)
);
var
sampleChunkIndex
=
Math
.
floor
(
sampleFrameIdx
/
chunkSize
);
var
sampleChunkOffset
=
sampleFrameIdx
%
chunkSize
;
// Only write value on the filtered data
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录