Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
ec06d050
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,发现更多精彩内容 >>
提交
ec06d050
编写于
7月 09, 2019
作者:
D
deqingli
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/master'
上级
e547c558
b2263c19
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
140 addition
and
12 deletion
+140
-12
src/component/graphic.js
src/component/graphic.js
+36
-8
src/component/marker/MarkerModel.js
src/component/marker/MarkerModel.js
+11
-4
test/graphicOption.html
test/graphicOption.html
+93
-0
未找到文件。
src/component/graphic.js
浏览文件 @
ec06d050
...
@@ -24,6 +24,7 @@ import * as zrUtil from 'zrender/src/core/util';
...
@@ -24,6 +24,7 @@ import * as zrUtil from 'zrender/src/core/util';
import
*
as
modelUtil
from
'
../util/model
'
;
import
*
as
modelUtil
from
'
../util/model
'
;
import
*
as
graphicUtil
from
'
../util/graphic
'
;
import
*
as
graphicUtil
from
'
../util/graphic
'
;
import
*
as
layoutUtil
from
'
../util/layout
'
;
import
*
as
layoutUtil
from
'
../util/layout
'
;
import
{
parsePercent
}
from
'
../util/number
'
;
// -------------
// -------------
// Preprocessor
// Preprocessor
...
@@ -338,8 +339,8 @@ echarts.extendComponentView({
...
@@ -338,8 +339,8 @@ echarts.extendComponentView({
var
el
=
elMap
.
get
(
id
);
var
el
=
elMap
.
get
(
id
);
if
(
el
)
{
if
(
el
)
{
el
.
__ecGraphicWidth
=
elOption
.
width
;
el
.
__ecGraphicWidth
Option
=
elOption
.
width
;
el
.
__ecGraphicHeight
=
elOption
.
height
;
el
.
__ecGraphicHeight
Option
=
elOption
.
height
;
setEventData
(
el
,
graphicModel
,
elOption
);
setEventData
(
el
,
graphicModel
,
elOption
);
}
}
});
});
...
@@ -356,6 +357,29 @@ echarts.extendComponentView({
...
@@ -356,6 +357,29 @@ echarts.extendComponentView({
var
elOptions
=
graphicModel
.
option
.
elements
;
var
elOptions
=
graphicModel
.
option
.
elements
;
var
rootGroup
=
this
.
group
;
var
rootGroup
=
this
.
group
;
var
elMap
=
this
.
_elMap
;
var
elMap
=
this
.
_elMap
;
var
apiWidth
=
api
.
getWidth
();
var
apiHeight
=
api
.
getHeight
();
// Top-down to calculate percentage width/height of group
for
(
var
i
=
0
;
i
<
elOptions
.
length
;
i
++
)
{
var
elOption
=
elOptions
[
i
];
var
el
=
elMap
.
get
(
elOption
.
id
);
if
(
!
el
||
!
el
.
isGroup
)
{
continue
;
}
var
parentEl
=
el
.
parent
;
var
isParentRoot
=
parentEl
===
rootGroup
;
// Like 'position:absolut' in css, default 0.
el
.
__ecGraphicWidth
=
parsePercent
(
el
.
__ecGraphicWidthOption
,
isParentRoot
?
apiWidth
:
parentEl
.
__ecGraphicWidth
)
||
0
;
el
.
__ecGraphicHeight
=
parsePercent
(
el
.
__ecGraphicHeightOption
,
isParentRoot
?
apiHeight
:
parentEl
.
__ecGraphicHeight
)
||
0
;
}
// Bottom-up tranvese all elements (consider ec resize) to locate elements.
// Bottom-up tranvese all elements (consider ec resize) to locate elements.
for
(
var
i
=
elOptions
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
elOptions
.
length
-
1
;
i
>=
0
;
i
--
)
{
...
@@ -369,14 +393,18 @@ echarts.extendComponentView({
...
@@ -369,14 +393,18 @@ echarts.extendComponentView({
var
parentEl
=
el
.
parent
;
var
parentEl
=
el
.
parent
;
var
containerInfo
=
parentEl
===
rootGroup
var
containerInfo
=
parentEl
===
rootGroup
?
{
?
{
width
:
api
.
getWidth
()
,
width
:
api
Width
,
height
:
api
.
getHeight
()
height
:
api
Height
}
}
:
{
// Like 'position:absolut' in css, default 0.
:
{
width
:
parentEl
.
__ecGraphicWidth
||
0
,
width
:
parentEl
.
__ecGraphicWidth
,
height
:
parentEl
.
__ecGraphicHeight
||
0
height
:
parentEl
.
__ecGraphicHeight
};
};
// PENDING
// Currently, when `bounding: 'all'`, the union bounding rect of the group
// does not include the rect of [0, 0, group.width, group.height], which
// is probably weird for users. Should we make a break change for it?
layoutUtil
.
positionElement
(
layoutUtil
.
positionElement
(
el
,
elOption
,
containerInfo
,
null
,
el
,
elOption
,
containerInfo
,
null
,
{
hv
:
elOption
.
hv
,
boundingMode
:
elOption
.
bounding
}
{
hv
:
elOption
.
hv
,
boundingMode
:
elOption
.
bounding
}
...
@@ -548,4 +576,4 @@ function setEventData(el, graphicModel, elOption) {
...
@@ -548,4 +576,4 @@ function setEventData(el, graphicModel, elOption) {
if
(
eventData
)
{
if
(
eventData
)
{
eventData
.
info
=
el
.
info
;
eventData
.
info
=
el
.
info
;
}
}
}
}
\ No newline at end of file
src/component/marker/MarkerModel.js
浏览文件 @
ec06d050
...
@@ -40,7 +40,7 @@ var MarkerModel = echarts.extendComponentModel({
...
@@ -40,7 +40,7 @@ var MarkerModel = echarts.extendComponentModel({
/**
/**
* @overrite
* @overrite
*/
*/
init
:
function
(
option
,
parentModel
,
ecModel
,
extraOpt
)
{
init
:
function
(
option
,
parentModel
,
ecModel
)
{
if
(
__DEV__
)
{
if
(
__DEV__
)
{
if
(
this
.
type
===
'
marker
'
)
{
if
(
this
.
type
===
'
marker
'
)
{
...
@@ -48,7 +48,7 @@ var MarkerModel = echarts.extendComponentModel({
...
@@ -48,7 +48,7 @@ var MarkerModel = echarts.extendComponentModel({
}
}
}
}
this
.
mergeDefaultAndTheme
(
option
,
ecModel
);
this
.
mergeDefaultAndTheme
(
option
,
ecModel
);
this
.
mergeOption
(
option
,
ecModel
,
extraOpt
.
createdBySelf
,
true
);
this
.
_mergeOption
(
option
,
ecModel
,
false
,
true
);
},
},
/**
/**
...
@@ -63,7 +63,14 @@ var MarkerModel = echarts.extendComponentModel({
...
@@ -63,7 +63,14 @@ var MarkerModel = echarts.extendComponentModel({
return
this
.
getShallow
(
'
animation
'
)
&&
hostSeries
&&
hostSeries
.
isAnimationEnabled
();
return
this
.
getShallow
(
'
animation
'
)
&&
hostSeries
&&
hostSeries
.
isAnimationEnabled
();
},
},
mergeOption
:
function
(
newOpt
,
ecModel
,
createdBySelf
,
isInit
)
{
/**
* @overrite
*/
mergeOption
:
function
(
newOpt
,
ecModel
)
{
this
.
_mergeOption
(
newOpt
,
ecModel
,
false
,
false
);
},
_mergeOption
:
function
(
newOpt
,
ecModel
,
createdBySelf
,
isInit
)
{
var
MarkerModel
=
this
.
constructor
;
var
MarkerModel
=
this
.
constructor
;
var
modelPropName
=
this
.
mainType
+
'
Model
'
;
var
modelPropName
=
this
.
mainType
+
'
Model
'
;
if
(
!
createdBySelf
)
{
if
(
!
createdBySelf
)
{
...
@@ -107,7 +114,7 @@ var MarkerModel = echarts.extendComponentModel({
...
@@ -107,7 +114,7 @@ var MarkerModel = echarts.extendComponentModel({
markerModel
.
__hostSeries
=
seriesModel
;
markerModel
.
__hostSeries
=
seriesModel
;
}
}
else
{
else
{
markerModel
.
mergeOption
(
markerOpt
,
ecModel
,
true
);
markerModel
.
_
mergeOption
(
markerOpt
,
ecModel
,
true
);
}
}
seriesModel
[
modelPropName
]
=
markerModel
;
seriesModel
[
modelPropName
]
=
markerModel
;
},
this
);
},
this
);
...
...
test/graphicOption.html
浏览文件 @
ec06d050
...
@@ -204,6 +204,99 @@ under the License.
...
@@ -204,6 +204,99 @@ under the License.
},
},
z: 100
z: 100
}]
}]
}, {
type: 'group',
id: 'bl',
width: '100%',
height: '100%',
children: [{
type: 'rect',
right: 0,
bottom: 0,
shape: {
width: 200,
height: 100
},
style: {
stroke: 'blue',
fill: 'blue',
lineWidth: 2
}
}, {
type: 'rect',
position: [10, 20],
shape: {
width: 50,
height: 150
},
style: {
stroke: 'blue',
fill: 'blue',
lineWidth: 2
}
}, {
type: 'group',
width: '50%',
height: '50%',
children: [{
type: 'rect',
shape: {
width: 100,
height: 100
},
style: {
stroke: 'blue',
fill: 'blue',
lineWidth: 2
},
right: 0,
bottom: 0
}]
}]
}, {
type: 'rect',
right: 0,
bottom: 0,
shape: {
width: 200,
height: 100
},
style: {
stroke: 'orange',
fill: 'transparent',
lineWidth: 2
}
}, {
type: 'rect',
position: [10, 20],
shape: {
width: 50,
height: 150
},
style: {
stroke: 'orange',
fill: 'transparent',
lineWidth: 2
}
}, {
type: 'rect',
shape: {
width: 100,
height: 100
},
style: {
stroke: 'orange',
fill: 'transparent',
lineWidth: 2
},
right: '50%',
bottom: '50%'
}, {
type: 'text',
position: [220, 20],
style: {
text: '蓝色矩形应与橙色矩形同一位置'
}
}]
}]
}
}
</textarea>
</textarea>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录