Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
b4e8945b
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,发现更多精彩内容 >>
提交
b4e8945b
编写于
12月 05, 2017
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add data.
上级
bfc138af
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
602 addition
and
290 deletion
+602
-290
src/data/List.js
src/data/List.js
+298
-262
src/data/helper/linkList.js
src/data/helper/linkList.js
+7
-7
src/echarts.js
src/echarts.js
+18
-8
src/model/Series.js
src/model/Series.js
+11
-8
src/stream/Scheduler.js
src/stream/Scheduler.js
+5
-5
test/geo-data-stream.html
test/geo-data-stream.html
+138
-0
test/geo-random-stream.html
test/geo-random-stream.html
+125
-0
未找到文件。
src/data/List.js
浏览文件 @
b4e8945b
此差异已折叠。
点击以展开。
src/data/helper/linkList.js
浏览文件 @
b4e8945b
...
@@ -52,9 +52,9 @@ function linkList(opt) {
...
@@ -52,9 +52,9 @@ function linkList(opt) {
// Only mainData trigger change, because struct.update may trigger
// Only mainData trigger change, because struct.update may trigger
// another changable methods, which may bring about dead lock.
// another changable methods, which may bring about dead lock.
each
(
mainData
.
CHANGABLE_METHODS
,
function
(
methodName
)
{
//
each(mainData.CHANGABLE_METHODS, function (methodName) {
mainData
.
wrapMethod
(
methodName
,
zrUtil
.
curry
(
changeInjection
,
opt
));
//
mainData.wrapMethod(methodName, zrUtil.curry(changeInjection, opt));
});
//
});
// Make sure datas contains mainData.
// Make sure datas contains mainData.
zrUtil
.
assert
(
datas
[
mainData
.
dataType
]
===
mainData
);
zrUtil
.
assert
(
datas
[
mainData
.
dataType
]
===
mainData
);
...
@@ -74,10 +74,10 @@ function transferInjection(opt, res) {
...
@@ -74,10 +74,10 @@ function transferInjection(opt, res) {
return
res
;
return
res
;
}
}
function
changeInjection
(
opt
,
res
)
{
//
function changeInjection(opt, res) {
opt
.
struct
&&
opt
.
struct
.
update
(
this
);
//
opt.struct && opt.struct.update(this);
return
res
;
//
return res;
}
//
}
function
cloneShallowInjection
(
opt
,
res
)
{
function
cloneShallowInjection
(
opt
,
res
)
{
// cloneShallow, which brings about some fragilities, may be inappropriate
// cloneShallow, which brings about some fragilities, may be inappropriate
...
...
src/echarts.js
浏览文件 @
b4e8945b
...
@@ -964,13 +964,17 @@ echartsProto.resize = function (opts) {
...
@@ -964,13 +964,17 @@ echartsProto.resize = function (opts) {
zrUtil
.
assert
(
!
this
[
IN_MAIN_PROCESS
],
'
`resize` should not be called during main process.
'
);
zrUtil
.
assert
(
!
this
[
IN_MAIN_PROCESS
],
'
`resize` should not be called during main process.
'
);
}
}
this
[
IN_MAIN_PROCESS
]
=
true
;
this
.
_zr
.
resize
(
opts
);
this
.
_zr
.
resize
(
opts
);
var
optionChanged
=
this
.
_model
&&
this
.
_model
.
resetOption
(
'
media
'
);
var
optionChanged
=
this
.
_model
&&
this
.
_model
.
resetOption
(
'
media
'
);
var
updateMethod
=
optionChanged
?
'
prepareAndUpdate
'
:
'
update
'
;
var
updateMethod
=
optionChanged
?
'
prepareAndUpdate
'
:
'
update
'
;
refresh
(
updateMethod
,
opts
&&
opts
.
silent
);
};
function
refresh
(
updateMethod
,
silent
)
{
this
[
IN_MAIN_PROCESS
]
=
true
;
updateMethods
[
updateMethod
].
call
(
this
);
updateMethods
[
updateMethod
].
call
(
this
);
// Resize loading effect
// Resize loading effect
...
@@ -978,12 +982,10 @@ echartsProto.resize = function (opts) {
...
@@ -978,12 +982,10 @@ echartsProto.resize = function (opts) {
this
[
IN_MAIN_PROCESS
]
=
false
;
this
[
IN_MAIN_PROCESS
]
=
false
;
var
silent
=
opts
&&
opts
.
silent
;
flushPendingActions
.
call
(
this
,
silent
);
flushPendingActions
.
call
(
this
,
silent
);
triggerUpdatedEvent
.
call
(
this
,
silent
);
triggerUpdatedEvent
.
call
(
this
,
silent
);
}
;
}
/**
/**
* Show loading effect
* Show loading effect
...
@@ -1172,14 +1174,22 @@ function triggerUpdatedEvent(silent) {
...
@@ -1172,14 +1174,22 @@ function triggerUpdatedEvent(silent) {
echartsProto
.
addData
=
function
(
params
)
{
echartsProto
.
addData
=
function
(
params
)
{
var
seriesIndex
=
params
.
seriesIndex
;
var
seriesIndex
=
params
.
seriesIndex
;
var
ecModel
=
this
.
getModel
();
var
ecModel
=
this
.
getModel
();
var
seriesModel
=
ecModel
.
getSeries
(
seriesIndex
);
var
seriesModel
=
ecModel
.
getSeries
ByIndex
(
seriesIndex
);
if
(
__DEV__
)
{
if
(
__DEV__
)
{
zrUtil
.
assert
(
params
.
data
&&
seriesModel
);
zrUtil
.
assert
(
params
.
data
&&
seriesModel
);
}
}
var
rawData
=
seriesModel
.
getRawData
();
var
provider
=
seriesModel
.
getRawData
().
getProvider
();
rawData
.
addData
(
params
.
data
);
// .provisionTask.changeInput(params.data);
provider
.
addData
(
params
.
data
);
this
.
_scheduler
.
unfinished
=
true
;
// ??? Should handle this.
// if (!seriesModel.useStream()) {
// refresh('prepareAndUpdate');
// }
};
};
/**
/**
...
...
src/model/Series.js
浏览文件 @
b4e8945b
...
@@ -325,8 +325,10 @@ var SeriesModel = ComponentModel.extend({
...
@@ -325,8 +325,10 @@ var SeriesModel = ComponentModel.extend({
var
dataCloneTask
=
dataBeforeProcessed
.
createCloneShallowTask
();
var
dataCloneTask
=
dataBeforeProcessed
.
createCloneShallowTask
();
set
(
this
,
'
data
'
,
dataCloneTask
.
output
);
set
(
this
,
'
data
'
,
dataCloneTask
.
output
);
// var provisionTask = dataBeforeProcessed.getProvider().provisionTask;
var
dataInitTask
=
dataBeforeProcessed
.
getInitTask
();
var
dataInitTask
=
dataBeforeProcessed
.
getInitTask
();
// this.pipeTask(provisionTask, 'dataProvide');
this
.
pipeTask
(
dataInitTask
,
'
dataInit
'
);
this
.
pipeTask
(
dataInitTask
,
'
dataInit
'
);
this
.
pipeTask
(
dataCloneTask
,
'
dataClone
'
,
'
updateBase
'
);
this
.
pipeTask
(
dataCloneTask
,
'
dataClone
'
,
'
updateBase
'
);
},
},
...
@@ -362,14 +364,15 @@ var SeriesModel = ComponentModel.extend({
...
@@ -362,14 +364,15 @@ var SeriesModel = ComponentModel.extend({
/**
/**
* @see {module:echarts/stream/Scheduler}
* @see {module:echarts/stream/Scheduler}
*/
*/
pipeTask
:
null
pipeTask
:
null
,
// /**
/**
// * @public
* @public
// */
*/
// useStream: function () {
useStream
:
function
()
{
// return this.streamEnabled && this.option.streamSize > 0;
// ???
// }
return
this
.
streamEnabled
;
}
});
});
zrUtil
.
mixin
(
SeriesModel
,
modelUtil
.
dataFormatMixin
);
zrUtil
.
mixin
(
SeriesModel
,
modelUtil
.
dataFormatMixin
);
...
...
src/stream/Scheduler.js
浏览文件 @
b4e8945b
...
@@ -12,11 +12,11 @@ var inner = makeInner();
...
@@ -12,11 +12,11 @@ var inner = makeInner();
* @const
* @const
*/
*/
var
STAGE
=
{
var
STAGE
=
{
dataInit
:
0
,
dataInit
:
1
,
dataClone
:
1
,
dataClone
:
2
,
processor
:
2
,
processor
:
3
,
visual
:
3
,
visual
:
4
,
render
:
4
render
:
5
};
};
var
TAG
=
{
var
TAG
=
{
updateBase
:
1
,
updateBase
:
1
,
...
...
test/geo-data-stream.html
0 → 100644
浏览文件 @
b4e8945b
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/facePrint.js"
></script>
</head>
<body>
<style>
html
,
body
,
#main
{
width
:
100%
;
height
:
100%
;
margin
:
0
;
}
</style>
<div
id=
"main"
></div>
<script>
var
lngRange
=
[
79.781327
,
131.48
];
var
lngExtent
=
lngRange
[
1
]
-
lngRange
[
0
];
var
latRange
=
[
18.252847
,
52.33
];
var
latExtent
=
latRange
[
1
]
-
latRange
[
0
];
var
chunkMax
=
100
;
var
chunkCount
=
0
;
function
genData
(
count
)
{
var
data
=
[];
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
data
.
push
([
Math
.
random
()
*
lngExtent
+
lngRange
[
0
],
Math
.
random
()
*
latExtent
+
latRange
[
0
],
Math
.
random
()
*
1000
]);
}
return
data
;
}
var
initData
=
genData
(
2001
);
require
([
'
echarts
'
// 'echarts/chart/map',
// 'echarts/chart/scatter',
// 'echarts/component/title',
// 'echarts/component/legend',
// 'echarts/component/geo',
// 'echarts/component/visualMap',
// 'echarts/component/markPoint',
// 'echarts/component/tooltip'
],
function
(
echarts
)
{
require
([
'
map/js/china
'
],
function
()
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
));
chart
.
setOption
({
tooltip
:
{},
legend
:
{
orient
:
'
vertical
'
,
left
:
'
left
'
,
data
:[
'
categoryA
'
,
'
categoryB
'
,
'
categoryC
'
]
},
// visualMap: {
// min: 0,
// max: 1500,
// left: 'left',
// top: 'bottom',
// text: ['High','Low'],
// seriesIndex: [1, 2, 3],
// inRange: {
// color: ['#006edd', '#e0ffff']
// },
// calculable : true
// },
geo
:
{
map
:
'
china
'
,
roam
:
true
,
label
:
{
normal
:
{
show
:
true
,
textStyle
:
{
color
:
'
rgba(0,0,0,0.4)
'
}
}
},
itemStyle
:
{
normal
:{
borderColor
:
'
rgba(0, 0, 0, 0.2)
'
},
emphasis
:{
color
:
null
,
areaColor
:
null
,
shadowOffsetX
:
0
,
shadowOffsetY
:
0
,
shadowBlur
:
20
,
borderWidth
:
0
,
shadowColor
:
'
rgba(0, 0, 0, 0.5)
'
}
}
},
series
:
[{
name
:
'
pm2.5
'
,
type
:
'
streamScatter
'
,
coordinateSystem
:
'
geo
'
,
data
:
initData
,
symbolSize
:
4
,
// symbol: 'rect',
itemStyle
:
{
normal
:
{
// color: '#ddb926'
color
:
'
#dda
'
}
},
progressive
:
100
}]
});
chart
.
on
(
'
click
'
,
function
(
param
)
{
alert
(
'
asdf
'
);
});
next
();
function
next
()
{
if
(
chunkCount
++
<
chunkMax
)
{
var
newData
=
genData
(
1000
);
chart
.
addData
({
seriesIndex
:
0
,
data
:
newData
});
setTimeout
(
next
,
1000
);
}
}
});
});
</script>
</body>
</html>
\ No newline at end of file
test/geo-random-stream.html
0 → 100644
浏览文件 @
b4e8945b
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/facePrint.js"
></script>
</head>
<body>
<style>
html
,
body
,
#main
{
width
:
100%
;
height
:
100%
;
margin
:
0
;
}
</style>
<div
id=
"main"
></div>
<script>
var
lngRange
=
[
79.781327
,
131.48
];
var
lngExtent
=
lngRange
[
1
]
-
lngRange
[
0
];
var
latRange
=
[
18.252847
,
52.33
];
var
latExtent
=
latRange
[
1
]
-
latRange
[
0
];
var
data
=
[];
// var count = 1000000;
// var count = 450000;
var
count
=
100000
;
// var count = 5000;
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
data
.
push
([
Math
.
random
()
*
lngExtent
+
lngRange
[
0
],
Math
.
random
()
*
latExtent
+
latRange
[
0
],
Math
.
random
()
*
1000
]);
}
require
([
'
echarts
'
// 'echarts/chart/map',
// 'echarts/chart/scatter',
// 'echarts/component/title',
// 'echarts/component/legend',
// 'echarts/component/geo',
// 'echarts/component/visualMap',
// 'echarts/component/markPoint',
// 'echarts/component/tooltip'
],
function
(
echarts
)
{
require
([
'
map/js/china
'
],
function
()
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
));
chart
.
setOption
({
tooltip
:
{},
legend
:
{
orient
:
'
vertical
'
,
left
:
'
left
'
,
data
:[
'
categoryA
'
,
'
categoryB
'
,
'
categoryC
'
]
},
// visualMap: {
// min: 0,
// max: 1500,
// left: 'left',
// top: 'bottom',
// text: ['High','Low'],
// seriesIndex: [1, 2, 3],
// inRange: {
// color: ['#006edd', '#e0ffff']
// },
// calculable : true
// },
geo
:
{
map
:
'
china
'
,
roam
:
true
,
label
:
{
normal
:
{
show
:
true
,
textStyle
:
{
color
:
'
rgba(0,0,0,0.4)
'
}
}
},
itemStyle
:
{
normal
:{
borderColor
:
'
rgba(0, 0, 0, 0.2)
'
},
emphasis
:{
color
:
null
,
areaColor
:
null
,
shadowOffsetX
:
0
,
shadowOffsetY
:
0
,
shadowBlur
:
20
,
borderWidth
:
0
,
shadowColor
:
'
rgba(0, 0, 0, 0.5)
'
}
}
},
series
:
[{
name
:
'
pm2.5
'
,
type
:
'
streamScatter
'
,
coordinateSystem
:
'
geo
'
,
data
:
data
,
symbolSize
:
4
,
// symbol: 'rect',
itemStyle
:
{
normal
:
{
// color: '#ddb926'
color
:
'
#dda
'
}
},
progressive
:
100
}]
});
chart
.
on
(
'
click
'
,
function
(
param
)
{
alert
(
'
asdf
'
);
});
});
});
</script>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录