Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
2a386b76
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,发现更多精彩内容 >>
提交
2a386b76
编写于
10月 12, 2017
作者:
O
Ovilia
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:ecomfe/echarts
上级
c4dc20ea
1c1d0818
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
66 addition
and
58 deletion
+66
-58
src/component/axis/AngleAxisView.js
src/component/axis/AngleAxisView.js
+14
-7
src/coord/polar/polarCreator.js
src/coord/polar/polarCreator.js
+14
-13
src/scale/Time.js
src/scale/Time.js
+38
-38
未找到文件。
src/component/axis/AngleAxisView.js
浏览文件 @
2a386b76
...
...
@@ -7,9 +7,10 @@ define(function (require) {
var
elementList
=
[
'
axisLine
'
,
'
axisLabel
'
,
'
axisTick
'
,
'
splitLine
'
,
'
splitArea
'
];
function
getAxisLineShape
(
polar
,
r0
,
r
,
angle
)
{
var
start
=
polar
.
coordToPoint
([
r0
,
angle
]);
var
end
=
polar
.
coordToPoint
([
r
,
angle
]);
function
getAxisLineShape
(
polar
,
rExtent
,
angle
)
{
rExtent
[
1
]
>
rExtent
[
0
]
&&
(
rExtent
=
rExtent
.
slice
().
reverse
());
var
start
=
polar
.
coordToPoint
([
rExtent
[
0
],
angle
]);
var
end
=
polar
.
coordToPoint
([
rExtent
[
1
],
angle
]);
return
{
x1
:
start
[
0
],
...
...
@@ -19,6 +20,11 @@ define(function (require) {
};
}
function
getRadiusIdx
(
polar
)
{
var
radiusAxis
=
polar
.
getRadiusAxis
();
return
radiusAxis
.
inverse
?
0
:
1
;
}
require
(
'
./AxisView
'
).
extend
({
type
:
'
angleAxis
'
,
...
...
@@ -60,7 +66,7 @@ define(function (require) {
shape
:
{
cx
:
polar
.
cx
,
cy
:
polar
.
cy
,
r
:
radiusExtent
[
1
]
r
:
radiusExtent
[
getRadiusIdx
(
polar
)
]
},
style
:
lineStyleModel
.
getLineStyle
(),
z2
:
1
,
...
...
@@ -78,10 +84,11 @@ define(function (require) {
var
tickModel
=
angleAxisModel
.
getModel
(
'
axisTick
'
);
var
tickLen
=
(
tickModel
.
get
(
'
inside
'
)
?
-
1
:
1
)
*
tickModel
.
get
(
'
length
'
);
var
radius
=
radiusExtent
[
getRadiusIdx
(
polar
)];
var
lines
=
zrUtil
.
map
(
ticksAngles
,
function
(
tickAngle
)
{
return
new
graphic
.
Line
({
shape
:
getAxisLineShape
(
polar
,
radiusExtent
[
1
],
radiusExtent
[
1
]
+
tickLen
,
tickAngle
)
shape
:
getAxisLineShape
(
polar
,
[
radius
,
radius
+
tickLen
]
,
tickAngle
)
});
});
this
.
group
.
add
(
graphic
.
mergePath
(
...
...
@@ -112,7 +119,7 @@ define(function (require) {
// Use length of ticksAngles because it may remove the last tick to avoid overlapping
for
(
var
i
=
0
;
i
<
ticksAngles
.
length
;
i
++
)
{
var
r
=
radiusExtent
[
1
];
var
r
=
radiusExtent
[
getRadiusIdx
(
polar
)
];
var
p
=
polar
.
coordToPoint
([
r
+
labelMargin
,
labelsAngles
[
i
]]);
var
cx
=
polar
.
cx
;
var
cy
=
polar
.
cy
;
...
...
@@ -156,7 +163,7 @@ define(function (require) {
var
colorIndex
=
(
lineCount
++
)
%
lineColors
.
length
;
splitLines
[
colorIndex
]
=
splitLines
[
colorIndex
]
||
[];
splitLines
[
colorIndex
].
push
(
new
graphic
.
Line
({
shape
:
getAxisLineShape
(
polar
,
radiusExtent
[
0
],
radiusExtent
[
1
]
,
ticksAngles
[
i
])
shape
:
getAxisLineShape
(
polar
,
radiusExtent
,
ticksAngles
[
i
])
}));
}
...
...
src/coord/polar/polarCreator.js
浏览文件 @
2a386b76
...
...
@@ -4,8 +4,9 @@ define(function (require) {
var
Polar
=
require
(
'
./Polar
'
);
var
numberUtil
=
require
(
'
../../util/number
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
axisHelper
=
require
(
'
../../coord/axisHelper
'
);
var
parsePercent
=
numberUtil
.
parsePercent
;
var
niceScaleExtent
=
axisHelper
.
niceScaleExtent
;
// 依赖 PolarModel 做预处理
...
...
@@ -16,20 +17,20 @@ define(function (require) {
* @param {module:echarts/coord/polar/PolarModel} polarModel
* @param {module:echarts/ExtensionAPI} api
*/
function
resizePolar
(
polarModel
,
api
)
{
function
resizePolar
(
polar
,
polar
Model
,
api
)
{
var
center
=
polarModel
.
get
(
'
center
'
);
var
radius
=
polarModel
.
get
(
'
radius
'
);
var
width
=
api
.
getWidth
();
var
height
=
api
.
getHeight
();
var
parsePercent
=
numberUtil
.
parsePercent
;
this
.
cx
=
parsePercent
(
center
[
0
],
width
);
this
.
cy
=
parsePercent
(
center
[
1
],
height
);
polar
.
cx
=
parsePercent
(
center
[
0
],
width
);
polar
.
cy
=
parsePercent
(
center
[
1
],
height
);
var
radiusAxis
=
this
.
getRadiusAxis
();
var
radiusAxis
=
polar
.
getRadiusAxis
();
var
size
=
Math
.
min
(
width
,
height
)
/
2
;
// var idx = radiusAxis.inverse ? 1 : 0;
radiusAxis
.
setExtent
(
0
,
parsePercent
(
radius
,
size
));
var
radius
=
parsePercent
(
polarModel
.
get
(
'
radius
'
),
size
);
radiusAxis
.
inverse
?
radiusAxis
.
setExtent
(
radius
,
0
)
:
radiusAxis
.
setExtent
(
0
,
radius
);
}
/**
...
...
@@ -73,11 +74,11 @@ define(function (require) {
axis
.
type
=
axisModel
.
get
(
'
type
'
);
axis
.
scale
=
axisHelper
.
createScaleByModel
(
axisModel
);
axis
.
onBand
=
axisModel
.
get
(
'
boundaryGap
'
)
&&
axis
.
type
===
'
category
'
;
axis
.
inverse
=
axisModel
.
get
(
'
inverse
'
);
// FIXME Radius axis not support inverse axis
if
(
axisModel
.
mainType
===
'
angleAxis
'
)
{
axis
.
inverse
^=
axisModel
.
get
(
'
clockwise
'
);
var
startAngle
=
axisModel
.
get
(
'
startAngle
'
);
axis
.
inverse
=
axisModel
.
get
(
'
inverse
'
)
^
axisModel
.
get
(
'
clockwise
'
);
axis
.
setExtent
(
startAngle
,
startAngle
+
(
axis
.
inverse
?
-
360
:
360
));
}
...
...
@@ -96,7 +97,6 @@ define(function (require) {
ecModel
.
eachComponent
(
'
polar
'
,
function
(
polarModel
,
idx
)
{
var
polar
=
new
Polar
(
idx
);
// Inject resize and update method
polar
.
resize
=
resizePolar
;
polar
.
update
=
updatePolarScale
;
var
radiusAxis
=
polar
.
getRadiusAxis
();
...
...
@@ -108,7 +108,8 @@ define(function (require) {
setAxis
(
radiusAxis
,
radiusAxisModel
);
setAxis
(
angleAxis
,
angleAxisModel
);
polar
.
resize
(
polarModel
,
api
);
resizePolar
(
polar
,
polarModel
,
api
);
polarList
.
push
(
polar
);
polarModel
.
coordinateSystem
=
polar
;
...
...
src/scale/Time.js
浏览文件 @
2a386b76
...
...
@@ -35,7 +35,7 @@ define(function (require) {
var
bisect
=
function
(
a
,
x
,
lo
,
hi
)
{
while
(
lo
<
hi
)
{
var
mid
=
lo
+
hi
>>>
1
;
if
(
a
[
mid
][
2
]
<
x
)
{
if
(
a
[
mid
][
1
]
<
x
)
{
lo
=
mid
+
1
;
}
else
{
...
...
@@ -115,7 +115,7 @@ define(function (require) {
var
idx
=
bisect
(
scaleLevels
,
approxInterval
,
0
,
scaleLevelsLen
);
var
level
=
scaleLevels
[
Math
.
min
(
idx
,
scaleLevelsLen
-
1
)];
var
interval
=
level
[
2
];
var
interval
=
level
[
1
];
// Same with interval scale if span is much larger than 1 year
if
(
level
[
0
]
===
'
year
'
)
{
var
yearSpan
=
span
/
interval
;
...
...
@@ -156,42 +156,42 @@ define(function (require) {
// Steps from d3
var
scaleLevels
=
[
// Format
step
interval
[
'
hh:mm:ss
'
,
1
,
ONE_SECOND
],
// 1s
[
'
hh:mm:ss
'
,
5
,
ONE_SECOND
*
5
],
// 5s
[
'
hh:mm:ss
'
,
10
,
ONE_SECOND
*
10
],
// 10s
[
'
hh:mm:ss
'
,
15
,
ONE_SECOND
*
15
],
// 15s
[
'
hh:mm:ss
'
,
30
,
ONE_SECOND
*
30
],
// 30s
[
'
hh:mm
\n
MM-dd
'
,
1
,
ONE_MINUTE
],
// 1m
[
'
hh:mm
\n
MM-dd
'
,
5
,
ONE_MINUTE
*
5
],
// 5m
[
'
hh:mm
\n
MM-dd
'
,
10
,
ONE_MINUTE
*
10
],
// 10m
[
'
hh:mm
\n
MM-dd
'
,
15
,
ONE_MINUTE
*
15
],
// 15m
[
'
hh:mm
\n
MM-dd
'
,
30
,
ONE_MINUTE
*
30
],
// 30m
[
'
hh:mm
\n
MM-dd
'
,
1
,
ONE_HOUR
],
// 1h
[
'
hh:mm
\n
MM-dd
'
,
2
,
ONE_HOUR
*
2
],
// 2h
[
'
hh:mm
\n
MM-dd
'
,
6
,
ONE_HOUR
*
6
],
// 6h
[
'
hh:mm
\n
MM-dd
'
,
12
,
ONE_HOUR
*
12
],
// 12h
[
'
MM-dd
\n
yyyy
'
,
1
,
ONE_DAY
],
// 1d
[
'
MM-dd
\n
yyyy
'
,
2
,
ONE_DAY
*
2
],
// 2d
[
'
MM-dd
\n
yyyy
'
,
3
,
ONE_DAY
*
3
],
// 3d
[
'
MM-dd
\n
yyyy
'
,
4
,
ONE_DAY
*
4
],
// 4d
[
'
MM-dd
\n
yyyy
'
,
5
,
ONE_DAY
*
5
],
// 5d
[
'
MM-dd
\n
yyyy
'
,
6
,
ONE_DAY
*
6
],
// 6d
[
'
week
'
,
7
,
ONE_DAY
*
7
],
// 7d
[
'
MM-dd
\n
yyyy
'
,
10
,
ONE_DAY
*
10
],
// 10d
[
'
week
'
,
14
,
ONE_DAY
*
14
],
// 2w
[
'
week
'
,
21
,
ONE_DAY
*
21
],
// 3w
[
'
month
'
,
1
,
ONE_DAY
*
31
],
// 1M
[
'
week
'
,
42
,
ONE_DAY
*
42
],
// 6w
[
'
month
'
,
2
,
ONE_DAY
*
62
],
// 2M
[
'
week
'
,
70
,
ONE_DAY
*
42
],
// 10w
[
'
quarter
'
,
3
,
ONE_DAY
*
380
/
4
],
// 3M
[
'
month
'
,
4
,
ONE_DAY
*
31
*
4
],
// 4M
[
'
month
'
,
5
,
ONE_DAY
*
31
*
5
],
// 5M
[
'
half-year
'
,
6
,
ONE_DAY
*
380
/
2
],
// 6M
[
'
month
'
,
8
,
ONE_DAY
*
31
*
8
],
// 8M
[
'
month
'
,
10
,
ONE_DAY
*
31
*
10
],
// 10M
[
'
year
'
,
1
,
ONE_DAY
*
380
]
// 1Y
// Format
interval
[
'
hh:mm:ss
'
,
ONE_SECOND
],
// 1s
[
'
hh:mm:ss
'
,
ONE_SECOND
*
5
],
// 5s
[
'
hh:mm:ss
'
,
ONE_SECOND
*
10
],
// 10s
[
'
hh:mm:ss
'
,
ONE_SECOND
*
15
],
// 15s
[
'
hh:mm:ss
'
,
ONE_SECOND
*
30
],
// 30s
[
'
hh:mm
\n
MM-dd
'
,
ONE_MINUTE
],
// 1m
[
'
hh:mm
\n
MM-dd
'
,
ONE_MINUTE
*
5
],
// 5m
[
'
hh:mm
\n
MM-dd
'
,
ONE_MINUTE
*
10
],
// 10m
[
'
hh:mm
\n
MM-dd
'
,
ONE_MINUTE
*
15
],
// 15m
[
'
hh:mm
\n
MM-dd
'
,
ONE_MINUTE
*
30
],
// 30m
[
'
hh:mm
\n
MM-dd
'
,
ONE_HOUR
],
// 1h
[
'
hh:mm
\n
MM-dd
'
,
ONE_HOUR
*
2
],
// 2h
[
'
hh:mm
\n
MM-dd
'
,
ONE_HOUR
*
6
],
// 6h
[
'
hh:mm
\n
MM-dd
'
,
ONE_HOUR
*
12
],
// 12h
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
],
// 1d
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
*
2
],
// 2d
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
*
3
],
// 3d
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
*
4
],
// 4d
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
*
5
],
// 5d
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
*
6
],
// 6d
[
'
week
'
,
ONE_DAY
*
7
],
// 7d
[
'
MM-dd
\n
yyyy
'
,
ONE_DAY
*
10
],
// 10d
[
'
week
'
,
ONE_DAY
*
14
],
// 2w
[
'
week
'
,
ONE_DAY
*
21
],
// 3w
[
'
month
'
,
ONE_DAY
*
31
],
// 1M
[
'
week
'
,
ONE_DAY
*
42
],
// 6w
[
'
month
'
,
ONE_DAY
*
62
],
// 2M
[
'
week
'
,
ONE_DAY
*
42
],
// 10w
[
'
quarter
'
,
ONE_DAY
*
380
/
4
],
// 3M
[
'
month
'
,
ONE_DAY
*
31
*
4
],
// 4M
[
'
month
'
,
ONE_DAY
*
31
*
5
],
// 5M
[
'
half-year
'
,
ONE_DAY
*
380
/
2
],
// 6M
[
'
month
'
,
ONE_DAY
*
31
*
8
],
// 8M
[
'
month
'
,
ONE_DAY
*
31
*
10
],
// 10M
[
'
year
'
,
ONE_DAY
*
380
]
// 1Y
];
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录