Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
24ee6345
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,发现更多精彩内容 >>
提交
24ee6345
编写于
10月 21, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Background and border rendering in title and legend
上级
5be59404
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
2 deletion
+63
-2
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+35
-1
src/component/title.js
src/component/title.js
+28
-1
未找到文件。
src/component/legend/LegendView.js
浏览文件 @
24ee6345
...
@@ -5,6 +5,7 @@ define(function (require) {
...
@@ -5,6 +5,7 @@ define(function (require) {
var
graphic
=
require
(
'
../../util/graphic
'
);
var
graphic
=
require
(
'
../../util/graphic
'
);
var
layout
=
require
(
'
../../util/layout
'
);
var
layout
=
require
(
'
../../util/layout
'
);
var
formatUtil
=
require
(
'
../../util/format
'
);
var
LEGEND_DISABLE_COLOR
=
'
#ccc
'
;
var
LEGEND_DISABLE_COLOR
=
'
#ccc
'
;
...
@@ -21,6 +22,7 @@ define(function (require) {
...
@@ -21,6 +22,7 @@ define(function (require) {
var
y
=
legendModel
.
get
(
'
y
'
);
var
y
=
legendModel
.
get
(
'
y
'
);
var
x2
=
legendModel
.
get
(
'
x2
'
);
var
x2
=
legendModel
.
get
(
'
x2
'
);
var
y2
=
legendModel
.
get
(
'
y2
'
);
var
y2
=
legendModel
.
get
(
'
y2
'
);
if
(
!
x
&&
!
x2
)
{
if
(
!
x
&&
!
x2
)
{
x
=
'
center
'
;
x
=
'
center
'
;
}
}
...
@@ -123,11 +125,43 @@ define(function (require) {
...
@@ -123,11 +125,43 @@ define(function (require) {
},
this
);
},
this
);
layout
.
box
(
layout
.
box
(
legendModel
.
get
(
'
orient
'
),
group
,
legendModel
.
get
(
'
orient
'
),
group
,
legendModel
.
get
(
'
itemGap
'
)
legendModel
.
get
(
'
itemGap
'
)
);
);
positionGroup
(
group
,
legendModel
,
api
);
positionGroup
(
group
,
legendModel
,
api
);
// Render backgroun after group is positioned
// Or will get rect of group with padding
// FIXME
this
.
_renderBG
(
legendModel
,
group
)
},
// FIXME 通用?
_renderBG
:
function
(
legendModel
,
group
)
{
var
padding
=
formatUtil
.
normalizeCssArray
(
legendModel
.
get
(
'
padding
'
)
);
var
boundingRect
=
group
.
getBoundingRect
();
var
rect
=
new
graphic
.
Rect
({
shape
:
{
x
:
boundingRect
.
x
-
padding
[
3
],
y
:
boundingRect
.
y
-
padding
[
0
],
width
:
boundingRect
.
width
+
padding
[
1
]
+
padding
[
3
],
height
:
boundingRect
.
height
+
padding
[
0
]
+
padding
[
2
]
},
style
:
{
stroke
:
legendModel
.
get
(
'
borderColor
'
),
fill
:
legendModel
.
get
(
'
backgroundColor
'
),
lineWidth
:
legendModel
.
get
(
'
borderWidth
'
)
},
// Behind item elements
z2
:
-
1
});
graphic
.
subPixelOptimizeRect
(
rect
);
group
.
add
(
rect
);
},
},
_createItem
:
function
(
_createItem
:
function
(
...
...
src/component/title.js
浏览文件 @
24ee6345
...
@@ -5,6 +5,7 @@ define(function(require) {
...
@@ -5,6 +5,7 @@ define(function(require) {
var
echarts
=
require
(
'
../echarts
'
);
var
echarts
=
require
(
'
../echarts
'
);
var
graphic
=
require
(
'
../util/graphic
'
);
var
graphic
=
require
(
'
../util/graphic
'
);
var
layout
=
require
(
'
../util/layout
'
);
var
layout
=
require
(
'
../util/layout
'
);
var
formatUtil
=
require
(
'
../util/format
'
);
// Model
// Model
echarts
.
extendComponentModel
({
echarts
.
extendComponentModel
({
...
@@ -140,7 +141,7 @@ define(function(require) {
...
@@ -140,7 +141,7 @@ define(function(require) {
},
{
},
{
width
:
api
.
getWidth
(),
width
:
api
.
getWidth
(),
height
:
api
.
getHeight
()
height
:
api
.
getHeight
()
},
null
,
true
,
false
},
titleModel
.
get
(
'
padding
'
)
,
true
,
false
);
);
// Adjust text align based on position
// Adjust text align based on position
if
(
!
textAlign
)
{
if
(
!
textAlign
)
{
...
@@ -157,6 +158,32 @@ define(function(require) {
...
@@ -157,6 +158,32 @@ define(function(require) {
}
}
}
}
textEl
.
style
.
textAlign
=
subTextEl
.
style
.
textAlign
=
textAlign
;
textEl
.
style
.
textAlign
=
subTextEl
.
style
.
textAlign
=
textAlign
;
textEl
.
dirty
();
subTextEl
.
dirty
();
// Render background
var
padding
=
formatUtil
.
normalizeCssArray
(
titleModel
.
get
(
'
padding
'
)
);
var
boundingRect
=
group
.
getBoundingRect
();
var
rect
=
new
graphic
.
Rect
({
shape
:
{
x
:
boundingRect
.
x
-
padding
[
3
],
y
:
boundingRect
.
y
-
padding
[
0
],
width
:
boundingRect
.
width
+
padding
[
1
]
+
padding
[
3
],
height
:
boundingRect
.
height
+
padding
[
0
]
+
padding
[
2
]
},
style
:
{
stroke
:
titleModel
.
get
(
'
borderColor
'
),
fill
:
titleModel
.
get
(
'
backgroundColor
'
),
lineWidth
:
titleModel
.
get
(
'
borderWidth
'
)
},
// Behind item elements
z2
:
-
1
});
graphic
.
subPixelOptimizeRect
(
rect
);
group
.
add
(
rect
);
}
}
});
});
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录