Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
dd720677
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,体验更适合开发者的 AI 搜索 >>
提交
dd720677
编写于
12月 26, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
option manager tweak
上级
be0db8c8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
43 deletion
+37
-43
src/echarts.js
src/echarts.js
+2
-2
src/model/Global.js
src/model/Global.js
+3
-3
src/model/OptionManager.js
src/model/OptionManager.js
+32
-38
未找到文件。
src/echarts.js
浏览文件 @
dd720677
...
...
@@ -159,10 +159,10 @@ define(function (require) {
echartsProto
.
setOption
=
function
(
option
,
notMerge
,
notRefreshImmediately
)
{
if
(
!
this
.
_model
||
notMerge
)
{
this
.
_model
=
new
GlobalModel
(
null
,
null
,
this
.
_theme
,
optionPreprocessorFuncs
);
this
.
_model
=
new
GlobalModel
(
null
,
null
,
this
.
_theme
);
}
this
.
_model
.
setOption
(
option
);
this
.
_model
.
setOption
(
option
,
optionPreprocessorFuncs
);
updateMethods
.
prepareAndUpdate
.
call
(
this
);
...
...
src/model/Global.js
浏览文件 @
dd720677
...
...
@@ -32,7 +32,7 @@ define(function (require) {
constructor
:
GlobalModel
,
init
:
function
(
option
,
parentModel
,
theme
,
optionPreprocessorFuncs
)
{
init
:
function
(
option
,
parentModel
,
theme
)
{
theme
=
theme
||
{};
this
.
option
=
null
;
// Mark as not initialized.
...
...
@@ -46,10 +46,10 @@ define(function (require) {
/**
* @type {module:echarts/model/OptionManager}
*/
this
.
_optionManager
=
new
OptionManager
(
optionPreprocessorFuncs
);
this
.
_optionManager
=
new
OptionManager
();
},
setOption
:
function
(
option
)
{
setOption
:
function
(
option
,
optionPreprocessorFuncs
)
{
var
optionManager
=
this
.
_optionManager
;
var
baseOption
=
optionManager
.
setOption
(
option
);
...
...
src/model/OptionManager.js
浏览文件 @
dd720677
...
...
@@ -8,6 +8,7 @@ define(function (require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
each
=
zrUtil
.
each
;
var
clone
=
zrUtil
.
clone
;
/**
* TERM EXPLANATIONS:
...
...
@@ -62,10 +63,8 @@ define(function (require) {
* };
*
* @alias module:echarts/model/OptionManager
*
* @param {Array.<Function>} optionPreprocessorFuncs
*/
function
OptionManager
(
optionPreprocessorFuncs
)
{
function
OptionManager
()
{
/**
* @private
...
...
@@ -89,15 +88,18 @@ define(function (require) {
* @private
* @type {Object}
*/
this
.
_rawOptionBackup
;
/**
* @private
* @type {Array.<Function>}
*/
this
.
_optionPreprocessorFuncs
=
optionPreprocessorFuncs
;
this
.
_optionBackup
;
}
// timeline.notMerge is not supported in ec3. Firstly there is rearly
// case that notMerge is needed. Secondly supporting 'notMerge' requires
// rawOption cloned and backuped when timeline changed, which does no
// good to performance. What's more, that both timeline and setOption
// method supply 'notMerge' brings complex and some problems.
// Consider this case:
// (step1) chart.setOption({timeline: {notMerge: false}, ...}, false);
// (step2) chart.setOption({timeline: {notMerge: true}, ...}, false);
OptionManager
.
prototype
=
{
constructor
:
OptionManager
,
...
...
@@ -106,17 +108,20 @@ define(function (require) {
* @public
* @param {Object} rawOption Raw option.
* @param {module:echarts/model/Global} ecModel
* @param {Array.<Function>} optionPreprocessorFuncs
* @return {Object} Init option
*/
setOption
:
function
(
rawOption
)
{
rawOption
=
zrUtil
.
clone
(
rawOption
,
true
);
this
.
_rawOptionBackup
=
shadowClone
(
rawOption
);
setOption
:
function
(
rawOption
,
optionPreprocessorFuncs
)
{
rawOption
=
clone
(
rawOption
,
true
);
// FIXME
// 如果 timeline options 或者 media 中设置了某个属性,而base中没有设置,则进行警告。
return
settleRawOption
.
call
(
this
,
rawOption
,
this
.
_optionPreprocessorFuncs
);
this
.
_optionBackup
=
parseRawOption
.
call
(
this
,
rawOption
,
optionPreprocessorFuncs
);
return
this
.
resetOption
();
},
/**
...
...
@@ -132,7 +137,7 @@ define(function (require) {
// so we can get currentIndex from timelineModel.
var
timelineModel
=
ecModel
.
getComponent
(
'
timeline
'
);
if
(
timelineModel
)
{
option
=
zrUtil
.
clone
(
option
=
clone
(
timelineOptions
[
timelineModel
.
getCurrentIndex
()],
true
);
...
...
@@ -143,16 +148,21 @@ define(function (require) {
},
/**
* @param {module:echarts/model/Global} ecModel
* @return {Object}
*/
resetOption
:
function
(
optionPreprocessorFuncs
)
{
var
rawOption
=
shadowClone
(
this
.
_rawOptionBackup
);
return
settleRawOption
.
call
(
this
,
rawOption
,
this
.
_optionPreprocessorFuncs
);
resetOption
:
function
()
{
var
optionBackup
=
this
.
_optionBackup
;
// FIXME
// 如果没有reset功能则不clone。
this
.
_timelineOptions
=
zrUtil
.
map
(
optionBackup
.
timelineOptions
,
clone
);
return
clone
(
optionBackup
.
baseOption
);
}
};
function
settl
eRawOption
(
rawOption
,
optionPreprocessorFuncs
)
{
function
pars
eRawOption
(
rawOption
,
optionPreprocessorFuncs
)
{
var
timelineOptions
=
[];
var
mediaList
=
[];
var
timelineOpt
=
rawOption
.
timeline
;
...
...
@@ -189,18 +199,7 @@ define(function (require) {
});
});
this
.
_timelineOptions
=
timelineOptions
;
// timeline.notMerge is not supported in ec3. Firstly there is rearly
// case that notMerge is needed. Secondly supporting 'notMerge' requires
// rawOption cloned and backuped when timeline changed, which does no
// good to performance. What's more, that both timeline and setOption
// method supply 'notMerge' brings complex and some problems.
// Consider this case:
// (step1) chart.setOption({timeline: {notMerge: false}, ...}, false);
// (step2) chart.setOption({timeline: {notMerge: true}, ...}, false);
return
baseOption
;
return
{
baseOption
:
baseOption
,
timelineOptions
:
timelineOptions
};
}
function
applyMedia
(
ecModel
,
api
)
{
...
...
@@ -213,10 +212,5 @@ define(function (require) {
return
result
;
}
function
shadowClone
(
rawOption
)
{
// FIXME
return
zrUtil
.
clone
(
rawOption
,
true
);
}
return
OptionManager
;
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录