Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
b26b022d
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,发现更多精彩内容 >>
提交
b26b022d
编写于
8月 24, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Axis line
上级
ff00ce71
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
103 addition
and
6 deletion
+103
-6
src/api/graphic.js
src/api/graphic.js
+22
-0
src/component/axis.js
src/component/axis.js
+62
-0
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+2
-2
src/coord/cartesian/AxisModel.js
src/coord/cartesian/AxisModel.js
+5
-1
src/coord/cartesian/Grid.js
src/coord/cartesian/Grid.js
+4
-0
src/coord/cartesian/GridModel.js
src/coord/cartesian/GridModel.js
+5
-0
src/util/number.js
src/util/number.js
+1
-1
src/view/Component.js
src/view/Component.js
+0
-1
test/bar.html
test/bar.html
+2
-1
未找到文件。
src/api/graphic.js
浏览文件 @
b26b022d
...
...
@@ -24,6 +24,8 @@ define(function(require) {
Rect
:
require
(
'
zrender/graphic/shape/Rectangle
'
),
Line
:
require
(
'
zrender/graphic/shape/Line
'
),
/**
* Create a path element from path data string
*/
...
...
@@ -53,6 +55,26 @@ define(function(require) {
matrix
.
scale
(
m
,
m
,
[
sx
,
sy
]);
matrix
.
translate
(
m
,
m
,
[
-
pathRect
.
x
,
-
pathRect
.
y
]);
path
.
applyTransform
(
m
);
},
subPixelOptimizeLine
:
function
(
p0
,
p1
,
lineWidth
)
{
var
round
=
Math
.
round
;
// Sub pixel optimize
var
offset
=
lineWidth
%
2
/
2
;
var
x1
=
round
(
p0
[
0
]);
var
y1
=
round
(
p0
[
1
]);
var
x2
=
round
(
p1
[
0
]);
var
y2
=
round
(
p1
[
1
]);
if
(
x1
===
x2
)
{
x1
+=
offset
;
x2
+=
offset
;
}
if
(
y1
===
y2
)
{
y1
+=
offset
;
y2
+=
offset
;
}
}
}
});
\ No newline at end of file
src/component/axis.js
浏览文件 @
b26b022d
define
(
function
(
require
)
{
'
use strict
'
;
require
(
'
../coord/cartesian/AxisModel
'
);
var
AxisView
=
require
(
'
../echarts
'
).
extendComponentView
({
type
:
'
axis
'
,
render
:
function
(
axisModel
,
ecModel
,
api
)
{
if
(
axisModel
.
get
(
'
axisLine.show
'
))
{
this
.
_renderAxisLine
(
axisModel
,
api
);
}
},
_renderAxisLine
:
function
(
axisModel
,
api
)
{
var
axis
=
axisModel
.
axis
;
var
p1
=
[];
var
p2
=
[];
var
lineWidth
=
axisModel
.
get
(
'
axisLine.lineStyle.width
'
);
var
lineColor
=
axisModel
.
get
(
'
axisLine.lineStyle.color
'
);
var
otherCoord
=
axis
.
otherCoord
;
var
coordExtent
=
axis
.
getCoordExtent
();
if
(
axis
.
isHorizontal
())
{
p1
[
0
]
=
coordExtent
[
0
];
p2
[
0
]
=
coordExtent
[
1
];
p1
[
1
]
=
p2
[
1
]
=
otherCoord
;
}
else
{
p1
[
1
]
=
coordExtent
[
0
];
p2
[
1
]
=
coordExtent
[
1
];
p1
[
0
]
=
p2
[
0
]
=
otherCoord
;
}
api
.
subPixelOptimizeLine
(
p1
,
p2
,
lineWidth
);
this
.
group
.
add
(
new
api
.
Line
({
shape
:
{
x1
:
p1
[
0
],
y1
:
p1
[
1
],
x2
:
p2
[
0
],
y2
:
p2
[
1
]
},
style
:
{
stroke
:
lineColor
,
lineWidth
:
lineWidth
},
z
:
axisModel
.
get
(
'
z
'
)
}));
}
});
AxisView
.
extend
({
type
:
'
xAxis
'
});
AxisView
.
extend
({
type
:
'
yAxis
'
});
});
\ No newline at end of file
src/component/legend/LegendView.js
浏览文件 @
b26b022d
...
...
@@ -25,8 +25,8 @@ define(function (require) {
)
];
var
x
=
0
;
var
y
=
0
;
var
x
=
padding
[
3
]
;
var
y
=
padding
[
0
]
;
legendModel
.
getData
().
each
(
function
(
dataItem
)
{
var
seriesName
=
dataItem
.
name
;
...
...
src/coord/cartesian/AxisModel.js
浏览文件 @
b26b022d
...
...
@@ -133,7 +133,11 @@ define(function(require) {
}
var
AxisModel
=
require
(
'
../../model/Component
'
).
extend
({
type
:
'
axis
'
type
:
'
axis
'
,
/**
* @type {module:echarts/coord/cartesian/Axis2D}
*/
axis
:
null
});
AxisModel
.
AxisX
=
AxisModel
.
extend
({
...
...
src/coord/cartesian/Grid.js
浏览文件 @
b26b022d
...
...
@@ -204,6 +204,10 @@ define(function(require, factory) {
axesList
.
push
(
axisX
);
axesList
.
push
(
axisY
);
// Inject axis into axisModel
xAxisModel
.
axis
=
axisX
;
yAxisModel
.
axis
=
axisY
;
},
this
);
},
this
);
...
...
src/coord/cartesian/GridModel.js
浏览文件 @
b26b022d
...
...
@@ -8,6 +8,11 @@ define(function(require) {
type
:
'
grid
'
,
/**
* @type {module:echarts/coord/cartesian/Grid}
*/
coordinateSystem
:
null
,
defaultOption
:
{
show
:
true
,
zlevel
:
0
,
// 一级层叠
...
...
src/util/number.js
浏览文件 @
b26b022d
...
...
@@ -95,5 +95,5 @@ define(function (require) {
parsePercent
:
parsePercent
,
normalizeCssArray
:
normalizeCssArray
}
}
;
});
\ No newline at end of file
src/view/Component.js
浏览文件 @
b26b022d
...
...
@@ -4,7 +4,6 @@ define(function (require) {
var
Group
=
require
(
'
zrender/container/Group
'
);
var
Component
=
function
()
{
/**
* @type {module:zrender/container/Group}
* @readOnly
...
...
test/bar.html
浏览文件 @
b26b022d
...
...
@@ -18,7 +18,8 @@
'
echarts
'
,
'
echarts/chart/bar
'
,
'
echarts/component/legend
'
,
'
echarts/component/grid
'
'
echarts/component/grid
'
,
'
echarts/component/axis
'
],
function
(
echarts
)
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
),
null
,
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录