Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
ec6e366f
E
echarts
项目概览
alon@wen
/
echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ec6e366f
编写于
9月 11, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename axis mapData, unmapData to dataToCoord, coordToData
上级
e8fe8870
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
56 addition
and
45 deletion
+56
-45
src/component/angleAxis.js
src/component/angleAxis.js
+2
-2
src/component/axis.js
src/component/axis.js
+3
-3
src/component/radiusAxis.js
src/component/radiusAxis.js
+11
-11
src/coord/Axis.js
src/coord/Axis.js
+25
-16
src/coord/cartesian/Axis2D.js
src/coord/cartesian/Axis2D.js
+1
-5
src/coord/cartesian/Cartesian2D.js
src/coord/cartesian/Cartesian2D.js
+10
-4
src/coord/polar/AngleAxis.js
src/coord/polar/AngleAxis.js
+2
-2
src/coord/polar/RadiusAxis.js
src/coord/polar/RadiusAxis.js
+2
-2
未找到文件。
src/component/angleAxis.js
浏览文件 @
ec6e366f
...
...
@@ -42,7 +42,7 @@ define(function(require) {
var
cx
=
polar
.
cx
;
var
cy
=
polar
.
cy
;
var
radiusExtent
=
polar
.
getRadiusAxis
().
getExtent
();
var
ticksAngles
=
angleAxis
.
getTicks
Position
s
();
var
ticksAngles
=
angleAxis
.
getTicks
Coord
s
();
if
(
angleAxis
.
type
!==
'
category
'
)
{
// Remove the last tick which will overlap the first tick
...
...
@@ -107,7 +107,7 @@ define(function(require) {
var
labels
=
angleAxisModel
.
formatLabels
(
axis
.
scale
.
getTicksLabels
());
var
labelMargin
=
labelModel
.
get
(
'
margin
'
);
var
labelsAngles
=
axis
.
getLabels
Position
s
();
var
labelsAngles
=
axis
.
getLabels
Coord
s
();
// Use length of ticksAngles because it may remove the last tick to avoid overlapping
for
(
var
i
=
0
;
i
<
ticksAngles
.
length
;
i
++
)
{
...
...
src/component/axis.js
浏览文件 @
ec6e366f
...
...
@@ -129,7 +129,7 @@ define(function(require) {
}
var
axisPosition
=
axis
.
position
;
var
ticksCoords
=
axis
.
getTicks
Position
s
();
var
ticksCoords
=
axis
.
getTicks
Coord
s
();
var
tickLines
=
[];
for
(
var
i
=
0
;
i
<
ticksCoords
.
length
;
i
++
)
{
...
...
@@ -325,7 +325,7 @@ define(function(require) {
var
splitLines
=
[];
var
lineCount
=
0
;
var
ticksCoords
=
axis
.
getTicks
Position
s
();
var
ticksCoords
=
axis
.
getTicks
Coord
s
();
var
p1
=
[];
var
p2
=
[];
...
...
@@ -390,7 +390,7 @@ define(function(require) {
var
areaColors
=
splitAreaModel
.
get
(
'
areaStyle.color
'
);
var
gridRect
=
gridModel
.
coordinateSystem
.
getRect
();
var
ticksCoords
=
axis
.
getTicks
Position
s
();
var
ticksCoords
=
axis
.
getTicks
Coord
s
();
var
prevX
=
ticksCoords
[
0
];
var
prevY
=
ticksCoords
[
0
];
...
...
src/component/radiusAxis.js
浏览文件 @
ec6e366f
...
...
@@ -48,10 +48,10 @@ define(function(require) {
var
cx
=
polar
.
cx
;
var
cy
=
polar
.
cy
;
var
angleExtent
=
polar
.
getAngleAxis
().
getExtent
();
var
ticks
Positions
=
radiusAxis
.
getTicksPosition
s
();
var
ticks
Coords
=
radiusAxis
.
getTicksCoord
s
();
zrUtil
.
each
(
elementList
,
function
(
name
)
{
if
(
radiusAxisModel
.
get
(
name
+
'
.show
'
))
{
this
[
'
_
'
+
name
](
radiusAxisModel
,
ticks
Position
s
,
angleExtent
,
cx
,
cy
,
api
);
this
[
'
_
'
+
name
](
radiusAxisModel
,
ticks
Coord
s
,
angleExtent
,
cx
,
cy
,
api
);
}
},
this
);
...
...
@@ -64,7 +64,7 @@ define(function(require) {
/**
* @private
*/
_axisLine
:
function
(
radiusAxisModel
,
ticks
Position
s
,
angleExtent
,
cx
,
cy
,
api
)
{
_axisLine
:
function
(
radiusAxisModel
,
ticks
Coord
s
,
angleExtent
,
cx
,
cy
,
api
)
{
var
arc
=
new
api
.
Line
({
shape
:
getAxisLineShape
(
radiusAxisModel
,
cx
,
cy
),
style
:
radiusAxisModel
.
getModel
(
'
axisLine.lineStyle
'
).
getLineStyle
()
...
...
@@ -76,7 +76,7 @@ define(function(require) {
/**
* @private
*/
_axisTick
:
function
(
radiusAxisModel
,
ticks
Position
s
,
angleExtent
,
cx
,
cy
,
api
)
{
_axisTick
:
function
(
radiusAxisModel
,
ticks
Coord
s
,
angleExtent
,
cx
,
cy
,
api
)
{
var
tickModel
=
radiusAxisModel
.
getModel
(
'
axisTick
'
);
var
lineShape
=
getAxisLineShape
(
radiusAxisModel
,
cx
,
cy
);
...
...
@@ -93,7 +93,7 @@ define(function(require) {
var
p1
=
[];
var
p2
=
[];
var
tickLen
=
tickModel
.
get
(
'
length
'
);
var
lines
=
zrUtil
.
map
(
ticks
Position
s
,
function
(
tickPosition
)
{
var
lines
=
zrUtil
.
map
(
ticks
Coord
s
,
function
(
tickPosition
)
{
// Get point on axis
vector
.
lerp
(
p1
,
start
,
end
,
tickPosition
/
len
);
vector
.
scaleAndAdd
(
p2
,
p1
,
direction
,
tickLen
);
...
...
@@ -117,7 +117,7 @@ define(function(require) {
/**
* @private
*/
_axisLabel
:
function
(
radiusAxisModel
,
ticks
Position
s
,
angleExtent
,
cx
,
cy
,
api
)
{
_axisLabel
:
function
(
radiusAxisModel
,
ticks
Coord
s
,
angleExtent
,
cx
,
cy
,
api
)
{
var
axis
=
radiusAxisModel
.
axis
;
var
labelModel
=
radiusAxisModel
.
getModel
(
'
axisLabel
'
);
var
textStyleModel
=
labelModel
.
getModel
(
'
textStyle
'
);
...
...
@@ -137,7 +137,7 @@ define(function(require) {
var
p
=
[];
var
labelMargin
=
labelModel
.
get
(
'
margin
'
);
var
labelsPositions
=
axis
.
getLabels
Position
s
();
var
labelsPositions
=
axis
.
getLabels
Coord
s
();
// FIXME Text align and text baseline when axis angle is 90 degree
for
(
var
i
=
0
;
i
<
labelsPositions
.
length
;
i
++
)
{
...
...
@@ -161,7 +161,7 @@ define(function(require) {
/**
* @private
*/
_splitLine
:
function
(
radiusAxisModel
,
ticks
Position
s
,
angleExtent
,
cx
,
cy
,
api
)
{
_splitLine
:
function
(
radiusAxisModel
,
ticks
Coord
s
,
angleExtent
,
cx
,
cy
,
api
)
{
var
splitLineModel
=
radiusAxisModel
.
getModel
(
'
splitLine
'
);
var
lineStyleModel
=
splitLineModel
.
getModel
(
'
lineStyle
'
);
var
lineColors
=
lineStyleModel
.
get
(
'
color
'
);
...
...
@@ -172,14 +172,14 @@ define(function(require) {
var
splitLines
=
[];
for
(
var
i
=
0
;
i
<
ticks
Position
s
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
ticks
Coord
s
.
length
;
i
++
)
{
var
colorIndex
=
(
lineCount
++
)
%
lineColors
.
length
;
splitLines
[
colorIndex
]
=
splitLines
[
colorIndex
]
||
[];
splitLines
[
colorIndex
].
push
(
new
api
.
Circle
({
shape
:
{
cx
:
cx
,
cy
:
cy
,
r
:
ticks
Position
s
[
i
]
r
:
ticks
Coord
s
[
i
]
},
silent
:
true
}))
...
...
@@ -203,7 +203,7 @@ define(function(require) {
/**
* @private
*/
_splitArea
:
function
(
radiusAxisModel
,
ticks
Position
s
,
angleExtent
,
cx
,
cy
,
api
)
{
_splitArea
:
function
(
radiusAxisModel
,
ticks
Coord
s
,
angleExtent
,
cx
,
cy
,
api
)
{
}
});
...
...
src/coord/Axis.js
浏览文件 @
ec6e366f
...
...
@@ -50,6 +50,15 @@ define(function (require) {
constructor
:
Axis
,
/**
* If axis extent contain give coord
* @param {number}
*/
contain
:
function
(
coord
)
{
var
extent
=
this
.
_extent
;
return
coord
>=
extent
[
0
]
&&
coord
<=
extent
[
1
];
},
/**
* Get coord extent
* @return {Array.<number>}
...
...
@@ -74,12 +83,12 @@ define(function (require) {
},
/**
*
Map a data to extent
. Data is the rank if it has a ordinal scale
*
Convert data to coord
. Data is the rank if it has a ordinal scale
* @param {number} data
* @param {boolean} clamp
* @return {number}
*/
mapData
:
function
(
data
,
clamp
)
{
dataToCoord
:
function
(
data
,
clamp
)
{
// PENDING
if
(
data
==
null
||
data
===
'
-
'
)
{
return
NaN
;
...
...
@@ -95,12 +104,12 @@ define(function (require) {
},
/**
*
Unmap a
data. Data is the rank if it has a ordinal scale
*
Convert coord to
data. Data is the rank if it has a ordinal scale
* @param {number} mapped
* @param {boolean} clamp
* @return {number}
*/
unmap
Data
:
function
(
mapped
,
clamp
)
{
coordTo
Data
:
function
(
mapped
,
clamp
)
{
var
extent
=
this
.
getExtent
();
if
(
this
.
onBand
)
{
...
...
@@ -114,40 +123,40 @@ define(function (require) {
/**
* @return {Array.<number>}
*/
getTicks
Position
s
:
function
()
{
getTicks
Coord
s
:
function
()
{
if
(
this
.
onBand
)
{
var
bands
=
this
.
getBands
();
var
position
s
=
[];
var
coord
s
=
[];
for
(
var
i
=
0
;
i
<
bands
.
length
;
i
++
)
{
position
s
.
push
(
bands
[
i
][
0
]);
coord
s
.
push
(
bands
[
i
][
0
]);
}
if
(
bands
[
i
-
1
])
{
position
s
.
push
(
bands
[
i
-
1
][
1
]);
coord
s
.
push
(
bands
[
i
-
1
][
1
]);
}
return
position
s
;
return
coord
s
;
}
else
{
return
zrUtil
.
map
(
this
.
scale
.
getTicks
(),
this
.
mapData
,
this
);
return
zrUtil
.
map
(
this
.
scale
.
getTicks
(),
this
.
dataToCoord
,
this
);
}
},
/**
*
Position
s of labels are on the ticks or on the middle of bands
*
Coord
s of labels are on the ticks or on the middle of bands
* @return {Array.<number>}
*/
getLabels
Position
s
:
function
()
{
getLabels
Coord
s
:
function
()
{
if
(
this
.
onBand
)
{
var
bands
=
this
.
getBands
();
var
position
s
=
[];
var
coord
s
=
[];
var
band
;
for
(
var
i
=
0
;
i
<
bands
.
length
;
i
++
)
{
band
=
bands
[
i
];
position
s
.
push
((
band
[
0
]
+
band
[
1
])
/
2
);
coord
s
.
push
((
band
[
0
]
+
band
[
1
])
/
2
);
}
return
position
s
;
return
coord
s
;
}
else
{
return
zrUtil
.
map
(
this
.
scale
.
getTicks
(),
this
.
mapData
,
this
);
return
zrUtil
.
map
(
this
.
scale
.
getTicks
(),
this
.
dataToCoord
,
this
);
}
},
...
...
src/coord/cartesian/Axis2D.js
浏览文件 @
ec6e366f
...
...
@@ -42,11 +42,7 @@ define(function (require) {
isHorizontal
:
function
()
{
var
position
=
this
.
position
;
return
position
===
'
top
'
||
position
===
'
bottom
'
;
},
dataToCoord
:
Axis
.
prototype
.
mapData
,
coordToData
:
Axis
.
prototype
.
unmapData
}
};
zrUtil
.
inherits
(
Axis2D
,
Axis
);
...
...
src/coord/cartesian/Cartesian2D.js
浏览文件 @
ec6e366f
...
...
@@ -14,6 +14,14 @@ define(function(require) {
type
:
'
cartesian2d
'
,
/**
* If contain coord
*/
containPoint
:
function
(
x
,
y
)
{
return
this
.
getAxis
(
'
x
'
).
contain
(
x
)
&&
this
.
getAxis
(
'
y
'
).
contain
(
y
);
},
/**
* Convert series data to coorindates
* @param {module:echarts/data/List} data
...
...
@@ -25,12 +33,10 @@ define(function(require) {
var
xAxis
=
this
.
getAxis
(
'
x
'
);
var
yAxis
=
this
.
getAxis
(
'
y
'
);
var
xIndex
=
xAxis
.
isHorizontal
()
?
0
:
1
;
return
data
.
map
(
function
(
dataItem
)
{
var
coord
=
[];
coord
[
xIndex
]
=
xAxis
.
dataToCoord
(
dataItem
.
getX
(
true
));
coord
[
1
-
xIndex
]
=
yAxis
.
dataToCoord
(
dataItem
.
getY
(
true
));
coord
[
0
]
=
xAxis
.
dataToCoord
(
dataItem
.
getX
(
true
));
coord
[
1
]
=
yAxis
.
dataToCoord
(
dataItem
.
getY
(
true
));
return
coord
;
},
this
);
},
...
...
src/coord/polar/AngleAxis.js
浏览文件 @
ec6e366f
...
...
@@ -25,9 +25,9 @@ define(function(require) {
constructor
:
AngleAxis
,
dataToAngle
:
Axis
.
prototype
.
mapData
,
dataToAngle
:
Axis
.
prototype
.
dataToCoord
,
angleToData
:
Axis
.
prototype
.
unmap
Data
angleToData
:
Axis
.
prototype
.
coordTo
Data
};
zrUtil
.
inherits
(
AngleAxis
,
Axis
);
...
...
src/coord/polar/RadiusAxis.js
浏览文件 @
ec6e366f
...
...
@@ -23,9 +23,9 @@ define(function (require) {
constructor
:
RadiusAxis
,
dataToRadius
:
Axis
.
prototype
.
mapData
,
dataToRadius
:
Axis
.
prototype
.
dataToCoord
,
radiusToData
:
Axis
.
prototype
.
unmap
Data
radiusToData
:
Axis
.
prototype
.
coordTo
Data
};
zrUtil
.
inherits
(
RadiusAxis
,
Axis
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录