Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
20af1711
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,发现更多精彩内容 >>
提交
20af1711
编写于
11月 20, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweak
上级
d8a63c3f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
90 deletion
+50
-90
src/echarts.js
src/echarts.js
+50
-90
未找到文件。
src/echarts.js
浏览文件 @
20af1711
...
...
@@ -151,15 +151,21 @@ define(function (require) {
ecModel
.
mergeOption
(
option
);
}
this
.
_prepare
Components
(
ecModel
);
this
.
_prepare
View
(
'
component
'
,
ecModel
);
this
.
_prepare
Charts
(
ecModel
);
this
.
_prepare
View
(
'
chart
'
,
ecModel
);
this
.
_update
();
!
notRefreshImmediately
&&
this
.
_zr
.
refreshImmediately
();
};
/**
* @DEPRECATED
*/
echartsProto
.
setTheme
=
function
()
{
console
.
log
(
'
ECharts#setTheme() is DEPRECATED in ECharts 3.0
'
);
};
/**
* @return {module:echarts/model/Global}
*/
...
...
@@ -368,114 +374,68 @@ define(function (require) {
};
/**
* Prepare
charts view instance
s
* Prepare
view instances of charts and component
s
* @param {module:echarts/model/Global} ecModel
* @private
*/
echartsProto
.
_prepare
Charts
=
function
(
ecModel
)
{
var
chartsList
=
this
.
_chartsList
;
var
chartsMap
=
this
.
_chartsMap
;
echartsProto
.
_prepare
View
=
function
(
type
,
ecModel
)
{
var
isComponent
=
type
===
'
component
'
;
var
viewList
=
isComponent
?
this
.
_componentsList
:
this
.
_chartsList
;
var
viewMap
=
isComponent
?
this
.
_componentsMap
:
this
.
_chartsMap
;
var
zr
=
this
.
_zr
;
for
(
var
i
=
0
;
i
<
charts
List
.
length
;
i
++
)
{
charts
List
[
i
].
__keepAlive
=
false
;
for
(
var
i
=
0
;
i
<
view
List
.
length
;
i
++
)
{
view
List
[
i
].
__keepAlive
=
false
;
}
ecModel
.
eachSeries
(
function
(
seriesModel
,
idx
)
{
var
id
=
seriesModel
.
getId
();
var
chart
=
chartsMap
[
id
];
if
(
!
chart
)
{
var
Clazz
=
ChartView
.
getClass
(
ComponentModel
.
parseClassType
(
seriesModel
.
type
).
sub
);
if
(
Clazz
)
{
chart
=
new
Clazz
();
chart
.
init
(
ecModel
,
this
.
_api
);
chartsMap
[
id
]
=
chart
;
chartsList
.
push
(
chart
);
zr
.
add
(
chart
.
group
);
}
else
{
// Error
ecModel
[
isComponent
?
'
eachComponent
'
:
'
eachSeries
'
](
function
(
componentType
,
model
)
{
if
(
isComponent
)
{
if
(
componentType
===
'
series
'
)
{
return
;
}
}
chart
.
__keepAlive
=
true
;
chart
.
__id
=
id
;
},
this
);
for
(
var
i
=
0
;
i
<
chartsList
.
length
;)
{
var
chart
=
chartsList
[
i
];
if
(
!
chart
.
__keepAlive
)
{
zr
.
remove
(
chart
.
group
);
chart
.
dispose
(
this
.
_api
);
chartsList
.
splice
(
i
,
1
);
delete
chartsMap
[
chart
.
__id
];
}
else
{
i
++
;
}
}
};
/**
* Prepare component view instances
* @param {module:echarts/model/Global} ecModel
* @private
*/
echartsProto
.
_prepareComponents
=
function
(
ecModel
)
{
var
componentsMap
=
this
.
_componentsMap
;
var
componentsList
=
this
.
_componentsList
;
for
(
var
i
=
0
;
i
<
componentsList
.
length
;
i
++
)
{
componentsList
[
i
].
__keepAlive
=
true
;
}
ecModel
.
eachComponent
(
function
(
componentType
,
componentModel
)
{
if
(
componentType
===
'
series
'
)
{
return
;
model
=
componentType
;
}
var
id
=
componentModel
.
getId
();
var
component
=
componentsMap
[
id
];
if
(
!
component
)
{
// Create and add component
var
Clazz
=
ComponentView
.
getClass
(
componentType
,
componentModel
.
option
.
type
);
var
id
=
model
.
getId
();
var
view
=
viewMap
[
id
];
if
(
!
view
)
{
var
classType
=
ComponentModel
.
parseClassType
(
model
.
type
);
var
Clazz
=
isComponent
?
ComponentView
.
getClass
(
classType
.
main
,
classType
)
:
ChartView
.
getClass
(
classType
.
sub
);
if
(
Clazz
)
{
component
=
new
Clazz
();
component
.
init
(
ecModel
,
this
.
_api
);
componentsMap
[
id
]
=
component
;
componentsList
.
push
(
component
);
this
.
_zr
.
add
(
component
.
group
);
view
=
new
Clazz
();
view
.
init
(
ecModel
,
this
.
_api
);
viewMap
[
id
]
=
view
;
viewList
.
push
(
view
);
zr
.
add
(
view
.
group
);
}
else
{
// Error
}
}
component
.
__id
=
id
;
component
.
__keepAlive
=
true
;
// Used in rendering
component
.
__model
=
componentM
odel
;
view
.
__keepAlive
=
true
;
view
.
__id
=
id
;
view
.
__model
=
m
odel
;
},
this
);
for
(
var
i
=
0
;
i
<
components
List
.
length
;)
{
var
component
=
components
List
[
i
];
if
(
!
component
.
__keepAlive
)
{
this
.
_zr
.
remove
(
component
.
group
);
component
.
dispose
(
this
.
_api
);
components
List
.
splice
(
i
,
1
);
delete
componentsMap
[
component
.
__id
];
for
(
var
i
=
0
;
i
<
view
List
.
length
;)
{
var
view
=
view
List
[
i
];
if
(
!
view
.
__keepAlive
)
{
zr
.
remove
(
view
.
group
);
view
.
dispose
(
this
.
_api
);
view
List
.
splice
(
i
,
1
);
delete
viewMap
[
view
.
__id
];
}
else
{
i
++
;
}
}
};
/**
* Processor data in each series
*
...
...
@@ -614,7 +574,7 @@ define(function (require) {
chart
.
dispose
();
});
this
.
zr
.
dispose
();
this
.
_
zr
.
dispose
();
instances
[
this
.
id
]
=
null
;
};
...
...
@@ -885,9 +845,9 @@ define(function (require) {
/**
* @param {echarts/scale/*} scale
*/
echarts
.
extendScale
=
function
(
opts
)
{
return
Scale
.
extend
(
opts
);
};
//
echarts.extendScale = function (opts) {
//
return Scale.extend(opts);
//
};
/**
* @param {Object} opts
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录