Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
dfc339ed
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,发现更多精彩内容 >>
提交
dfc339ed
编写于
9月 23, 2013
作者:
K
kener
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pie、polar、title自适应bug fix
上级
8eba8d0c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
66 addition
and
17 deletion
+66
-17
src/chart/pie.js
src/chart/pie.js
+9
-2
src/component/base.js
src/component/base.js
+31
-3
src/component/polar.js
src/component/polar.js
+17
-11
src/component/title.js
src/component/title.js
+6
-0
src/config.js
src/config.js
+3
-1
未找到文件。
src/chart/pie.js
浏览文件 @
dfc339ed
...
...
@@ -589,7 +589,6 @@ define(function(require) {
'
recursive
'
:
true
}
);
// 圆心坐标,无则为自适应居中
if
(
!
opt
.
center
||
(
opt
.
center
&&
!
(
opt
.
center
instanceof
Array
)))
{
...
...
@@ -606,7 +605,7 @@ define(function(require) {
opt
.
center
[
1
]
=
Math
.
round
(
zr
.
getHeight
()
/
2
);
}
}
// 传数组实现环形图,[内半径,外半径],传单个则默认为外半径为
if
(
typeof
opt
.
radius
==
'
undefined
'
)
{
opt
.
radius
=
[
...
...
@@ -655,11 +654,18 @@ define(function(require) {
if
(
newOption
)
{
option
=
newOption
;
series
=
option
.
series
;
self
.
backupAdaptiveParams
(
series
,
[
'
center
'
,
'
radius
'
]);
}
self
.
clear
();
_buildShape
();
}
function
resize
()
{
// 复位录原始定义
self
.
restoreAdaptiveParams
(
series
,
[
'
center
'
,
'
radius
'
]);
refresh
();
}
/**
* 动态数据增加动画
* 心跳效果
...
...
@@ -1124,6 +1130,7 @@ define(function(require) {
// 接口方法
self
.
init
=
init
;
self
.
refresh
=
refresh
;
self
.
resize
=
resize
;
self
.
addDataAnimation
=
addDataAnimation
;
self
.
animation
=
animation
;
self
.
onclick
=
onclick
;
...
...
src/component/base.js
浏览文件 @
dfc339ed
...
...
@@ -164,7 +164,7 @@ define(function(require) {
var
y
=
pos
[
1
];
var
ret
=
[];
if
(
typeof
(
x
)
==
'
string
'
)
{
if
(
trim
(
x
).
substr
(
-
1
)
==
'
%
'
)
{
if
(
_
trim
(
x
).
substr
(
-
1
)
==
'
%
'
)
{
ret
[
0
]
=
parseFloat
(
x
)
/
100
*
this
.
zr
.
getWidth
();
}
else
{
ret
[
0
]
=
parseFloat
(
x
);
...
...
@@ -174,7 +174,7 @@ define(function(require) {
}
if
(
typeof
(
y
)
==
'
string
'
)
{
if
(
trim
(
y
).
substr
(
-
1
)
==
'
%
'
)
{
if
(
_
trim
(
y
).
substr
(
-
1
)
==
'
%
'
)
{
ret
[
1
]
=
parseFloat
(
y
)
/
100
*
this
.
zr
.
getHeight
();
}
else
{
ret
[
1
]
=
parseFloat
(
y
);
...
...
@@ -186,10 +186,36 @@ define(function(require) {
return
ret
;
}
function
trim
(
str
)
{
function
_
trim
(
str
)
{
return
str
.
replace
(
/^
\s\s
*/
,
''
).
replace
(
/
\s\s
*$/
,
''
);
}
// 记录自适应原始定义,resize用
function
backupAdaptiveParams
(
series
,
attrs
,
isAll
)
{
for
(
var
i
=
0
,
l
=
series
.
length
;
i
<
l
;
i
++
)
{
if
(
isAll
||
series
[
i
].
type
==
self
.
type
)
{
for
(
var
j
=
0
,
k
=
attrs
.
length
;
j
<
k
;
j
++
)
{
series
[
i
][
'
__
'
+
attrs
[
i
]]
=
zrUtil
.
clone
(
series
[
i
][
attrs
[
i
]]
);
}
}
}
}
// 还原自适应原始定义,resize用
function
restoreAdaptiveParams
(
series
,
attrs
,
isAll
)
{
for
(
var
i
=
0
,
l
=
series
.
length
;
i
<
l
;
i
++
)
{
if
(
isAll
||
series
[
i
].
type
==
self
.
type
)
{
for
(
var
j
=
0
,
k
=
attrs
.
length
;
j
<
k
;
j
++
)
{
series
[
i
][
attrs
[
i
]]
=
zrUtil
.
clone
(
series
[
i
][
'
__
'
+
attrs
[
i
]]
);
}
}
}
}
function
resize
()
{
self
.
refresh
&&
self
.
refresh
();
}
...
...
@@ -226,6 +252,8 @@ define(function(require) {
self
.
calAbsolute
=
calAbsolute
;
self
.
clear
=
clear
;
self
.
dispose
=
dispose
;
self
.
backupAdaptiveParams
=
backupAdaptiveParams
;
self
.
restoreAdaptiveParams
=
restoreAdaptiveParams
;
self
.
resize
=
resize
;
}
...
...
src/component/polar.js
浏览文件 @
dfc339ed
...
...
@@ -30,17 +30,10 @@ define(
var
_queryTarget
;
function
init
(
newOption
,
newComponent
)
{
option
=
newOption
;
component
=
newComponent
;
self
.
clear
();
polar
=
option
.
polar
;
series
=
option
.
series
;
_buildShape
();
refresh
(
newOption
);
}
/**
* 绘制图形
*/
...
...
@@ -920,15 +913,28 @@ define(
return
polar
[
index
].
indicator
;
}
/**
/**
* 刷新
*/
function
refresh
()
{
function
refresh
(
newOption
)
{
if
(
newOption
)
{
option
=
newOption
;
polar
=
option
.
polar
;
series
=
option
.
series
;
self
.
backupAdaptiveParams
(
polar
,[
'
center
'
,
'
radius
'
],
true
);
}
self
.
clear
();
_buildShape
();
}
function
resize
()
{
// 复位录原始定义
self
.
restoreAdaptiveParams
(
polar
,
[
'
center
'
,
'
radius
'
],
true
);
refresh
();
}
self
.
refresh
=
refresh
;
self
.
resize
=
resize
;
self
.
reformOption
=
reformOption
;
self
.
getVector
=
getVector
;
...
...
src/component/title.js
浏览文件 @
dfc339ed
...
...
@@ -247,9 +247,15 @@ define(function (require) {
_buildShape
();
}
}
function
resize
()
{
self
.
clear
();
_buildShape
();
}
self
.
init
=
init
;
self
.
refresh
=
refresh
;
self
.
resize
=
resize
;
init
(
option
);
}
...
...
src/config.js
浏览文件 @
dfc339ed
...
...
@@ -328,7 +328,9 @@ define(function() {
},
polar
:
{
startAngle
:
90
,
// center: null, // 默认全局居中
// radius: [0, min(width,height) - 50],
startAngle
:
90
,
splitNumber
:
5
,
name
:
{
show
:
true
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录