Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
686fdcd7
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,发现更多精彩内容 >>
提交
686fdcd7
编写于
12月 28, 2017
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'next' of
https://github.com/100pah/echarts
into next
上级
cabe036e
009a8a87
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
117 addition
and
77 deletion
+117
-77
src/chart/lines/LinesSeries.js
src/chart/lines/LinesSeries.js
+47
-44
src/chart/radar/RadarView.js
src/chart/radar/RadarView.js
+2
-2
src/data/List.js
src/data/List.js
+67
-30
test/node/scatter-gps.js
test/node/scatter-gps.js
+1
-1
未找到文件。
src/chart/lines/LinesSeries.js
浏览文件 @
686fdcd7
import
{
__DEV__
}
from
'
../../config
'
;
import
SeriesModel
from
'
../../model/Series
'
;
import
List
from
'
../../data/List
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
concatArray
}
from
'
zrender/src/core/util
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
CoordinateSystem
from
'
../../CoordinateSystem
'
;
...
...
@@ -10,33 +10,6 @@ var globalObj = typeof window === 'undefined' ? global : window;
var
Uint32Arr
=
globalObj
.
Uint32Array
||
Array
;
var
Float64Arr
=
globalObj
.
Float64Array
||
Array
;
// Convert [ [{coord: []}, {coord: []}] ]
// to [ { coords: [[]] } ]
function
preprocessOption
(
seriesOpt
)
{
var
data
=
seriesOpt
.
data
;
if
(
data
&&
data
[
0
]
&&
data
[
0
][
0
]
&&
data
[
0
][
0
].
coord
)
{
if
(
__DEV__
)
{
console
.
warn
(
'
Lines data configuration has been changed to
'
+
'
{ coords:[[1,2],[2,3]] }
'
);
}
seriesOpt
.
data
=
zrUtil
.
map
(
data
,
function
(
itemOpt
)
{
var
coords
=
[
itemOpt
[
0
].
coord
,
itemOpt
[
1
].
coord
];
var
target
=
{
coords
:
coords
};
if
(
itemOpt
[
0
].
name
)
{
target
.
fromName
=
itemOpt
[
0
].
name
;
}
if
(
itemOpt
[
1
].
name
)
{
target
.
toName
=
itemOpt
[
1
].
name
;
}
return
zrUtil
.
mergeAll
([
target
,
itemOpt
[
0
],
itemOpt
[
1
]]);
});
}
}
var
LinesSeries
=
SeriesModel
.
extend
({
type
:
'
series.lines
'
,
...
...
@@ -46,20 +19,44 @@ var LinesSeries = SeriesModel.extend({
visualColorAccessPath
:
'
lineStyle.color
'
,
init
:
function
(
option
)
{
// Not using preprocessor because mergeOption may not have series.type
preprocessOption
(
option
);
this
.
_processFlatCoordsArray
(
option
);
var
result
=
this
.
_processFlatCoordsArray
(
option
.
data
);
this
.
_flatCoords
=
result
.
flatCoords
;
this
.
_flatCoordsOffset
=
result
.
flatCoordsOffset
;
if
(
result
.
flatCoords
)
{
option
.
data
=
new
Float32Array
(
result
.
count
);
}
LinesSeries
.
superApply
(
this
,
'
init
'
,
arguments
);
},
mergeOption
:
function
(
option
)
{
preprocessOption
(
option
);
this
.
_processFlatCoordsArray
(
option
);
var
result
=
this
.
_processFlatCoordsArray
(
option
.
data
);
this
.
_flatCoords
=
result
.
flatCoords
;
this
.
_flatCoordsOffset
=
result
.
flatCoordsOffset
;
if
(
result
.
flatCoords
)
{
option
.
data
=
new
Float32Array
(
result
.
count
);
}
LinesSeries
.
superApply
(
this
,
'
mergeOption
'
,
arguments
);
},
appendData
:
function
(
params
)
{
var
result
=
this
.
_processFlatCoordsArray
(
params
.
data
);
if
(
result
.
flatCoords
)
{
if
(
!
this
.
_flatCoords
)
{
this
.
_flatCoords
=
result
.
flatCoords
;
this
.
_flatCoordsOffset
=
result
.
flatCoordsOffset
;
}
else
{
this
.
_flatCoords
=
concatArray
(
this
.
_flatCoords
,
result
.
flatCoords
);
this
.
_flatCoordsOffset
=
concatArray
(
this
.
_flatCoordsOffset
,
result
.
flatCoordsOffset
);
}
params
.
data
=
new
Float32Array
(
result
.
count
);
}
this
.
getRawData
().
appendData
(
params
.
data
);
},
_getCoordsFromItemModel
:
function
(
idx
)
{
var
itemModel
=
this
.
getData
().
getItemModel
(
idx
);
var
coords
=
(
itemModel
.
option
instanceof
Array
)
...
...
@@ -104,8 +101,11 @@ var LinesSeries = SeriesModel.extend({
}
},
_processFlatCoordsArray
:
function
(
option
)
{
var
data
=
option
.
data
;
_processFlatCoordsArray
:
function
(
data
)
{
var
startOffset
=
0
;
if
(
this
.
_flatCoords
)
{
startOffset
=
this
.
_flatCoords
.
length
;
}
// Stored as a typed array. In format
// Points Count(2) | x | y | x | y | Points Count(3) | x | y | x | y | x | y |
if
(
typeof
data
[
0
]
===
'
number
'
)
{
...
...
@@ -120,7 +120,7 @@ var LinesSeries = SeriesModel.extend({
dataCount
++
;
var
count
=
data
[
i
++
];
// Offset
coordsOffsetAndLenStorage
[
offsetCursor
++
]
=
coordsCursor
;
coordsOffsetAndLenStorage
[
offsetCursor
++
]
=
coordsCursor
+
startOffset
;
// Len
coordsOffsetAndLenStorage
[
offsetCursor
++
]
=
count
;
for
(
var
k
=
0
;
k
<
count
;
k
++
)
{
...
...
@@ -137,15 +137,18 @@ var LinesSeries = SeriesModel.extend({
}
}
this
.
_flatCoordsOffset
=
coordsOffsetAndLenStorage
;
this
.
_flatCoords
=
coordsStorage
;
// Fill with zero values.
option
.
data
=
new
Float32Array
(
dataCount
);
}
else
{
this
.
_flatCoordsOffset
=
this
.
_flatCoords
=
null
;
return
{
flatCoordsOffset
:
new
Uint32Array
(
coordsOffsetAndLenStorage
.
buffer
,
0
,
offsetCursor
),
flatCoords
:
coordsStorage
,
count
:
dataCount
};
}
return
{
flatCoordsOffset
:
null
,
flatCoords
:
null
,
count
:
data
.
length
};
},
getInitialData
:
function
(
option
,
ecModel
)
{
...
...
src/chart/radar/RadarView.js
浏览文件 @
686fdcd7
...
...
@@ -148,8 +148,8 @@ export default echarts.extendChartView({
);
polyline
.
hoverStyle
=
itemModel
.
getModel
(
'
emphasis.lineStyle
'
).
getLineStyle
();
var
areaStyleModel
=
itemModel
.
getModel
(
'
areaStyle
.normal
'
);
var
hoverAreaStyleModel
=
itemModel
.
getModel
(
'
areaStyle
.emphasis
'
);
var
areaStyleModel
=
itemModel
.
getModel
(
'
areaStyle
'
);
var
hoverAreaStyleModel
=
itemModel
.
getModel
(
'
areaStyle
'
);
var
polygonIgnore
=
areaStyleModel
.
isEmpty
()
&&
areaStyleModel
.
parentModel
.
isEmpty
();
var
hoverPolygonIgnore
=
hoverAreaStyleModel
.
isEmpty
()
&&
hoverAreaStyleModel
.
parentModel
.
isEmpty
();
...
...
src/data/List.js
浏览文件 @
686fdcd7
...
...
@@ -25,7 +25,12 @@ var dataCtors = {
'
time
'
:
Array
};
var
CtorUint32Array
=
typeof
globalObj
.
Uint32Array
===
UNDEFINED
?
Array
:
globalObj
.
Uint32Array
;
function
getIndicesCtor
(
count
)
{
var
CtorUint32Array
=
typeof
globalObj
.
Uint32Array
===
UNDEFINED
?
Array
:
globalObj
.
Uint32Array
;
var
CtorUint16Array
=
typeof
globalObj
.
Uint16Array
===
UNDEFINED
?
Array
:
globalObj
.
Uint16Array
;
return
count
>
65535
?
CtorUint32Array
:
CtorUint16Array
;
}
function
cloneChunk
(
originalChunk
)
{
var
Ctor
=
originalChunk
.
constructor
;
...
...
@@ -167,7 +172,7 @@ var List = function (dimensions, hostModel) {
else
{
dimensionInfo
=
dimensions
[
i
];
dimensionName
=
dimensionInfo
.
name
;
dimensionInfo
.
type
=
dimensionInfo
.
type
||
'
number
'
;
dimensionInfo
.
type
=
dimensionInfo
.
type
||
'
float
'
;
if
(
!
dimensionInfo
.
coordDim
)
{
dimensionInfo
.
coordDim
=
dimensionName
;
dimensionInfo
.
coordDimIndex
=
0
;
...
...
@@ -547,16 +552,19 @@ listProto._initDataFromProvider = function (start, end) {
* @return {number}
*/
listProto
.
count
=
function
()
{
return
this
.
_
indices
?
this
.
_indices
.
length
:
this
.
_
count
;
return
this
.
_count
;
};
listProto
.
getIndices
=
function
()
{
if
(
this
.
_indices
)
{
return
this
.
_indices
;
var
Ctor
=
this
.
_indices
.
constructor
;
return
new
Ctor
(
this
.
_indices
.
buffer
,
0
,
this
.
_count
);
}
var
arr
=
new
CtorUint32Array
(
this
.
count
());
var
Ctor
=
getIndicesCtor
(
this
.
count
());
var
arr
=
new
Ctor
(
this
.
count
());
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
arr
[
i
]
=
arr
;
arr
[
i
]
=
i
;
}
return
arr
;
};
...
...
@@ -569,6 +577,10 @@ listProto.getIndices = function () {
* @return {number}
*/
listProto
.
get
=
function
(
dim
,
idx
,
stack
)
{
if
(
idx
<
0
||
idx
>=
this
.
_count
)
{
return
NaN
;
}
idx
=
this
.
getRawIndex
(
idx
);
var
storage
=
this
.
_storage
;
...
...
@@ -576,7 +588,7 @@ listProto.get = function (dim, idx, stack) {
var
chunkOffset
=
idx
%
this
.
_chunkSize
;
var
chunkStore
=
storage
[
dim
][
chunkIndex
];
var
value
=
chunkStore
?
chunkStore
[
chunkOffset
]
:
NaN
;
var
value
=
chunkStore
[
chunkOffset
]
;
// FIXME ordinal data type is not stackable
if
(
stack
)
{
var
dimensionInfo
=
this
.
_dimensionInfos
[
dim
];
...
...
@@ -595,6 +607,7 @@ listProto.get = function (dim, idx, stack) {
}
}
}
return
value
;
};
...
...
@@ -649,7 +662,6 @@ listProto.hasValue = function (idx) {
* @param {Function} filter
*/
listProto
.
getDataExtent
=
function
(
dim
,
stack
,
filter
)
{
console
.
time
(
'
getExtent
'
);
// Make sure use concrete dim as cache name.
dim
=
this
.
getDimension
(
dim
);
var
dimData
=
this
.
_storage
[
dim
];
...
...
@@ -711,7 +723,6 @@ listProto.getDataExtent = function (dim, stack, filter) {
}
this
.
_extent
[
cacheName
]
=
dimExtent
;
// console.timeEnd('getExtent');
return
dimExtent
;
};
...
...
@@ -879,13 +890,18 @@ listProto.indicesOfNearest = function (dim, value, stack, maxDistance) {
* @param {number} idx
* @return {number}
*/
listProto
.
getRawIndex
=
function
(
idx
)
{
if
(
!
this
.
_indices
)
{
return
idx
;
listProto
.
getRawIndex
=
getRawIndexWithoutIndices
;
function
getRawIndexWithoutIndices
(
idx
)
{
return
idx
;
}
function
getRawIndexWithIndices
(
idx
)
{
if
(
idx
<
this
.
_count
&&
idx
>=
0
)
{
return
this
.
_indices
[
idx
];
}
var
rawIdx
=
this
.
_indices
[
idx
];
return
rawIdx
==
null
?
-
1
:
rawIdx
;
};
return
-
1
;
}
/**
* Get raw data item
...
...
@@ -992,33 +1008,39 @@ listProto.each = function (dims, cb, stack, context) {
* @param {*} [context=this]
*/
listProto
.
filterSelf
=
function
(
dimensions
,
cb
,
stack
,
context
)
{
'
use strict
'
;
if
(
typeof
dimensions
===
'
function
'
)
{
context
=
stack
;
stack
=
cb
;
cb
=
dimensions
;
dimensions
=
[];
}
stack
=
stack
||
false
;
dimensions
=
zrUtil
.
map
(
normalizeDimensions
(
dimensions
),
this
.
getDimension
,
this
);
var
newIndices
=
[];
var
count
=
this
.
count
();
var
Ctor
=
getIndicesCtor
(
count
);
var
newIndices
=
new
Ctor
(
count
);
var
value
=
[];
var
dimSize
=
dimensions
.
length
;
context
=
context
||
this
;
for
(
var
i
=
0
;
i
<
this
.
count
();
i
++
)
{
var
offset
=
0
;
var
dim0
=
dimensions
[
0
];
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
var
keep
;
// Simple optimization
if
(
!
dimSize
)
{
if
(
dimSize
===
0
)
{
keep
=
cb
.
call
(
context
,
i
);
}
else
if
(
dimSize
===
1
)
{
keep
=
cb
.
call
(
context
,
this
.
get
(
dimensions
[
0
],
i
,
stack
),
i
);
keep
=
cb
.
call
(
context
,
this
.
get
(
dim0
,
i
,
stack
),
i
);
}
else
{
for
(
var
k
=
0
;
k
<
dimSize
;
k
++
)
{
...
...
@@ -1028,15 +1050,20 @@ listProto.filterSelf = function (dimensions, cb, stack, context) {
keep
=
cb
.
apply
(
context
,
value
);
}
if
(
keep
)
{
newIndices
.
push
(
this
.
getRawIndex
(
i
)
);
newIndices
[
offset
++
]
=
this
.
getRawIndex
(
i
);
}
}
this
.
_indices
=
new
Uint32Array
(
newIndices
);
// Set indices after filtered.
if
(
offset
<
count
)
{
this
.
_indices
=
newIndices
;
}
this
.
_count
=
offset
;
// Reset data extent
this
.
_extent
=
{};
this
.
getRawIndex
=
this
.
_indices
?
getRawIndexWithIndices
:
getRawIndexWithoutIndices
;
return
this
;
};
...
...
@@ -1112,6 +1139,7 @@ listProto.map = function (dimensions, cb, stack, context) {
// Following properties are all immutable.
// So we can reference to the same value
list
.
_indices
=
this
.
_indices
;
list
.
getRawIndex
=
list
.
_indices
?
getRawIndexWithIndices
:
getRawIndexWithoutIndices
;
var
storage
=
list
.
_storage
;
...
...
@@ -1152,8 +1180,6 @@ listProto.downSample = function (dimension, rate, sampleValue, sampleIndex) {
var
list
=
cloneListForMapAndSample
(
this
,
[
dimension
]);
var
targetStorage
=
list
.
_storage
;
var
indices
=
list
.
_indices
=
[];
var
frameValues
=
[];
var
frameSize
=
Math
.
floor
(
1
/
rate
);
...
...
@@ -1161,6 +1187,9 @@ listProto.downSample = function (dimension, rate, sampleValue, sampleIndex) {
var
len
=
this
.
count
();
var
chunkSize
=
this
.
_chunkSize
;
var
newIndices
=
new
(
getIndicesCtor
(
len
))(
len
);
var
offset
=
0
;
for
(
var
i
=
0
;
i
<
len
;
i
+=
frameSize
)
{
// Last frame
if
(
frameSize
>
len
-
i
)
{
...
...
@@ -1168,20 +1197,26 @@ listProto.downSample = function (dimension, rate, sampleValue, sampleIndex) {
frameValues
.
length
=
frameSize
;
}
for
(
var
k
=
0
;
k
<
frameSize
;
k
++
)
{
var
dataIdx
=
i
+
k
;
var
dataIdx
=
this
.
getRawIndex
(
i
+
k
)
;
var
originalChunkIndex
=
Math
.
floor
(
dataIdx
/
chunkSize
);
var
originalChunkOffset
=
dataIdx
%
chunkSize
;
frameValues
[
k
]
=
dimStore
[
originalChunkIndex
][
originalChunkOffset
];
}
var
value
=
sampleValue
(
frameValues
);
var
sampleFrameIdx
=
sampleIndex
(
frameValues
,
value
)
||
0
;
var
sampleFrameIdx
=
this
.
getRawIndex
(
i
+
sampleIndex
(
frameValues
,
value
)
||
0
)
;
var
sampleChunkIndex
=
Math
.
floor
(
sampleFrameIdx
/
chunkSize
);
var
sampleChunkOffset
=
sampleFrameIdx
%
chunkSize
;
// Only write value on the filtered data
dimStore
[
sampleChunkIndex
][
sampleChunkOffset
]
=
value
;
indices
.
push
(
sampleFrameIdx
);
newIndices
[
offset
++
]
=
sampleFrameIdx
;
}
list
.
_count
=
offset
;
list
.
_indices
=
newIndices
;
list
.
getRawIndex
=
getRawIndexWithIndices
;
return
list
;
};
...
...
@@ -1427,11 +1462,13 @@ listProto.cloneShallow = function (list) {
// Clone will not change the data extent and indices
if
(
this
.
_indices
)
{
list
.
_indices
=
new
CtorUint32Array
(
this
.
_indices
);
var
Ctor
=
this
.
_indices
.
constructor
;
list
.
_indices
=
new
Ctor
(
this
.
_indices
);
}
else
{
list
.
_indices
=
null
;
}
list
.
getRawIndex
=
list
.
_indices
?
getRawIndexWithIndices
:
getRawIndexWithoutIndices
;
list
.
_extent
=
zrUtil
.
clone
(
this
.
_extent
);
list
.
_approximateExtent
=
zrUtil
.
clone
(
this
.
_approximateExtent
);
...
...
test/node/scatter-gps.js
浏览文件 @
686fdcd7
...
...
@@ -44,7 +44,7 @@ chart.setOption({
type
:
'
scatter
'
,
progressive
:
1
e5
,
coordinateSystem
:
'
geo
'
,
symbolSize
:
1
,
symbolSize
:
0.5
,
blendMode
:
'
lighter
'
,
large
:
true
,
itemStyle
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录