Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
4bbe3b2f
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,发现更多精彩内容 >>
提交
4bbe3b2f
编写于
7月 15, 2020
作者:
1
100pah
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix toolbox dataZoom when on grid.
上级
cc81a49b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
54 deletion
+51
-54
src/component/helper/BrushTargetManager.ts
src/component/helper/BrushTargetManager.ts
+2
-2
src/component/toolbox/feature/DataZoom.ts
src/component/toolbox/feature/DataZoom.ts
+49
-52
未找到文件。
src/component/helper/BrushTargetManager.ts
浏览文件 @
4bbe3b2f
...
...
@@ -286,10 +286,10 @@ function formatMinMax(minMax: BrushDimensionMinMax): BrushDimensionMinMax {
}
function
parseFinder
(
ecModel
:
GlobalModel
,
option
:
ModelFinder
ecModel
:
GlobalModel
,
finder
:
ModelFinder
):
ParsedModelFinder
{
return
modelUtilParseFinder
(
ecModel
,
option
,
{
includeMainTypes
:
INCLUDE_FINDER_MAIN_TYPES
}
ecModel
,
finder
,
{
includeMainTypes
:
INCLUDE_FINDER_MAIN_TYPES
}
);
}
...
...
src/component/toolbox/feature/DataZoom.ts
浏览文件 @
4bbe3b2f
...
...
@@ -45,11 +45,12 @@ import {
}
from
'
../../dataZoom/helper
'
;
import
{
ModelFinderObject
,
ModelFinderIndexQuery
,
makeInternalComponentId
,
queryReferringComponents
,
ModelFinderIdQuery
queryReferringComponents
,
ModelFinderIdQuery
,
parseFinder
}
from
'
../../../util/model
'
;
import
ToolboxModel
from
'
../ToolboxModel
'
;
import
{
registerInternalOptionCreator
}
from
'
../../../model/internalComponentCreator
'
;
import
Model
from
'
../../../model/Model
'
;
import
ComponentModel
from
'
../../../model/Component
'
;
const
dataZoomLang
=
lang
.
toolbox
.
dataZoom
;
...
...
@@ -129,7 +130,9 @@ class DataZoomFeature extends ToolboxFeature<ToolboxDataZoomFeatureOption> {
this
.
brushController
.
updateCovers
([]);
// remove cover
const
brushTargetManager
=
new
BrushTargetManager
(
retrieveAxisSetting
(
this
.
model
.
option
),
ecModel
,
{
include
:
[
'
grid
'
]}
makeAxisFinder
(
this
.
model
),
ecModel
,
{
include
:
[
'
grid
'
]}
);
brushTargetManager
.
matchOutputRanges
(
areas
,
ecModel
,
function
(
area
,
coordRange
,
coordSys
:
Cartesian2D
)
{
if
(
coordSys
.
type
!==
'
cartesian2d
'
)
{
...
...
@@ -235,15 +238,23 @@ const handlers: { [key in IconType]: (this: DataZoomFeature) => void } = {
};
function
retrieveAxisSetting
(
option
:
ToolboxDataZoomFeatureOption
):
ModelFinderObject
{
const
setting
=
{}
as
ModelFinderObject
;
// Compatible with previous setting: null => all axis, false => no axis.
zrUtil
.
each
([
'
xAxisIndex
'
,
'
yAxisIndex
'
]
as
const
,
function
(
name
)
{
let
val
=
option
[
name
];
val
==
null
&&
(
val
=
'
all
'
);
(
val
===
false
||
val
===
'
none
'
)
&&
(
val
=
[]);
setting
[
name
]
=
val
;
});
function
makeAxisFinder
(
dzFeatureModel
:
ToolboxDataZoomFeatureModel
):
ModelFinderObject
{
const
setting
=
{
xAxisIndex
:
dzFeatureModel
.
get
(
'
xAxisIndex
'
,
true
),
yAxisIndex
:
dzFeatureModel
.
get
(
'
yAxisIndex
'
,
true
),
xAxisId
:
dzFeatureModel
.
get
(
'
xAxisId
'
,
true
),
yAxisId
:
dzFeatureModel
.
get
(
'
yAxisId
'
,
true
)
}
as
ModelFinderObject
;
// If not specified, it means use all axes.
if
(
setting
.
xAxisIndex
==
null
&&
setting
.
yAxisIndex
==
null
&&
setting
.
xAxisId
==
null
&&
setting
.
yAxisId
==
null
)
{
setting
.
xAxisIndex
=
setting
.
yAxisIndex
=
'
all
'
;
}
return
setting
;
}
...
...
@@ -276,19 +287,23 @@ function updateZoomBtnStatus(
featureModel
.
setIconStatus
(
'
zoom
'
,
zoomActive
?
'
emphasis
'
:
'
normal
'
);
const
brushTargetManager
=
new
BrushTargetManager
(
retrieveAxisSetting
(
featureModel
.
option
),
ecModel
,
{
include
:
[
'
grid
'
]}
makeAxisFinder
(
featureModel
),
ecModel
,
{
include
:
[
'
grid
'
]}
);
const
panels
=
brushTargetManager
.
makePanelOpts
(
api
,
function
(
targetInfo
:
BrushTargetInfoCartesian2D
)
{
return
(
targetInfo
.
xAxisDeclared
&&
!
targetInfo
.
yAxisDeclared
)
?
'
lineX
'
:
(
!
targetInfo
.
xAxisDeclared
&&
targetInfo
.
yAxisDeclared
)
?
'
lineY
'
:
'
rect
'
;
});
view
.
brushController
.
setPanels
(
brushTargetManager
.
makePanelOpts
(
api
,
function
(
targetInfo
:
BrushTargetInfoCartesian2D
)
{
return
(
targetInfo
.
xAxisDeclared
&&
!
targetInfo
.
yAxisDeclared
)
?
'
lineX
'
:
(
!
targetInfo
.
xAxisDeclared
&&
targetInfo
.
yAxisDeclared
)
?
'
lineY
'
:
'
rect
'
;
}))
.
setPanels
(
panels
)
.
enableBrush
(
zoomActive
(
zoomActive
&&
panels
.
length
)
?
{
brushType
:
'
auto
'
,
brushStyle
:
{
...
...
@@ -308,40 +323,20 @@ registerInternalOptionCreator('dataZoom', function (ecModel: GlobalModel): Compo
if
(
!
toolboxModel
)
{
return
;
}
const
dzFeatureModel
=
toolboxModel
.
getModel
([
'
feature
'
,
'
dataZoom
'
]
as
any
);
const
dzFeatureModel
=
toolboxModel
.
getModel
([
'
feature
'
,
'
dataZoom
'
]
as
any
)
as
ToolboxDataZoomFeatureModel
;
const
dzOptions
=
[]
as
ComponentOption
[];
addInternalOptionForAxis
(
ecModel
,
dzOptions
,
'
x
'
,
dzFeatureModel
);
addInternalOptionForAxis
(
ecModel
,
dzOptions
,
'
y
'
,
dzFeatureModel
);
return
dzOptions
;
}
);
const
finder
=
makeAxisFinder
(
dzFeatureModel
)
;
const
finderResult
=
parseFinder
(
ecModel
,
finder
);
function
addInternalOptionForAxis
(
ecModel
:
GlobalModel
,
dzOptions
:
ComponentOption
[],
axisDim
:
'
x
'
|
'
y
'
,
dzFeatureModel
:
Model
<
ToolboxDataZoomFeatureOption
>
):
void
{
const
axisIndexPropName
=
getAxisIndexPropName
(
axisDim
)
as
'
xAxisIndex
'
|
'
yAxisIndex
'
;
const
axisIdPropName
=
getAxisIdPropName
(
axisDim
)
as
'
xAxisId
'
|
'
yAxisId
'
;
const
axisMainType
=
getAxisMainType
(
axisDim
);
let
axisIndexOption
=
dzFeatureModel
.
get
(
axisIndexPropName
,
true
);
const
axisIdOption
=
dzFeatureModel
.
get
(
axisIdPropName
,
true
);
if
(
axisIndexOption
==
null
&&
axisIdOption
==
null
)
{
axisIndexOption
=
'
all
'
;
}
each
(
finderResult
.
xAxisModels
,
axisModel
=>
buildInternalOptions
(
axisModel
,
'
xAxis
'
,
'
xAxisIndex
'
));
each
(
finderResult
.
yAxisModels
,
axisModel
=>
buildInternalOptions
(
axisModel
,
'
yAxis
'
,
'
yAxisIndex
'
));
const
queryResult
=
queryReferringComponents
(
ecModel
,
axisMainType
,
{
index
:
axisIndexOption
,
id
:
axisIdOption
}
);
each
(
queryResult
.
models
,
function
(
axisModel
)
{
function
buildInternalOptions
(
axisModel
:
ComponentModel
,
axisMainType
:
'
xAxis
'
|
'
yAxis
'
,
axisIndexPropName
:
'
xAxisIndex
'
|
'
yAxisIndex
'
)
{
const
axisIndex
=
axisModel
.
componentIndex
;
const
newOpt
=
{
type
:
'
select
'
,
...
...
@@ -354,8 +349,10 @@ function addInternalOptionForAxis(
newOpt
[
axisIndexPropName
]
=
axisIndex
;
dzOptions
.
push
(
newOpt
);
});
}
}
return
dzOptions
;
});
export
default
DataZoomFeature
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录