Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
c50c8c4d
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,发现更多精彩内容 >>
提交
c50c8c4d
编写于
1月 07, 2021
作者:
Y
yufeng04
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(loading): showLoading aligin center
上级
29ad6e40
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
7 deletion
+29
-7
src/loading/default.ts
src/loading/default.ts
+7
-3
test/loading.html
test/loading.html
+22
-4
未找到文件。
src/loading/default.ts
浏览文件 @
c50c8c4d
...
@@ -51,7 +51,7 @@ export default function defaultLoading(
...
@@ -51,7 +51,7 @@ export default function defaultLoading(
zrUtil
.
defaults
(
opts
,
{
zrUtil
.
defaults
(
opts
,
{
text
:
'
loading
'
,
text
:
'
loading
'
,
textColor
:
'
#000
'
,
textColor
:
'
#000
'
,
fontSize
:
'
12px
'
,
fontSize
:
12
,
maskColor
:
'
rgba(255, 255, 255, 0.8)
'
,
maskColor
:
'
rgba(255, 255, 255, 0.8)
'
,
showSpinner
:
true
,
showSpinner
:
true
,
color
:
'
#5470c6
'
,
color
:
'
#5470c6
'
,
...
@@ -68,7 +68,8 @@ export default function defaultLoading(
...
@@ -68,7 +68,8 @@ export default function defaultLoading(
z
:
10000
z
:
10000
});
});
group
.
add
(
mask
);
group
.
add
(
mask
);
const
font
=
opts
.
fontSize
+
'
sans-serif
'
;
const
font
=
`
${
parseInt
(
opts
.
fontSize
+
''
,
10
)}
px sans-serif`
;
const
labelRect
=
new
graphic
.
Rect
({
const
labelRect
=
new
graphic
.
Rect
({
style
:
{
style
:
{
fill
:
'
none
'
fill
:
'
none
'
...
@@ -127,8 +128,11 @@ export default function defaultLoading(
...
@@ -127,8 +128,11 @@ export default function defaultLoading(
// cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
// cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
// textDistance needs to be calculated when both animation and text exist
// textDistance needs to be calculated when both animation and text exist
const
cx
=
(
api
.
getWidth
()
-
r
*
2
-
(
opts
.
showSpinner
&&
textWidth
?
10
:
0
)
-
textWidth
)
/
2
const
cx
=
(
api
.
getWidth
()
-
r
*
2
-
(
opts
.
showSpinner
&&
textWidth
?
10
:
0
)
-
textWidth
)
/
2
-
(
opts
.
showSpinner
&&
textWidth
?
0
:
5
+
textWidth
/
2
)
// only show the text
// only show the text
-
(
opts
.
showSpinner
?
0
:
textWidth
/
2
);
+
(
opts
.
showSpinner
?
0
:
textWidth
/
2
)
// only show the spinner
+
(
textWidth
?
0
:
r
);
const
cy
=
api
.
getHeight
()
/
2
;
const
cy
=
api
.
getHeight
()
/
2
;
opts
.
showSpinner
&&
arc
.
setShape
({
opts
.
showSpinner
&&
arc
.
setShape
({
cx
:
cx
,
cx
:
cx
,
...
...
test/loading.html
浏览文件 @
c50c8c4d
...
@@ -46,6 +46,8 @@ under the License.
...
@@ -46,6 +46,8 @@ under the License.
<div
class=
"chart"
id=
"main2"
></div>
<div
class=
"chart"
id=
"main2"
></div>
<h1>
fontSzie: 25px, arcRadius: 12, lineWidth: 8
</h1>
<h1>
fontSzie: 25px, arcRadius: 12, lineWidth: 8
</h1>
<div
class=
"chart"
id=
"main3"
></div>
<div
class=
"chart"
id=
"main3"
></div>
<h1>
fontSzie: 25, arcRadius: 12, lineWidth: 8
</h1>
<div
class=
"chart"
id=
"main4"
></div>
<script>
<script>
require
([
require
([
...
@@ -57,21 +59,36 @@ under the License.
...
@@ -57,21 +59,36 @@ under the License.
var
chart1
=
echarts
.
init
(
document
.
getElementById
(
'
main1
'
));
var
chart1
=
echarts
.
init
(
document
.
getElementById
(
'
main1
'
));
chart1
.
showLoading
({
chart1
.
showLoading
({
text
:
''
text
:
''
,
spinnerRadius
:
50
});
});
var
chart2
=
echarts
.
init
(
document
.
getElementById
(
'
main2
'
));
var
chart2
=
echarts
.
init
(
document
.
getElementById
(
'
main2
'
));
chart2
.
showLoading
({
chart2
.
showLoading
({
showAnimation
:
false
text
:
'
没有 spinner 时,文字需要居中显示
'
,
textColor
:
'
#000
'
,
fontSize
:
20
,
showSpinner
:
false
});
});
var
chart3
=
echarts
.
init
(
document
.
getElementById
(
'
main3
'
));
var
chart3
=
echarts
.
init
(
document
.
getElementById
(
'
main3
'
));
chart3
.
showLoading
({
chart3
.
showLoading
({
text
:
'
暂
无
数据
'
,
text
:
'
暂
时没有
数据
'
,
textColor
:
'
#000
'
,
textColor
:
'
#000
'
,
fontSize
:
'
25px
'
,
fontSize
:
'
25px
'
,
maskColor
:
'
rgba(255, 255, 255, 0.8)
'
,
maskColor
:
'
rgba(255, 255, 255, 0.8)
'
,
color
:
'
#c23531
'
,
color
:
'
#c23531
'
,
arcRadius
:
12
,
arcRadius
:
20
,
lineWidth
:
8
,
zlevel
:
0
});
var
chart4
=
echarts
.
init
(
document
.
getElementById
(
'
main4
'
));
chart4
.
showLoading
({
text
:
'
暂时没有数据
'
,
textColor
:
'
#000
'
,
fontSize
:
25
,
maskColor
:
'
rgba(255, 255, 255, 0.8)
'
,
color
:
'
#c23531
'
,
arcRadius
:
20
,
lineWidth
:
8
,
lineWidth
:
8
,
zlevel
:
0
zlevel
:
0
});
});
...
@@ -80,6 +97,7 @@ under the License.
...
@@ -80,6 +97,7 @@ under the License.
chart1
.
resize
();
chart1
.
resize
();
chart2
.
resize
();
chart2
.
resize
();
chart3
.
resize
();
chart3
.
resize
();
chart4
.
resize
();
};
};
});
});
</script>
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录