Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
434e2b1a
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,发现更多精彩内容 >>
提交
434e2b1a
编写于
6月 25, 2019
作者:
D
deqingli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(selector): modify the parameter in legend default option and the time selectorgroup be created
上级
8e83c484
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
45 deletion
+37
-45
src/component/legend/LegendModel.js
src/component/legend/LegendModel.js
+1
-3
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+16
-18
src/component/legend/ScrollableLegendView.js
src/component/legend/ScrollableLegendView.js
+20
-24
未找到文件。
src/component/legend/LegendModel.js
浏览文件 @
434e2b1a
...
...
@@ -344,9 +344,7 @@ var LegendModel = echarts.extendComponentModel({
selectorItemGap
:
7
,
selectorLegendContentGap
:
10
,
selectorBorderGap
:
1
,
selectorButtonGap
:
10
,
// Tooltip 相关配置
tooltip
:
{
...
...
src/component/legend/LegendView.js
浏览文件 @
434e2b1a
...
...
@@ -57,7 +57,7 @@ export default echarts.extendComponentView({
* @private
* @type {module:zrender/container/Group}
*/
this
.
_selectorGroup
;
this
.
group
.
add
(
this
.
_selectorGroup
=
new
Group
())
;
/**
* If first rendering, `contentGroup.position` is [0, 0], which
...
...
@@ -143,7 +143,7 @@ export default echarts.extendComponentView({
resetInner
:
function
()
{
this
.
getContentGroup
().
removeAll
();
this
.
_backgroundEl
&&
this
.
group
.
remove
(
this
.
_backgroundEl
);
this
.
_selectorGroup
&&
this
.
_selectorGroup
.
removeAll
();
this
.
getSelectorGroup
()
.
removeAll
();
},
/**
...
...
@@ -260,8 +260,7 @@ export default echarts.extendComponentView({
},
_createSelector
:
function
(
selector
,
legendModel
,
api
,
orient
,
selectorPosition
)
{
!
this
.
_selectorGroup
&&
this
.
group
.
add
(
this
.
_selectorGroup
=
new
Group
());
var
selectorGroup
=
this
.
_selectorGroup
;
var
selectorGroup
=
this
.
getSelectorGroup
();
var
iconSize
=
legendModel
.
get
(
'
selectorIconSize
'
,
true
);
if
(
!
isArray
(
iconSize
))
{
...
...
@@ -438,7 +437,7 @@ export default echarts.extendComponentView({
*/
layoutInner
:
function
(
legendModel
,
itemAlign
,
maxSize
,
isFirstRender
,
selector
,
selectorPosition
)
{
var
contentGroup
=
this
.
getContentGroup
();
var
selectorGroup
=
this
.
_selectorGroup
;
var
selectorGroup
=
this
.
getSelectorGroup
()
;
// Place items in contentGroup.
layoutUtil
.
box
(
...
...
@@ -452,9 +451,9 @@ export default echarts.extendComponentView({
var
contentRect
=
contentGroup
.
getBoundingRect
();
var
contentPos
=
[
-
contentRect
.
x
,
-
contentRect
.
y
];
if
(
selector
&&
selectorGroup
)
{
if
(
selector
)
{
// Place buttons in selectorGroup
selectorGroup
&&
layoutUtil
.
box
(
layoutUtil
.
box
(
// Buttons in selectorGroup always layout horizontally
'
horizontal
'
,
selectorGroup
,
...
...
@@ -463,30 +462,29 @@ export default echarts.extendComponentView({
var
selectorRect
=
selectorGroup
.
getBoundingRect
();
var
selectorPos
=
[
-
selectorRect
.
x
,
-
selectorRect
.
y
];
var
selector
LegendContentGap
=
legendModel
.
get
(
'
selectorLegendContent
Gap
'
,
true
);
var
selector
ButtonGap
=
legendModel
.
get
(
'
selectorButton
Gap
'
,
true
);
var
orientIdx
=
legendModel
.
getOrient
().
index
;
var
WH
=
orientIdx
===
0
?
'
width
'
:
'
height
'
;
var
HW
=
orientIdx
===
0
?
'
height
'
:
'
width
'
;
var
YX
=
orientIdx
===
0
?
'
y
'
:
'
x
'
;
var
selectorBorderGap
=
legendModel
.
get
(
'
selectorBorderGap
'
,
true
);
var
wh
=
orientIdx
===
0
?
'
width
'
:
'
height
'
;
var
hw
=
orientIdx
===
0
?
'
height
'
:
'
width
'
;
var
yx
=
orientIdx
===
0
?
'
y
'
:
'
x
'
;
if
(
selectorPosition
===
'
end
'
)
{
selectorPos
[
orientIdx
]
+=
contentRect
[
WH
]
+
selectorLegendContent
Gap
;
selectorPos
[
orientIdx
]
+=
contentRect
[
wh
]
+
selectorButton
Gap
;
}
else
{
contentPos
[
orientIdx
]
+=
selectorRect
[
WH
]
+
selectorLegendContent
Gap
;
contentPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selectorButton
Gap
;
}
//Always align selector to content as 'middle'
selectorPos
[
1
-
orientIdx
]
+=
contentRect
[
HW
]
/
2
-
selectorRect
[
HW
]
/
2
;
selectorPos
[
1
-
orientIdx
]
+=
contentRect
[
hw
]
/
2
-
selectorRect
[
hw
]
/
2
;
selectorGroup
.
attr
(
'
position
'
,
selectorPos
);
contentGroup
.
attr
(
'
position
'
,
contentPos
);
var
mainRect
=
{
x
:
0
,
y
:
0
};
mainRect
[
WH
]
=
contentRect
[
WH
]
+
selectorLegendContentGap
+
selectorRect
[
WH
]
+
selectorBorderGap
;
mainRect
[
HW
]
=
Math
.
max
(
contentRect
[
HW
],
selectorRect
[
HW
]);
mainRect
[
YX
]
=
Math
.
min
(
0
,
selectorRect
[
YX
]
+
selectorPos
[
1
-
orientIdx
]);
mainRect
[
wh
]
=
contentRect
[
wh
]
+
selectorButtonGap
+
selectorRect
[
wh
]
;
mainRect
[
hw
]
=
Math
.
max
(
contentRect
[
hw
],
selectorRect
[
hw
]);
mainRect
[
yx
]
=
Math
.
min
(
0
,
selectorRect
[
yx
]
+
selectorPos
[
1
-
orientIdx
]);
return
mainRect
;
}
else
{
...
...
src/component/legend/ScrollableLegendView.js
浏览文件 @
434e2b1a
...
...
@@ -144,7 +144,6 @@ var ScrollableLegendView = LegendView.extend({
var
containerGroup
=
this
.
_containerGroup
;
var
controllerGroup
=
this
.
_controllerGroup
;
var
selectorGroup
=
this
.
getSelectorGroup
();
var
isSelector
=
selector
&&
selectorGroup
;
var
orientIdx
=
legendModel
.
getOrient
().
index
;
var
wh
=
WH
[
orientIdx
];
...
...
@@ -160,19 +159,16 @@ var ScrollableLegendView = LegendView.extend({
orientIdx
?
null
:
maxSize
.
height
);
if
(
isSelector
)
{
layoutUtil
.
box
(
// Buttons in selectorGroup always layout horizontally
'
horizontal
'
,
selectorGroup
,
legendModel
.
get
(
'
selectorItemGap
'
,
true
)
);
}
selector
&&
layoutUtil
.
box
(
// Buttons in selectorGroup always layout horizontally
'
horizontal
'
,
selectorGroup
,
legendModel
.
get
(
'
selectorItemGap
'
,
true
)
);
var
selector
LegendContentGap
=
isSelector
?
legendModel
.
get
(
'
selectorLegendContent
Gap
'
,
true
)
:
0
;
var
selector
ButtonGap
=
selector
?
legendModel
.
get
(
'
selectorButton
Gap
'
,
true
)
:
0
;
var
selectorBorderGap
=
isSelector
?
legendModel
.
get
(
'
selectorBorderGap
'
,
true
)
:
0
;
var
selectorRect
=
isSelector
?
selectorGroup
.
getBoundingRect
()
:
{
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
};
var
selectorRect
=
selector
?
selectorGroup
.
getBoundingRect
()
:
{
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
};
var
selectorPos
=
[
-
selectorRect
.
x
,
-
selectorRect
.
y
];
layoutUtil
.
box
(
...
...
@@ -206,15 +202,15 @@ var ScrollableLegendView = LegendView.extend({
var
pageButtonPosition
=
legendModel
.
get
(
'
pageButtonPosition
'
,
true
);
// controller is on the right / bottom.
if
(
pageButtonPosition
===
'
end
'
)
{
if
(
isS
elector
)
{
if
(
s
elector
)
{
if
(
selectorPosition
===
'
end
'
)
{
selectorPos
[
orientIdx
]
+=
maxSize
[
wh
]
-
selectorRect
[
wh
];
controllerPos
[
orientIdx
]
+=
maxSize
[
wh
]
-
selectorRect
[
wh
]
-
selector
LegendContent
Gap
-
controllerRect
[
wh
];
-
selector
Button
Gap
-
controllerRect
[
wh
];
}
else
{
controllerPos
[
orientIdx
]
+=
maxSize
[
wh
]
-
controllerRect
[
wh
];
containerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
LegendContent
Gap
;
containerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
Button
Gap
;
}
}
else
{
...
...
@@ -223,10 +219,10 @@ var ScrollableLegendView = LegendView.extend({
}
// controller is on the left / top.
else
{
if
(
isS
elector
)
{
if
(
s
elector
)
{
if
(
selectorPosition
===
'
start
'
)
{
controllerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
LegendContent
Gap
;
containerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
LegendContent
Gap
controllerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
Button
Gap
;
containerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
Button
Gap
+
controllerRect
[
wh
]
+
pageButtonGap
;
}
else
{
...
...
@@ -239,19 +235,19 @@ var ScrollableLegendView = LegendView.extend({
}
}
}
else
if
(
isS
elector
)
{
else
if
(
s
elector
)
{
if
(
selectorPosition
===
'
end
'
)
{
selectorPos
[
orientIdx
]
+=
contentRect
[
wh
]
+
selector
LegendContent
Gap
;
selectorPos
[
orientIdx
]
+=
contentRect
[
wh
]
+
selector
Button
Gap
;
}
else
{
containerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
LegendContent
Gap
;
containerPos
[
orientIdx
]
+=
selectorRect
[
wh
]
+
selector
Button
Gap
;
}
}
// Always align controller to content as 'middle'.
controllerPos
[
1
-
orientIdx
]
+=
contentRect
[
hw
]
/
2
-
controllerRect
[
hw
]
/
2
;
if
(
isS
elector
)
{
if
(
s
elector
)
{
selectorPos
[
1
-
orientIdx
]
+=
contentRect
[
hw
]
/
2
-
selectorRect
[
hw
]
/
2
;
selectorGroup
.
attr
(
'
position
'
,
selectorPos
);
}
...
...
@@ -265,7 +261,7 @@ var ScrollableLegendView = LegendView.extend({
var
mainRect
=
{
x
:
0
,
y
:
0
};
// Consider content may be overflow (should be clipped).
mainRect
[
wh
]
=
showController
?
maxSize
[
wh
]
:
contentRect
[
wh
]
+
selector
LegendContentGap
+
selectorRect
[
wh
]
+
selectorBorderGap
;
:
contentRect
[
wh
]
+
selector
ButtonGap
+
selectorRect
[
wh
]
;
mainRect
[
hw
]
=
Math
.
max
(
contentRect
[
hw
],
controllerRect
[
hw
],
selectorRect
[
hw
]);
// `containerRect[yx] + containerPos[1 - orientIdx]` is 0.
...
...
@@ -276,7 +272,7 @@ var ScrollableLegendView = LegendView.extend({
if
(
showController
)
{
var
clipShape
=
{
x
:
0
,
y
:
0
};
clipShape
[
wh
]
=
Math
.
max
(
maxSize
[
wh
]
-
controllerRect
[
wh
]
-
pageButtonGap
-
selectorRect
[
wh
]
-
selector
LegendContentGap
-
selectorBorder
Gap
,
0
);
-
selectorRect
[
wh
]
-
selector
Button
Gap
,
0
);
clipShape
[
hw
]
=
mainRect
[
hw
];
containerGroup
.
setClipPath
(
new
graphic
.
Rect
({
shape
:
clipShape
}));
// Consider content may be larger than container, container rect
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录