Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
0e908040
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,发现更多精彩内容 >>
提交
0e908040
编写于
12月 30, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add restore
上级
dd1b353a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
13 deletion
+58
-13
src/component/toolbox.js
src/component/toolbox.js
+1
-0
src/component/toolbox/feature/DataZoom.js
src/component/toolbox/feature/DataZoom.js
+13
-7
src/component/toolbox/feature/Restore.js
src/component/toolbox/feature/Restore.js
+36
-0
src/model/Global.js
src/model/Global.js
+6
-5
test/dataZoom-scatter-toolbox.html
test/dataZoom-scatter-toolbox.html
+2
-1
未找到文件。
src/component/toolbox.js
浏览文件 @
0e908040
...
...
@@ -7,4 +7,5 @@ define(function (require) {
require
(
'
./toolbox/feature/MagicType
'
);
require
(
'
./toolbox/feature/DataView
'
);
require
(
'
./toolbox/feature/DataZoom
'
);
require
(
'
./toolbox/feature/Restore
'
);
});
\ No newline at end of file
src/component/toolbox/feature/DataZoom.js
浏览文件 @
0e908040
...
...
@@ -33,7 +33,7 @@ define(function(require) {
* @private
* @type {Object}
*/
this
.
_
active
Map
=
{
zoom
:
false
,
back
:
false
};
this
.
_
selected
Map
=
{
zoom
:
false
,
back
:
false
};
/**
* [{key: dataZoomId, value: {dataZoomId, range}}, ...]
...
...
@@ -46,7 +46,7 @@ define(function(require) {
}
DataZoom
.
defaultOption
=
{
show
:
tru
e
,
show
:
fals
e
,
type
:
[],
// Icon group
icon
:
{
...
...
@@ -89,7 +89,7 @@ define(function(require) {
var
handlers
=
{
zoom
:
function
(
controllerGroup
,
ecModel
,
api
)
{
var
isZoomActive
=
this
.
_
activeMap
.
zoom
=
!
this
.
_active
Map
.
zoom
;
var
isZoomActive
=
this
.
_
selectedMap
.
zoom
=
!
this
.
_selected
Map
.
zoom
;
var
zr
=
api
.
getZr
();
if
(
isZoomActive
)
{
...
...
@@ -117,6 +117,10 @@ define(function(require) {
}
};
proto
.
getSelectedMap
=
function
()
{
return
zrUtil
.
clone
(
this
.
_selectedMap
);
};
/**
* @private
*/
...
...
@@ -140,8 +144,10 @@ define(function(require) {
proto
.
_disposeController
=
function
()
{
var
controller
=
this
.
_controller
;
controller
.
off
(
'
selected
'
);
controller
.
dispose
();
if
(
controller
)
{
controller
.
off
(
'
selected
'
);
controller
.
dispose
();
}
};
function
prepareCoordInfo
(
grid
,
ecModel
)
{
...
...
@@ -272,7 +278,7 @@ define(function(require) {
history
.
push
(
newSnapshot
);
// Update state of back button.
this
.
_
active
Map
.
back
=
history
.
length
<=
1
;
this
.
_
selected
Map
.
back
=
history
.
length
<=
1
;
};
/**
...
...
@@ -284,7 +290,7 @@ define(function(require) {
history
.
length
>
1
&&
history
.
pop
();
// Update state of back button.
this
.
_
active
Map
.
back
=
history
.
length
<=
1
;
this
.
_
selected
Map
.
back
=
history
.
length
<=
1
;
// Find top for all dataZoom.
var
snapshot
=
{};
...
...
src/component/toolbox/feature/Restore.js
0 → 100644
浏览文件 @
0e908040
define
(
function
(
require
)
{
'
use strict
'
;
function
Restore
(
model
)
{
this
.
model
=
model
;
}
Restore
.
defaultOption
=
{
show
:
false
,
type
:
[],
icon
:
'
M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5
'
,
title
:
'
还原
'
};
var
proto
=
Restore
.
prototype
;
proto
.
onclick
=
function
(
ecModel
,
api
,
type
)
{
api
.
dispatchAction
({
type
:
'
restore
'
,
from
:
this
.
uid
});
};
require
(
'
../featureManager
'
).
register
(
'
restore
'
,
Restore
);
require
(
'
../../../echarts
'
).
registerAction
(
{
type
:
'
restore
'
,
event
:
'
restore
'
,
update
:
'
prepareAndUpdate
'
},
function
(
payload
,
ecModel
)
{
ecModel
.
resetOption
(
'
recreate
'
);
}
);
return
Restore
;
});
\ No newline at end of file
src/model/Global.js
浏览文件 @
0e908040
...
...
@@ -56,6 +56,7 @@ define(function (require) {
/**
* @param {string} type null/undefined: reset all.
* 'recreate': force recreate all.
* 'timeline': only reset timeline option
* 'media': only reset media query option
* @return {boolean} Whether option changed.
...
...
@@ -64,10 +65,10 @@ define(function (require) {
var
optionChanged
=
false
;
var
optionManager
=
this
.
_optionManager
;
if
(
!
type
)
{
if
(
!
type
||
type
===
'
recreate
'
)
{
var
baseOption
=
optionManager
.
mountOption
();
if
(
!
this
.
option
)
{
if
(
!
this
.
option
||
type
===
'
recreate
'
)
{
initBase
.
call
(
this
,
baseOption
);
}
else
{
...
...
@@ -81,12 +82,12 @@ define(function (require) {
this
.
restoreData
();
}
if
(
!
type
||
type
===
'
timeline
'
)
{
if
(
!
type
||
type
===
'
recreate
'
||
type
===
'
timeline
'
)
{
var
partialOption
=
optionManager
.
getTimelineOption
(
this
);
partialOption
&&
(
this
.
mergeOption
(
partialOption
),
optionChanged
=
true
);
}
if
(
!
type
||
type
===
'
media
'
)
{
if
(
!
type
||
type
===
'
recreate
'
||
type
===
'
media
'
)
{
var
partialOption
=
optionManager
.
getMediaOption
(
this
,
this
.
_api
);
partialOption
&&
(
this
.
mergeOption
(
partialOption
),
optionChanged
=
true
);
}
...
...
@@ -829,7 +830,7 @@ define(function (require) {
return
componentOption
.
id
// FIXME
// Where to put this constant.
&&
(
componentOption
.
id
+
''
).
indexOf
(
'
\
0_ec_
\
0
'
)
===
0
&&
(
componentOption
.
id
+
''
).
indexOf
(
'
\
0_ec_
\
0
'
)
===
0
;
}
/**
...
...
test/dataZoom-scatter-toolbox.html
浏览文件 @
0e908040
...
...
@@ -55,7 +55,8 @@
// y: 'bottom',
feature
:
{
dataView
:
{},
dataZoom
:
{},
dataZoom
:
{
show
:
true
},
restore
:
{
show
:
true
},
saveAsImage
:
{}
}
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录