Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
59e77878
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,体验更适合开发者的 AI 搜索 >>
提交
59e77878
编写于
3月 12, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jshint, markLine 过渡动画调整
上级
ef3ab740
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
106 addition
and
130 deletion
+106
-130
doc/example/force.html
doc/example/force.html
+5
-2
src/chart/base.js
src/chart/base.js
+3
-2
src/chart/line.js
src/chart/line.js
+5
-5
src/chart/map.js
src/chart/map.js
+45
-45
src/data/KDTree.js
src/data/KDTree.js
+3
-3
src/echarts.js
src/echarts.js
+2
-2
src/layout/EdgeBundling.js
src/layout/EdgeBundling.js
+6
-5
src/util/ecAnimation.js
src/util/ecAnimation.js
+32
-56
src/util/ecEffect.js
src/util/ecEffect.js
+4
-5
src/util/shape/MarkLine.js
src/util/shape/MarkLine.js
+1
-5
未找到文件。
doc/example/force.html
浏览文件 @
59e77878
...
...
@@ -144,10 +144,13 @@ option = {
links : [
{source : '丽萨-乔布斯', target : '乔布斯', weight : 1, name: '女儿', itemStyle: {
normal: {
width: 1.5
width: 1.5,
color: 'red'
}
}},
{source : '乔布斯', target : '丽萨-乔布斯', weight : 1, name: '父亲'},
{source : '乔布斯', target : '丽萨-乔布斯', weight : 1, name: '父亲', itemStyle: {
normal: { color: 'red' }
}},
{source : '保罗-乔布斯', target : '乔布斯', weight : 2, name: '父亲'},
{source : '克拉拉-乔布斯', target : '乔布斯', weight : 1, name: '母亲'},
{source : '劳伦-鲍威尔', target : '乔布斯', weight : 2},
...
...
src/chart/base.js
浏览文件 @
59e77878
...
...
@@ -27,7 +27,7 @@ define(function (require) {
// Some utility functions
function
isCoordAvailable
(
coord
)
{
return
coord
.
x
!=
null
&&
coord
.
y
!=
null
return
coord
.
x
!=
null
&&
coord
.
y
!=
null
;
}
function
Base
(
ecTheme
,
messageCenter
,
zr
,
option
,
myChart
)
{
...
...
@@ -915,9 +915,9 @@ define(function (require) {
)
{
// 组装一个mergeData
var
mergeData
=
this
.
deepMerge
(
mlData
);
var
value
=
mergeData
.
value
!=
null
?
mergeData
.
value
:
''
;
var
queryTarget
=
[
mergeData
,
mlOption
];
var
color
=
defaultColor
;
var
value
=
mergeData
.
value
!=
null
?
mergeData
.
value
:
''
;
// 值域
if
(
dataRange
)
{
color
=
isNaN
(
value
)
?
color
:
dataRange
.
getColor
(
value
);
...
...
@@ -969,6 +969,7 @@ define(function (require) {
var
edge
=
edges
[
i
];
var
rawEdge
=
edge
.
rawEdge
||
edge
;
var
mlData
=
rawEdge
.
rawData
;
var
value
=
mlData
.
value
!=
null
?
mlData
.
value
:
''
;
var
itemShape
=
this
.
getMarkLineShape
(
mlOption
,
...
...
src/chart/line.js
浏览文件 @
59e77878
...
...
@@ -812,7 +812,6 @@ define(function (require) {
*/
addDataAnimation
:
function
(
params
,
done
)
{
var
series
=
this
.
series
;
var
self
=
this
;
var
aniMap
=
{};
// seriesIndex索引参数
for
(
var
i
=
0
,
l
=
params
.
length
;
i
<
l
;
i
++
)
{
aniMap
[
params
[
i
][
0
]]
=
params
[
i
];
...
...
@@ -832,6 +831,10 @@ define(function (require) {
done
&&
done
();
}
}
function
animationDuring
(
target
)
{
// 强制更新曲线控制点
target
.
style
.
controlPointList
=
null
;
}
for
(
var
i
=
this
.
shapeList
.
length
-
1
;
i
>=
0
;
i
--
)
{
seriesIndex
=
this
.
shapeList
[
i
].
_seriesIndex
;
...
...
@@ -900,10 +903,7 @@ define(function (require) {
this
.
query
(
this
.
option
,
'
animationDurationUpdate
'
),
{
position
:
[
x
,
y
]
}
)
.
during
(
function
(
target
)
{
// 强制更新曲线控制点
target
.
style
.
controlPointList
=
null
;
})
.
during
(
animationDuring
)
.
done
(
animationDone
)
.
start
();
}
...
...
src/chart/map.js
浏览文件 @
59e77878
...
...
@@ -1165,53 +1165,53 @@ define(function (require) {
var
shapeStyle
=
shape
.
style
;
shape
.
position
[
0
]
=
transform
.
left
;
shape
.
position
[
1
]
=
transform
.
top
;
if
(
shapeType
==
'
path
'
||
shapeType
==
'
symbol
'
||
shapeType
==
'
circle
'
||
shapeType
==
'
rectangle
'
||
shapeType
==
'
polygon
'
||
shapeType
==
'
line
'
||
shapeType
==
'
ellipse
'
)
{
shape
.
scale
[
0
]
*=
delta
;
shape
.
scale
[
1
]
*=
delta
;
}
else
if
(
shapeType
==
'
mark-line
'
)
{
scaleMarkline
(
shapeStyle
,
delta
);
}
else
if
(
shapeType
==
'
polyline
'
)
{
scalePolyline
(
shapeStyle
,
delta
);
}
else
if
(
shapeType
==
'
shape-bundle
'
)
{
for
(
var
j
=
0
;
j
<
shapeStyle
.
shapeList
.
length
;
j
++
)
{
var
subShape
=
shapeStyle
.
shapeList
[
j
];
if
(
subShape
.
type
==
'
mark-line
'
)
{
scaleMarkline
(
subShape
.
style
,
delta
);
switch
(
shapeType
)
{
case
'
path
'
:
case
'
symbol
'
:
case
'
circle
'
:
case
'
rectangle
'
:
case
'
polygon
'
:
case
'
line
'
:
case
'
ellipse
'
:
shape
.
scale
[
0
]
*=
delta
;
shape
.
scale
[
1
]
*=
delta
;
break
;
case
'
mark-line
'
:
scaleMarkline
(
shapeStyle
,
delta
);
break
;
case
'
polyline
'
:
scalePolyline
(
shapeStyle
,
delta
);
break
;
case
'
shape-bundle
'
:
for
(
var
j
=
0
;
j
<
shapeStyle
.
shapeList
.
length
;
j
++
)
{
var
subShape
=
shapeStyle
.
shapeList
[
j
];
if
(
subShape
.
type
==
'
mark-line
'
)
{
scaleMarkline
(
subShape
.
style
,
delta
);
}
else
if
(
subShape
.
type
==
'
polyline
'
)
{
scalePolyline
(
subShape
.
style
,
delta
);
}
}
else
if
(
subShape
.
type
==
'
polyline
'
)
{
scalePolyline
(
subShape
.
style
,
delta
);
break
;
case
'
icon
'
:
case
'
image
'
:
geoAndPos
=
this
.
geo2pos
(
mapType
,
shape
.
_geo
);
shapeStyle
.
x
=
shapeStyle
.
_x
=
geoAndPos
[
0
]
-
shapeStyle
.
width
/
2
;
shapeStyle
.
y
=
shapeStyle
.
_y
=
geoAndPos
[
1
]
-
shapeStyle
.
height
/
2
;
break
;
default
:
geoAndPos
=
this
.
geo2pos
(
mapType
,
shape
.
_geo
);
shapeStyle
.
x
=
geoAndPos
[
0
];
shapeStyle
.
y
=
geoAndPos
[
1
];
if
(
shapeType
==
'
text
'
)
{
shape
.
_style
.
x
=
shape
.
highlightStyle
.
x
=
geoAndPos
[
0
];
shape
.
_style
.
y
=
shape
.
highlightStyle
.
y
=
geoAndPos
[
1
];
}
}
}
else
if
(
shapeType
==
'
icon
'
||
shapeType
==
'
image
'
)
{
geoAndPos
=
this
.
geo2pos
(
mapType
,
shape
.
_geo
);
shapeStyle
.
x
=
shapeStyle
.
_x
=
geoAndPos
[
0
]
-
shapeStyle
.
width
/
2
;
shapeStyle
.
y
=
shapeStyle
.
_y
=
geoAndPos
[
1
]
-
shapeStyle
.
height
/
2
;
}
else
{
geoAndPos
=
this
.
geo2pos
(
mapType
,
shape
.
_geo
);
shapeStyle
.
x
=
geoAndPos
[
0
];
shapeStyle
.
y
=
geoAndPos
[
1
];
if
(
shapeType
==
'
text
'
)
{
shape
.
_style
.
x
=
shape
.
highlightStyle
.
x
=
geoAndPos
[
0
];
shape
.
_style
.
y
=
shape
.
highlightStyle
.
y
=
geoAndPos
[
1
];
}
}
this
.
zr
.
modShape
(
shape
.
id
);
...
...
src/data/KDTree.js
浏览文件 @
59e77878
...
...
@@ -14,7 +14,7 @@ define(function (require) {
this
.
axis
=
axis
;
this
.
data
=
data
;
}
;
}
/**
* @constructor
...
...
@@ -174,7 +174,7 @@ define(function (require) {
for
(
var
i
=
0
;
i
<
N
;
i
++
)
{
// Allocate
if
(
!
nearestNList
[
i
])
{
nearestNList
[
i
]
=
{}
nearestNList
[
i
]
=
{}
;
}
nearestNList
[
i
].
dist
=
0
;
nearestNList
[
i
].
node
=
null
;
...
...
@@ -241,7 +241,7 @@ define(function (require) {
output
.
length
=
found
;
return
output
;
}
}
;
return
KDTree
;
});
\ No newline at end of file
src/echarts.js
浏览文件 @
59e77878
...
...
@@ -1166,7 +1166,7 @@ define(function (require) {
if
(
chartAnimationCount
===
0
)
{
animationDone
();
}
}
}
;
for
(
var
i
=
0
,
l
=
chartList
.
length
;
i
<
l
;
i
++
)
{
if
(
magicOption
.
addDataAnimation
&&
chartList
[
i
].
addDataAnimation
)
{
chartAnimationCount
++
;
...
...
@@ -1195,7 +1195,7 @@ define(function (require) {
{
option
:
magicOption
},
self
);
}
;
}
if
(
!
magicOption
.
addDataAnimation
)
{
setTimeout
(
animationDone
,
0
);
...
...
src/layout/EdgeBundling.js
浏览文件 @
59e77878
...
...
@@ -34,7 +34,7 @@ define(function (require) {
];
this
.
group
=
group
;
}
;
}
function
Edge
(
edge
)
{
var
points
=
edge
.
points
;
...
...
@@ -251,8 +251,9 @@ define(function (require) {
}
if
(
mostSavingInkEdge
)
{
totalSavedInk
+=
maxSavedInk
;
var
group
;
if
(
!
mostSavingInkEdge
.
group
)
{
var
group
=
new
BundledEdgeGroup
();
group
=
new
BundledEdgeGroup
();
groups
.
push
(
group
);
group
.
addEdge
(
mostSavingInkEdge
);
}
...
...
@@ -277,7 +278,7 @@ define(function (require) {
groups
:
groups
,
edges
:
edges
,
savedInk
:
totalSavedInk
}
}
;
},
_calculateEdgeEdgeInk
:
(
function
()
{
...
...
@@ -360,7 +361,7 @@ define(function (require) {
this
.
_limitTurningAngle
(
endPointSet
,
cp1
,
cp0
,
mp1
);
}
}
;
})(),
_limitTurningAngle
:
(
function
()
{
...
...
@@ -408,7 +409,7 @@ define(function (require) {
}
};
})()
}
}
;
return
EdgeBundling
;
});
\ No newline at end of file
src/util/ecAnimation.js
浏览文件 @
59e77878
...
...
@@ -564,71 +564,47 @@ define(function (require) {
var
animationDone
=
function
()
{
newShape
.
__animating
=
false
;
};
var
x0
=
newShapeStyle
.
xStart
;
var
y0
=
newShapeStyle
.
yStart
;
var
x2
=
newShapeStyle
.
xEnd
;
var
y2
=
newShapeStyle
.
yEnd
;
if
(
newShapeStyle
.
curveness
>
0
)
{
newShape
.
updatePoints
(
newShapeStyle
);
var
obj
=
{
p
:
0
};
var
x1
=
newShapeStyle
.
cpX1
;
var
y1
=
newShapeStyle
.
cpY1
;
var
newXArr
=
[];
var
newYArr
=
[];
var
subdivide
=
curveTool
.
quadraticSubdivide
;
zr
.
animation
.
animate
(
obj
)
.
when
(
duration
,
{
p
:
1
})
.
during
(
function
()
{
// Calculate subdivided curve
subdivide
(
x0
,
x1
,
x2
,
obj
.
p
,
newXArr
);
subdivide
(
y0
,
y1
,
y2
,
obj
.
p
,
newYArr
);
newShapeStyle
.
cpX1
=
newXArr
[
1
];
newShapeStyle
.
cpY1
=
newYArr
[
1
];
newShapeStyle
.
xEnd
=
newXArr
[
2
];
newShapeStyle
.
yEnd
=
newYArr
[
2
];
zr
.
modShape
(
newShape
);
})
.
done
(
animationDone
)
.
start
(
easing
);
}
if
(
oldShape
)
{
var
oldShapeStyle
=
oldShape
.
style
;
else
{
zr
.
animate
(
newShape
.
id
,
'
style
'
)
.
when
(
0
,
{
xStart
:
oldShapeStyle
.
xStart
,
yStart
:
oldShapeStyle
.
yStart
,
xEnd
:
oldShapeStyle
.
xEnd
,
yEnd
:
oldShapeStyle
.
yEnd
,
cpX1
:
oldShapeStyle
.
cpX1
||
0
,
cpY1
:
oldShapeStyle
.
cpY1
||
0
xEnd
:
x0
,
yEnd
:
y0
})
.
when
(
duration
,
{
xStart
:
newShapeStyle
.
xStart
,
yStart
:
newShapeStyle
.
yStart
,
xEnd
:
newShapeStyle
.
xEnd
,
yEnd
:
newShapeStyle
.
yEnd
,
cpX1
:
newShapeStyle
.
cpX1
||
0
,
cpY1
:
newShapeStyle
.
cpY1
||
0
xEnd
:
x2
,
yEnd
:
y2
})
.
done
(
animationDone
)
.
start
(
easing
);
}
else
{
var
x0
=
newShapeStyle
.
xStart
;
var
y0
=
newShapeStyle
.
yStart
;
var
x2
=
newShapeStyle
.
xEnd
;
var
y2
=
newShapeStyle
.
yEnd
;
if
(
newShapeStyle
.
curveness
>
0
)
{
newShape
.
updatePoints
(
newShapeStyle
);
var
obj
=
{
p
:
0
};
var
x1
=
newShapeStyle
.
cpX1
;
var
y1
=
newShapeStyle
.
cpY1
;
var
newXArr
=
[];
var
newYArr
=
[];
var
subdivide
=
curveTool
.
quadraticSubdivide
;
zr
.
animation
.
animate
(
obj
)
.
when
(
duration
,
{
p
:
1
})
.
during
(
function
()
{
// Calculate subdivided curve
subdivide
(
x0
,
x1
,
x2
,
obj
.
p
,
newXArr
);
subdivide
(
y0
,
y1
,
y2
,
obj
.
p
,
newYArr
);
newShapeStyle
.
cpX1
=
newXArr
[
1
];
newShapeStyle
.
cpY1
=
newYArr
[
1
];
newShapeStyle
.
xEnd
=
newXArr
[
2
];
newShapeStyle
.
yEnd
=
newYArr
[
2
];
zr
.
modShape
(
newShape
);
})
.
done
(
animationDone
)
.
start
(
easing
);
}
else
{
zr
.
animate
(
newShape
.
id
,
'
style
'
)
.
when
(
0
,
{
xEnd
:
x0
,
yEnd
:
y0
})
.
when
(
duration
,
{
xEnd
:
x2
,
yEnd
:
y2
})
.
done
(
animationDone
)
.
start
(
easing
);
}
}
}
return
{
...
...
src/util/ecEffect.js
浏览文件 @
59e77878
...
...
@@ -256,7 +256,7 @@ define(function (require) {
zr
.
delShape
(
effectShape
.
id
);
}
effectShape
.
effectAnimator
=
null
;
}
}
;
if
(
shape
instanceof
Polyline
)
{
var
distanceList
=
[
0
];
...
...
@@ -277,7 +277,7 @@ define(function (require) {
distanceList
.
push
(
totalDist
);
}
var
obj
=
{
p
:
0
};
var
animator
=
zr
.
animation
.
animate
(
obj
,
{
loop
:
effect
.
loop
})
var
animator
=
zr
.
animation
.
animate
(
obj
,
{
loop
:
effect
.
loop
})
;
for
(
var
i
=
0
;
i
<
distanceList
.
length
;
i
++
)
{
animator
.
when
(
distanceList
[
i
]
*
effect
.
period
,
{
p
:
i
});
...
...
@@ -337,7 +337,6 @@ define(function (require) {
if
(
shape
.
style
.
curveness
>
0
)
{
var
x1
=
shapeStyle
.
cpX1
-
offset
;
var
y1
=
shapeStyle
.
cpY1
-
offset
;
var
obj
=
{
p
:
0
};
effectShape
.
effectAnimator
=
zr
.
animation
.
animate
(
effectShape
,
{
loop
:
effect
.
loop
})
.
when
(
duration
,
{
p
:
1
})
.
during
(
function
(
target
,
t
)
{
...
...
@@ -411,7 +410,7 @@ define(function (require) {
for
(
var
i
=
0
;
i
<
subEffectAnimators
.
length
;
i
++
)
{
subEffectAnimators
[
i
].
stop
();
}
}
}
;
if
(
maxDuration
)
{
effectShape
.
__dummy
=
0
;
// Proxy animator
...
...
@@ -432,7 +431,7 @@ define(function (require) {
animator
.
stop
=
function
()
{
clearAllAnimators
();
oldStop
.
call
(
this
);
}
}
;
}
}
...
...
src/util/shape/MarkLine.js
浏览文件 @
59e77878
...
...
@@ -27,10 +27,8 @@ define(function (require) {
var
CurveShape
=
require
(
'
zrender/shape/BezierCurve
'
);
var
curveInstance
=
new
CurveShape
({});
var
matrix
=
require
(
'
zrender/tool/matrix
'
);
var
area
=
require
(
'
zrender/tool/area
'
);
var
dashedLineTo
=
require
(
'
zrender/shape/util/dashedLineTo
'
);
var
smoothSpline
=
require
(
'
zrender/shape/util/smoothSpline
'
);
var
zrUtil
=
require
(
'
zrender/tool/util
'
);
var
curveTool
=
require
(
'
zrender/tool/curve
'
);
...
...
@@ -90,8 +88,6 @@ define(function (require) {
* @param {Object} style 样式
*/
buildPath
:
function
(
ctx
,
style
)
{
var
lineWidth
=
style
.
lineWidth
||
1
;
var
lineType
=
style
.
lineType
||
'
solid
'
;
ctx
.
moveTo
(
style
.
xStart
,
style
.
yStart
);
...
...
@@ -177,7 +173,7 @@ define(function (require) {
rotate
=
rotate
/
180
*
Math
.
PI
;
if
(
symbol
==
'
arrow
'
&&
rotate
===
0
)
{
if
(
curveness
==
0
)
{
if
(
curveness
==
=
0
)
{
var
sign
=
idx
===
0
?
-
1
:
1
;
rotate
=
Math
.
PI
/
2
+
Math
.
atan2
(
sign
*
(
y2
-
y0
),
sign
*
(
x2
-
x0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录