Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
a8f279ee
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,发现更多精彩内容 >>
提交
a8f279ee
编写于
2月 21, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Marline add large option and effect
上级
1ee06ab4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
140 addition
and
55 deletion
+140
-55
src/chart/base.js
src/chart/base.js
+57
-24
src/util/ecEffect.js
src/util/ecEffect.js
+83
-31
未找到文件。
src/chart/base.js
浏览文件 @
a8f279ee
...
...
@@ -12,6 +12,7 @@ define(function (require) {
var
MarkLineShape
=
require
(
'
../util/shape/MarkLine
'
);
var
SymbolShape
=
require
(
'
../util/shape/Symbol
'
);
var
PolylineShape
=
require
(
'
zrender/shape/Polyline
'
);
var
ShapeBundle
=
require
(
'
zrender/shape/ShapeBundle
'
);
var
ecConfig
=
require
(
'
../config
'
);
var
ecData
=
require
(
'
../util/ecData
'
);
...
...
@@ -56,7 +57,7 @@ define(function (require) {
highlightStyle
.
strokeColor
=
self
.
ecTheme
.
calculableColor
||
ecConfig
.
calculableColor
;
highlightStyle
.
lineWidth
=
calculableShape
.
type
===
'
icon
'
?
30
:
10
;
self
.
zr
.
addHoverShape
(
calculableShape
);
setTimeout
(
function
(){
...
...
@@ -709,21 +710,52 @@ define(function (require) {
var
shapeList
=
this
.
_markLine
(
seriesIndex
,
markLine
);
for
(
var
i
=
0
,
l
=
shapeList
.
length
;
i
<
l
;
i
++
)
{
var
tarShape
=
shapeList
[
i
];
tarShape
.
zlevel
=
this
.
getZlevelBase
();
tarShape
.
z
=
this
.
getZBase
()
+
1
;
for
(
var
key
in
attachStyle
)
{
tarShape
[
key
]
=
zrUtil
.
clone
(
attachStyle
[
key
]);
var
isLarge
=
markLine
.
large
;
if
(
isLarge
)
{
var
shapeBundle
=
new
ShapeBundle
({
style
:
{
shapeList
:
shapeList
}
});
var
firstShape
=
shapeList
[
0
];
if
(
firstShape
)
{
zrUtil
.
merge
(
shapeBundle
.
style
,
firstShape
.
style
);
zrUtil
.
merge
(
shapeBundle
.
highlightStyle
=
{},
firstShape
.
highlightStyle
);
shapeBundle
.
style
.
brushType
=
'
stroke
'
;
shapeBundle
.
zlevel
=
this
.
getZlevelBase
();
shapeBundle
.
z
=
this
.
getZBase
()
+
1
;
shapeBundle
.
hoverable
=
false
;
for
(
var
key
in
attachStyle
)
{
shapeBundle
[
key
]
=
zrUtil
.
clone
(
attachStyle
[
key
]);
}
}
this
.
shapeList
.
push
(
shapeBundle
);
this
.
zr
.
addShape
(
shapeBundle
);
shapeBundle
.
_mark
=
'
largeLine
'
;
var
effect
=
markLine
.
effect
;
if
(
effect
.
show
)
{
shapeBundle
.
effect
=
effect
;
}
this
.
shapeList
.
push
(
tarShape
);
}
// 个别特殊图表需要自己addShape
if
(
this
.
type
===
ecConfig
.
CHART_TYPE_FORCE
||
this
.
type
===
ecConfig
.
CHART_TYPE_CHORD
)
{
else
{
for
(
var
i
=
0
,
l
=
shapeList
.
length
;
i
<
l
;
i
++
)
{
this
.
zr
.
addShape
(
shapeList
[
i
]);
var
tarShape
=
shapeList
[
i
];
tarShape
.
zlevel
=
this
.
getZlevelBase
();
tarShape
.
z
=
this
.
getZBase
()
+
1
;
for
(
var
key
in
attachStyle
)
{
tarShape
[
key
]
=
zrUtil
.
clone
(
attachStyle
[
key
]);
}
this
.
shapeList
.
push
(
tarShape
);
}
// 个别特殊图表需要自己addShape
if
(
this
.
type
===
ecConfig
.
CHART_TYPE_FORCE
||
this
.
type
===
ecConfig
.
CHART_TYPE_CHORD
)
{
for
(
var
i
=
0
,
l
=
shapeList
.
length
;
i
<
l
;
i
++
)
{
this
.
zr
.
addShape
(
shapeList
[
i
]);
}
}
}
},
...
...
@@ -758,7 +790,7 @@ define(function (require) {
var
effect
;
var
zrWidth
=
this
.
zr
.
getWidth
();
var
zrHeight
=
this
.
zr
.
getHeight
();
if
(
!
mpOption
.
large
)
{
for
(
var
i
=
0
,
l
=
data
.
length
;
i
<
l
;
i
++
)
{
if
(
data
[
i
].
x
==
null
||
data
[
i
].
y
==
null
)
{
...
...
@@ -955,6 +987,7 @@ define(function (require) {
);
if
(
effect
.
show
)
{
itemShape
.
effect
=
effect
;
itemShape
.
effect
.
large
=
mlOption
.
large
;
}
if
(
serie
.
type
===
ecConfig
.
CHART_TYPE_MAP
)
{
...
...
@@ -976,6 +1009,7 @@ define(function (require) {
);
shapeList
.
push
(
itemShape
);
}
return
shapeList
;
};
})(),
...
...
@@ -1189,7 +1223,6 @@ define(function (require) {
var
ShapeCtor
=
bundling
?
PolylineShape
:
MarkLineShape
;
var
itemShape
=
new
ShapeCtor
({
style
:
{
curveness
:
smoothness
,
symbol
:
symbol
,
symbolSize
:
symbolSize
,
symbolRotate
:
symbolRotate
,
...
...
@@ -1250,8 +1283,8 @@ define(function (require) {
shapeStyle
.
yStart
=
points
[
0
][
1
];
shapeStyle
.
xEnd
=
points
[
1
][
0
];
shapeStyle
.
yEnd
=
points
[
1
][
1
];
shapeStyle
.
curveness
=
smoothness
;
itemShape
.
updatePoints
(
itemShape
.
style
);
itemShape
.
updatePoints
(
itemShape
.
highlightStyle
);
}
itemShape
=
this
.
addLabel
(
...
...
@@ -1529,26 +1562,26 @@ define(function (require) {
* 标注动画
* @param {number} duration 时长
* @param {string=} easing 缓动效果
* @param {Array=}
addS
hapeList 指定特效对象,不指定默认使用this.shapeList
* @param {Array=}
s
hapeList 指定特效对象,不指定默认使用this.shapeList
*/
animationMark
:
function
(
duration
,
easing
,
addS
hapeList
)
{
var
shapeList
=
addS
hapeList
||
this
.
shapeList
;
animationMark
:
function
(
duration
,
easing
,
s
hapeList
)
{
var
shapeList
=
s
hapeList
||
this
.
shapeList
;
for
(
var
i
=
0
,
l
=
shapeList
.
length
;
i
<
l
;
i
++
)
{
if
(
!
shapeList
[
i
].
_mark
)
{
continue
;
}
this
.
_animateMod
(
false
,
shapeList
[
i
],
duration
,
easing
,
0
,
true
);
}
this
.
animationEffect
(
addS
hapeList
);
this
.
animationEffect
(
s
hapeList
);
},
/**
* 特效动画
* @param {Array=}
addS
hapeList 指定特效对象,不知道默认使用this.shapeList
* @param {Array=}
s
hapeList 指定特效对象,不知道默认使用this.shapeList
*/
animationEffect
:
function
(
addS
hapeList
)
{
!
addS
hapeList
&&
this
.
clearEffectShape
();
var
shapeList
=
addS
hapeList
||
this
.
shapeList
;
animationEffect
:
function
(
s
hapeList
)
{
!
s
hapeList
&&
this
.
clearEffectShape
();
shapeList
=
s
hapeList
||
this
.
shapeList
;
if
(
shapeList
==
null
)
{
return
;
}
...
...
src/util/ecEffect.js
浏览文件 @
a8f279ee
...
...
@@ -13,6 +13,7 @@ define(function (require) {
var
curveTool
=
require
(
'
zrender/tool/curve
'
);
var
IconShape
=
require
(
'
../util/shape/Icon
'
);
var
SymbolShape
=
require
(
'
../util/shape/Symbol
'
);
var
ShapeBundle
=
require
(
'
zrender/shape/ShapeBundle
'
);
var
canvasSupported
=
require
(
'
zrender/tool/env
'
).
canvasSupported
;
...
...
@@ -203,7 +204,7 @@ define(function (require) {
}
}
function
line
(
zr
,
effectList
,
shape
,
zlevel
)
{
function
line
(
zr
,
effectList
,
shape
,
zlevel
,
isLarge
)
{
var
effect
=
shape
.
effect
;
var
shapeStyle
=
shape
.
style
;
var
color
=
effect
.
color
||
shapeStyle
.
strokeColor
||
shapeStyle
.
color
;
...
...
@@ -211,7 +212,7 @@ define(function (require) {
var
size
=
shapeStyle
.
lineWidth
*
effect
.
scaleSize
;
var
shadowBlur
=
typeof
effect
.
shadowBlur
!=
'
undefined
'
?
effect
.
shadowBlur
:
size
;
var
effectShape
=
new
CircleShape
({
zlevel
:
zlevel
,
style
:
{
...
...
@@ -222,36 +223,31 @@ define(function (require) {
shadowColor
:
shadowColor
,
shadowBlur
:
shadowBlur
},
draggable
:
false
,
hoverable
:
false
});
var
offset
;
if
(
canvasSupported
)
{
// 提高性能,换成image
effectShape
.
style
.
image
=
zr
.
shapeToImage
(
effectShape
,
var
offset
=
0
;
if
(
canvasSupported
&&
!
isLarge
)
{
// 提高性能,换成image
var
zlevel
=
effectShape
.
zlevel
;
effectShape
=
zr
.
shapeToImage
(
effectShape
,
(
size
+
shadowBlur
)
*
2
,
(
size
+
shadowBlur
)
*
2
).
style
.
image
;
effectShape
=
new
ImageShape
({
zlevel
:
effectShape
.
zlevel
,
style
:
effectShape
.
style
,
draggable
:
false
,
hoverable
:
false
});
);
effectShape
.
zlevel
=
zlevel
;
effectShape
.
hoverable
=
false
;
offset
=
shadowBlur
;
}
else
{
offset
=
0
;
if
(
!
isLarge
)
{
ecData
.
clone
(
shape
,
effectShape
);
// 改变坐标, 不能移到前面
effectShape
.
position
=
shape
.
position
;
effectList
.
push
(
effectShape
);
zr
.
addShape
(
effectShape
);
}
ecData
.
clone
(
shape
,
effectShape
);
// 改变坐标, 不能移到前面
effectShape
.
position
=
shape
.
position
;
effectList
.
push
(
effectShape
);
zr
.
addShape
(
effectShape
);
var
x0
=
shapeStyle
.
xStart
-
offset
;
var
y0
=
shapeStyle
.
yStart
-
offset
;
var
x2
=
shapeStyle
.
xEnd
-
offset
;
...
...
@@ -264,14 +260,16 @@ define(function (require) {
distance
*
effect
.
period
*
effect
.
period
)));
var
effectDone
=
function
()
{
shape
.
effect
.
show
=
false
;
zr
.
delShape
(
effectShape
.
id
);
if
(
!
isLarge
)
{
shape
.
effect
.
show
=
false
;
zr
.
delShape
(
effectShape
.
id
);
}
}
if
(
shape
.
style
.
curveness
>
0
)
{
var
x1
=
shapeStyle
.
cpX1
-
offset
;
var
y1
=
shapeStyle
.
cpY1
-
offset
;
var
obj
=
{
p
:
0
};
zr
.
animation
.
animate
(
effectShape
,
{
loop
:
effect
.
loop
})
effectShape
.
effectAnimator
=
zr
.
animation
.
animate
(
effectShape
,
{
loop
:
effect
.
loop
})
.
when
(
duration
,
{
p
:
1
})
.
during
(
function
(
target
,
t
)
{
effectShape
.
style
.
x
=
curveTool
.
quadraticAt
(
...
...
@@ -280,25 +278,79 @@ define(function (require) {
effectShape
.
style
.
y
=
curveTool
.
quadraticAt
(
y0
,
y1
,
y2
,
t
);
zr
.
modShape
(
effectShape
);
if
(
!
isLarge
)
{
zr
.
modShape
(
effectShape
);
}
})
.
done
(
effectDone
)
.
start
();
}
else
{
zr
.
animate
(
effectShape
.
id
,
'
style
'
,
effect
.
loop
)
// 不用 zr.animate,因为在用 ShapeBundle 的时候单个 effectShape 不会
// 被加到 zrender 中
effectShape
.
effectAnimator
=
zr
.
animation
.
animate
(
effectShape
.
style
,
{
loop
:
effect
.
loop
})
.
when
(
duration
,
{
x
:
x2
,
y
:
y2
})
.
during
(
function
()
{
if
(
!
isLarge
)
{
zr
.
modShape
(
effectShape
);
}
})
.
done
(
effectDone
)
.
start
();
}
effectShape
.
effectAnimator
.
duration
=
duration
;
return
effectShape
;
}
function
largeLine
(
zr
,
effectList
,
shape
,
zlevel
)
{
var
effectShape
=
new
ShapeBundle
({
style
:
{
shapeList
:
[]
},
zlevel
:
zlevel
,
hoverable
:
false
});
var
shapeList
=
shape
.
style
.
shapeList
;
var
effect
=
shape
.
effect
;
effectShape
.
position
=
shape
.
position
;
var
longestAnimator
=
null
;
var
maxDuration
=
0
;
for
(
var
i
=
0
;
i
<
shapeList
.
length
;
i
++
)
{
shapeList
[
i
].
effect
=
effect
;
var
singleEffectShape
=
line
(
zr
,
null
,
shapeList
[
i
],
zlevel
,
true
);
var
singleEffectAnimator
=
singleEffectShape
.
effectAnimator
;
effectShape
.
style
.
shapeList
.
push
(
singleEffectShape
);
if
(
singleEffectAnimator
.
duration
>
maxDuration
)
{
maxDuration
=
singleEffectAnimator
.
duration
;
longestAnimator
=
singleEffectAnimator
;
}
if
(
i
===
0
)
{
effectShape
.
style
.
color
=
singleEffectShape
.
style
.
color
;
effectShape
.
style
.
shadowBlur
=
singleEffectShape
.
style
.
shadowBlur
;
effectShape
.
style
.
shadowColor
=
singleEffectShape
.
style
.
shadowColor
;
}
}
effectList
.
push
(
effectShape
);
zr
.
addShape
(
effectShape
);
if
(
longestAnimator
)
{
longestAnimator
.
during
(
function
()
{
zr
.
modShape
(
effectShape
);
})
.
done
(
function
()
{
shape
.
effect
.
show
=
false
;
zr
.
delShape
(
effectShape
.
id
);
});
}
}
return
{
point
:
point
,
largePoint
:
largePoint
,
line
:
line
line
:
line
,
largeLine
:
largeLine
};
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录