Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
513202b5
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,发现更多精彩内容 >>
提交
513202b5
编写于
12月 30, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
datazoom axis rename, sync range with other datazoom model.
上级
35e6ab64
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
77 addition
and
52 deletion
+77
-52
src/component/dataZoom/AxisProxy.js
src/component/dataZoom/AxisProxy.js
+24
-5
src/component/dataZoom/DataZoomModel.js
src/component/dataZoom/DataZoomModel.js
+50
-44
src/component/dataZoom/SliderZoomView.js
src/component/dataZoom/SliderZoomView.js
+2
-2
src/component/dataZoom/dataZoomProcessor.js
src/component/dataZoom/dataZoomProcessor.js
+1
-1
未找到文件。
src/component/dataZoom/Axis
Operator
.js
→
src/component/dataZoom/Axis
Proxy
.js
浏览文件 @
513202b5
...
...
@@ -12,11 +12,11 @@ define(function(require) {
* One axis can only operated by one axis operator.
* Different dataZoomModels may be defined to operate the same axis.
* (i.e. 'inside' data zoom and 'slider' data zoom components)
* So dataZoomModels share one axis
Operator
in that case.
* So dataZoomModels share one axis
Proxy
in that case.
*
* @class
*/
var
Axis
Operator
=
function
(
dimName
,
axisIndex
,
dataZoomModel
,
ecModel
)
{
var
Axis
Proxy
=
function
(
dimName
,
axisIndex
,
dataZoomModel
,
ecModel
)
{
/**
* @private
...
...
@@ -54,9 +54,18 @@ define(function(require) {
this
.
_model
=
dataZoomModel
;
};
Axis
Operator
.
prototype
=
{
Axis
Proxy
.
prototype
=
{
constructor
:
AxisOperator
,
constructor
:
AxisProxy
,
/**
* Whether the axisProxy is hosted by model.
* @public
* @return {boolean}
*/
hostedBy
:
function
(
model
)
{
return
this
.
_model
===
model
;
},
/**
* @param {boolean} crossZero
...
...
@@ -98,6 +107,16 @@ define(function(require) {
return
seriesModels
;
},
/**
* Return range in its host model.
*
* @public
* @return {Array.<number>} [min, max]
*/
getRange
:
function
()
{
return
this
.
_model
.
getRange
();
},
/**
* @param {module: echarts/component/dataZoom/DataZoomModel} model
*/
...
...
@@ -176,6 +195,6 @@ define(function(require) {
return
result
;
}
return
Axis
Operator
;
return
Axis
Proxy
;
});
\ No newline at end of file
src/component/dataZoom/DataZoomModel.js
浏览文件 @
513202b5
...
...
@@ -8,7 +8,7 @@ define(function(require) {
var
echarts
=
require
(
'
../../echarts
'
);
var
modelUtil
=
require
(
'
../../util/model
'
);
var
numberUtil
=
require
(
'
../../util/number
'
);
var
Axis
Operator
=
require
(
'
./AxisOperator
'
);
var
Axis
Proxy
=
require
(
'
./AxisProxy
'
);
var
asc
=
numberUtil
.
asc
;
var
eachAxisDim
=
modelUtil
.
eachAxisDim
;
...
...
@@ -39,7 +39,7 @@ define(function(require) {
throttle
:
100
,
// Dispatch action by the fixed rate, avoid frequency.
// default 100. Do not throttle when use null/undefined.
start
:
0
,
// 默认为0
end
:
100
,
// 默认为全部 100%
end
:
100
// 默认为全部 100%
},
/**
...
...
@@ -71,7 +71,7 @@ define(function(require) {
* key like x_0, y_1
* @private
*/
this
.
_axis
Operator
s
=
{};
this
.
_axis
Proxie
s
=
{};
/**
* @readOnly
...
...
@@ -99,33 +99,35 @@ define(function(require) {
this
.
_resetTarget
(
newOption
,
isInit
);
this
.
_giveAxis
Operator
s
();
this
.
_giveAxis
Proxie
s
();
this
.
_backup
();
this
.
_resetRange
();
this
.
_setToAxisModel
();
},
/**
* @private
*/
_giveAxis
Operator
s
:
function
()
{
var
axis
Operators
=
this
.
_axisOperator
s
;
_giveAxis
Proxie
s
:
function
()
{
var
axis
Proxies
=
this
.
_axisProxie
s
;
this
.
eachTargetAxis
(
function
(
dimNames
,
axisIndex
,
dataZoomModel
,
ecModel
)
{
var
axisModel
=
this
.
dependentModels
[
dimNames
.
axis
][
axisIndex
];
// If exists, share axis
Operator
with other dataZoomModels.
var
axis
Operator
=
axisModel
.
__dzAxisOperator
||
(
// Use the first dataZoomModel as the main model of axis
Operator
.
axisModel
.
__dzAxis
Operator
=
new
AxisOperator
(
// If exists, share axis
Proxy
with other dataZoomModels.
var
axis
Proxy
=
axisModel
.
__dzAxisProxy
||
(
// Use the first dataZoomModel as the main model of axis
Proxy
.
axisModel
.
__dzAxis
Proxy
=
new
AxisProxy
(
dimNames
.
name
,
axisIndex
,
this
,
ecModel
)
);
// FIXME
// dispose __dzAxis
Operator
// dispose __dzAxis
Proxy
axis
Operators
[
dimNames
.
name
+
'
_
'
+
axisIndex
]
=
axisOperator
;
axis
Proxies
[
dimNames
.
name
+
'
_
'
+
axisIndex
]
=
axisProxy
;
},
this
);
},
...
...
@@ -296,7 +298,7 @@ define(function(require) {
*/
_backup
:
function
()
{
this
.
eachTargetAxis
(
function
(
dimNames
,
axisIndex
,
dataZoomModel
,
ecModel
)
{
this
.
getAxis
Operator
(
dimNames
.
name
,
axisIndex
).
backupCrossZero
(
this
.
getAxis
Proxy
(
dimNames
.
name
,
axisIndex
).
backupCrossZero
(
this
,
!
ecModel
.
getComponent
(
dimNames
.
axis
,
axisIndex
).
get
(
'
scale
'
)
);
...
...
@@ -308,48 +310,52 @@ define(function(require) {
*/
_resetRange
:
function
()
{
var
thisOption
=
this
.
option
;
// TODO
// 对于一个轴受多个dataZoom控制的情况(如toolbox):
// datazoom改变时,不直接改变,而是发全局事件,监听:
// 如果轴是自己包含的轴,则自己改变start和end。
// 所有都改完后,重新走process流程。
// Determin which axes dataZoom.start/end and dataZoom.start2/end2 control.
// When only xAxisIndex or only yAxisIndex is specified, start/end controls them.
// targetDim === false means that both xAxisIndex and yAxisIndex are specified.
var
targetDim
;
eachAxisDim
(
function
(
dimNames
)
{
if
(
thisOption
[
dimNames
.
axisIndex
].
length
)
{
targetDim
=
targetDim
!=
null
?
false
:
dimNames
.
name
;
var
axisProxies
=
this
.
_axisProxies
;
// Sync range with other dataZoomModel.
// Consider this case: dataZoomModel1 and dataZoomModel2 control the same axis,
// and the range settings are different. That will bring some problem when using
// dataZoomModel.getRange before aciton ever dispatched.
// (We encounter this problem in toolbox data zoom.)
var
notHostAnyAxis
=
true
;
for
(
var
i
=
0
,
len
=
axisProxies
.
length
;
i
<
len
;
i
++
)
{
if
(
axisProxies
[
i
].
hostedBy
(
this
))
{
notHostAnyAxis
=
false
;
break
;
}
});
// Otherwise, determine it by dataZoom.orient (compatibale with the logic in ec2.)
// targetDim === 'y' means start/end control 'y' and start2/end2 control 'x'.
var
optAttrs
=
{};
optAttrs
[
targetDim
]
=
{
start
:
'
start
'
,
end
:
'
end
'
};
}
zrUtil
.
each
(
optAttrs
,
function
(
dimItem
,
targetDim
)
{
var
startValue
=
thisOption
[
dimItem
.
start
];
var
endValue
=
thisOption
[
dimItem
.
end
];
if
(
notHostAnyAxis
&&
axisProxies
[
0
])
{
var
range
=
axisProxies
[
0
].
getRange
();
thisOption
.
start
=
range
[
0
];
thisOption
.
end
=
range
[
1
];
}
else
{
var
startValue
=
thisOption
.
start
;
var
endValue
=
thisOption
.
end
;
// Auto reverse when start > end
if
(
startValue
>
endValue
)
{
startValue
=
[
endValue
,
endValue
=
startValue
][
0
];
}
thisOption
[
dimItem
.
start
]
=
startValue
;
thisOption
[
dimItem
.
end
]
=
endValue
;
},
this
);
thisOption
.
start
=
startValue
;
thisOption
.
end
=
endValue
;
}
},
/**
* @private
*/
_setToAxisModel
:
function
()
{
var
range
=
this
.
getRange
();
// Set "needsCrossZero" to axes
this
.
eachTargetAxis
(
function
(
dimNames
,
axisIndex
,
dataZoomModel
,
ecModel
)
{
var
axisModel
=
ecModel
.
getComponent
(
dimNames
.
axis
,
axisIndex
);
axisModel
.
setNeedsCrossZero
&&
axisModel
.
setNeedsCrossZero
(
thisOption
.
start
===
0
&&
thisOption
.
end
===
100
?
this
.
getAxis
Operator
(
dimNames
.
name
,
axisIndex
).
getCrossZero
()
(
range
[
0
]
===
0
&&
range
[
1
]
===
100
)
?
this
.
getAxis
Proxy
(
dimNames
.
name
,
axisIndex
).
getCrossZero
()
:
false
);
},
this
);
...
...
@@ -389,8 +395,8 @@ define(function(require) {
},
this
);
},
getAxis
Operator
:
function
(
dimName
,
axisIndex
)
{
return
this
.
_axis
Operator
s
[
dimName
+
'
_
'
+
axisIndex
];
getAxis
Proxy
:
function
(
dimName
,
axisIndex
)
{
return
this
.
_axis
Proxie
s
[
dimName
+
'
_
'
+
axisIndex
];
},
/**
...
...
src/component/dataZoom/SliderZoomView.js
浏览文件 @
513202b5
...
...
@@ -300,7 +300,7 @@ define(function (require) {
dataZoomModel
.
eachTargetAxis
(
function
(
dimNames
,
axisIndex
)
{
var
seriesModels
=
dataZoomModel
.
getAxis
Operator
(
dimNames
.
name
,
axisIndex
)
.
getAxis
Proxy
(
dimNames
.
name
,
axisIndex
)
.
getTargetSeriesModels
();
zrUtil
.
each
(
seriesModels
,
function
(
seriesModel
)
{
...
...
@@ -489,7 +489,7 @@ define(function (require) {
// Using dataInterval of the first axis.
if
(
!
dataInterval
)
{
dataInterval
=
dataZoomModel
.
getAxis
Operator
(
dimNames
.
name
,
axisIndex
)
.
getAxis
Proxy
(
dimNames
.
name
,
axisIndex
)
.
getDataWindow
();
axis
=
this
.
ecModel
.
getComponent
(
dimNames
.
axis
,
axisIndex
).
axis
;
}
...
...
src/component/dataZoom/dataZoomProcessor.js
浏览文件 @
513202b5
...
...
@@ -15,7 +15,7 @@ define(function (require) {
// undo redo
function
processSingleAxis
(
dimNames
,
axisIndex
,
dataZoomModel
,
ecModel
)
{
dataZoomModel
.
getAxis
Operator
(
dimNames
.
name
,
axisIndex
).
filterData
(
dataZoomModel
);
dataZoomModel
.
getAxis
Proxy
(
dimNames
.
name
,
axisIndex
).
filterData
(
dataZoomModel
);
}
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录