Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
1940aff8
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,发现更多精彩内容 >>
提交
1940aff8
编写于
9月 25, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/pissang/echarts-next
上级
fd8c7bb8
8c5a31bc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
327 addition
and
120 deletion
+327
-120
src/chart/helper/DataSymbol.js
src/chart/helper/DataSymbol.js
+5
-8
src/chart/line.js
src/chart/line.js
+1
-1
src/chart/line/LineView.js
src/chart/line/LineView.js
+45
-17
src/chart/line/lineAnimationDiff.js
src/chart/line/lineAnimationDiff.js
+15
-6
src/component/axis.js
src/component/axis.js
+17
-60
src/coord/cartesian/Axis2D.js
src/coord/cartesian/Axis2D.js
+6
-0
src/coord/cartesian/Cartesian2D.js
src/coord/cartesian/Cartesian2D.js
+16
-0
src/coord/cartesian/Grid.js
src/coord/cartesian/Grid.js
+3
-0
src/coord/cartesian/axisLabelInterval.js
src/coord/cartesian/axisLabelInterval.js
+57
-0
src/coord/polar/Polar.js
src/coord/polar/Polar.js
+22
-0
src/data/List.js
src/data/List.js
+74
-26
src/echarts.js
src/echarts.js
+18
-1
src/layout/line.js
src/layout/line.js
+45
-0
src/layout/points.js
src/layout/points.js
+3
-1
未找到文件。
src/chart/helper/DataSymbol.js
浏览文件 @
1940aff8
...
...
@@ -6,7 +6,7 @@ define(function (require) {
var
graphic
=
require
(
'
../../util/graphic
'
);
function
createSymbol
(
data
,
idx
,
enableAnimation
)
{
var
point
=
data
.
getItemLayout
(
idx
);
var
point
=
data
.
getItemLayout
(
idx
)
.
point
;
var
color
=
data
.
getItemVisual
(
idx
,
'
color
'
);
var
symbolSize
=
data
.
getItemVisual
(
idx
,
'
symbolSize
'
);
...
...
@@ -48,8 +48,6 @@ define(function (require) {
function
DataSymbol
()
{
this
.
group
=
new
Group
();
this
.
z
=
0
;
}
DataSymbol
.
prototype
=
{
...
...
@@ -80,16 +78,16 @@ define(function (require) {
group
.
add
(
symbolEl
);
})
.
update
(
function
(
newIdx
,
oldIdx
)
{
var
symbolSize
=
data
.
getItemVisual
(
newIdx
,
'
symbolSize
'
);
var
point
=
data
.
getItemLayout
(
newIdx
);
var
el
=
oldData
.
getItemGraphicEl
(
oldIdx
);
// Empty data
if
(
!
data
.
hasValue
(
newIdx
))
{
group
.
remove
(
el
);
return
;
}
var
symbolSize
=
data
.
getItemVisual
(
newIdx
,
'
symbolSize
'
);
var
point
=
data
.
getItemLayout
(
newIdx
).
point
;
var
el
=
oldData
.
getItemGraphicEl
(
oldIdx
);
// Symbol changed
if
(
oldData
.
getItemVisual
(
newIdx
,
'
symbol
'
)
!==
data
.
getItemVisual
(
oldIdx
,
'
symbol
'
))
{
// Remove the old one
...
...
@@ -134,7 +132,6 @@ define(function (require) {
// Update common properties
data
.
eachItemGraphicEl
(
function
(
el
,
idx
)
{
el
.
z
=
this
.
z
;
var
itemModel
=
data
.
getItemModel
(
idx
);
zrUtil
.
extend
(
...
...
src/chart/line.js
浏览文件 @
1940aff8
...
...
@@ -10,6 +10,6 @@ define(function (require) {
require
(
'
../visual/symbol
'
),
'
line
'
,
'
circle
'
,
'
line
'
));
echarts
.
registerLayout
(
zrUtil
.
curry
(
require
(
'
../layout/
points
'
),
'
line
'
require
(
'
../layout/
line
'
),
'
line
'
));
});
\ No newline at end of file
src/chart/line/LineView.js
浏览文件 @
1940aff8
...
...
@@ -45,12 +45,17 @@ define(function(require) {
},
render
:
function
(
seriesModel
,
ecModel
)
{
var
coordSys
=
seriesModel
.
coordinateSystem
;
var
group
=
this
.
group
;
var
data
=
seriesModel
.
getData
();
var
lineStyleNormalModel
=
seriesModel
.
getModel
(
'
itemStyle.normal.lineStyle
'
);
var
points
=
data
.
map
(
data
.
getItemLayout
,
true
);
var
plainDataList
=
data
.
map
([
'
x
'
,
'
y
'
],
function
(
x
,
y
,
idx
)
{
var
points
=
data
.
map
(
function
(
idx
)
{
var
layout
=
data
.
getItemLayout
(
idx
);
return
layout
&&
layout
.
point
;
},
true
);
var
dimensions
=
coordSys
.
type
===
'
cartesian2d
'
?
[
'
x
'
,
'
y
'
]
:
[
'
radius
'
,
'
angle
'
];
var
plainDataList
=
data
.
map
(
dimensions
,
function
(
x
,
y
,
idx
)
{
return
{
x
:
x
,
y
:
y
,
...
...
@@ -62,7 +67,6 @@ define(function(require) {
});
var
prevCoordSys
=
this
.
_coordSys
;
var
coordSys
=
seriesModel
.
coordinateSystem
;
var
isCoordSysPolar
=
coordSys
.
type
===
'
polar
'
;
// FIXME Update after animation
...
...
@@ -96,21 +100,13 @@ define(function(require) {
polyline
=
new
graphic
.
Polyline
({
shape
:
{
points
:
points
},
style
:
zrUtil
.
extend
(
lineStyleNormalModel
.
getLineStyle
(),
{
stroke
:
data
.
getVisual
(
'
color
'
),
lineJoin
:
'
bevel
'
}
)
}
});
// var removeClipPath = zrUtil.bind(polyline.removeClipPath, polyline);
var
categoryAxis
=
coordSys
.
getAxesByScale
(
'
ordinal
'
)[
0
];
var
clipPath
=
isCoordSysPolar
?
this
.
_createPolarClipShape
(
coordSys
,
enableAnimation
,
categoryAxis
)
:
this
.
_createGridClipShape
(
coordSys
,
enableAnimation
,
categoryAxis
);
?
this
.
_createPolarClipShape
(
coordSys
,
enableAnimation
)
:
this
.
_createGridClipShape
(
coordSys
,
enableAnimation
);
polyline
.
setClipPath
(
clipPath
);
...
...
@@ -137,6 +133,14 @@ define(function(require) {
group
.
add
(
polyline
);
}
polyline
.
setStyle
(
zrUtil
.
extend
(
lineStyleNormalModel
.
getLineStyle
(),
{
stroke
:
data
.
getVisual
(
'
color
'
),
lineJoin
:
'
bevel
'
}
));
// Make sure symbols is on top of line
group
.
remove
(
dataSymbol
.
group
);
group
.
add
(
dataSymbol
.
group
);
...
...
@@ -146,8 +150,30 @@ define(function(require) {
// Save the coordinate system and data for transition animation when data changed
this
.
_plainDataList
=
plainDataList
;
this
.
_coordSys
=
coordSys
;
!
isCoordSysPolar
&&
!
seriesModel
.
get
(
'
showAllSymbol
'
)
&&
this
.
_updateSymbolDisplay
(
data
,
coordSys
);
},
/**
* @private
*/
_updateSymbolDisplay
:
function
(
data
,
coordSys
)
{
var
categoryAxis
=
coordSys
.
getAxesByScale
(
'
ordinal
'
)[
0
]
// `getLabelInterval` is provided by echarts/component/axis
if
(
categoryAxis
&&
categoryAxis
.
getLabelInterval
)
{
var
labelInterval
=
categoryAxis
.
getLabelInterval
();
data
.
eachItemGraphicEl
(
function
(
el
,
idx
)
{
el
.
ignore
=
(
typeof
labelInterval
===
'
function
'
)
&&
!
labelInterval
(
idx
,
categoryAxis
.
scale
.
getItem
(
idx
))
||
idx
%
(
labelInterval
+
1
);
});
}
},
/**
* @private
*/
_updateAnimation
:
function
(
data
,
plainDataList
,
coordSys
)
{
var
polyline
=
this
.
_polyline
;
var
diff
=
lineAnimationDiff
(
...
...
@@ -214,7 +240,7 @@ define(function(require) {
});
if
(
animation
)
{
clipPath
.
shape
[
ca
tegoryAxis
.
isHorizontal
()
?
'
width
'
:
'
height
'
]
=
0
;
clipPath
.
shape
[
ca
rtesian
.
getBaseAxis
()
.
isHorizontal
()
?
'
width
'
:
'
height
'
]
=
0
;
clipPath
.
animateTo
({
shape
:
{
width
:
xExtent
[
1
]
-
xExtent
[
0
],
...
...
@@ -232,6 +258,8 @@ define(function(require) {
var
radiusExtent
=
radiusAxis
.
getExtent
();
var
PI2
=
Math
.
PI
*
2
;
var
clipPath
=
new
graphic
.
Sector
({
shape
:
{
cx
:
polar
.
cx
,
...
...
@@ -239,7 +267,7 @@ define(function(require) {
r0
:
radiusExtent
[
0
],
r
:
radiusExtent
[
1
],
startAngle
:
0
,
endAngle
:
Math
.
PI
*
2
endAngle
:
PI
2
}
});
...
...
@@ -247,7 +275,7 @@ define(function(require) {
clipPath
.
shape
.
endAngle
=
0
;
clipPath
.
animateTo
({
shape
:
{
endAngle
:
Math
.
PI
*
2
endAngle
:
PI
2
}
},
1500
,
animation
);
}
...
...
src/chart/line/lineAnimationDiff.js
浏览文件 @
1940aff8
...
...
@@ -19,8 +19,7 @@ define(function (require) {
for
(
var
i
=
0
;
i
<
diff
.
length
;
i
++
)
{
var
diffItem
=
diff
[
i
];
status
.
push
(
diffItem
);
var
pointAdded
=
true
;
// FIXME, animation is not so perfect when dataZoom window moves fast
// Which is in case remvoing or add more than one data in the tail or head
...
...
@@ -38,13 +37,23 @@ define(function (require) {
break
;
case
'
-
'
:
var
oldDataItem
=
oldData
[
diffItem
.
idx
];
oldPoints
.
push
(
oldDataItem
.
point
);
newPoints
.
push
(
newCoordSys
.
dataToPoint
([
oldDataItem
.
x
,
oldDataItem
.
y
]));
rawIndices
.
push
(
oldDataItem
.
rawIdx
);
// Data is replaced. In the case of dynamic data queue
// FIXME FIXME FIXME
if
(
oldDataItem
.
rawIdx
!==
diffItem
.
idx
)
{
oldPoints
.
push
(
oldDataItem
.
point
);
newPoints
.
push
(
newCoordSys
.
dataToPoint
([
oldDataItem
.
x
,
oldDataItem
.
y
]));
rawIndices
.
push
(
oldDataItem
.
rawIdx
);
}
else
{
pointAdded
=
false
;
}
}
// Original indices
sortedIndices
.
push
(
i
);
if
(
pointAdded
)
{
status
.
push
(
diffItem
);
sortedIndices
.
push
(
sortedIndices
.
length
);
}
}
// Diff result may be crossed if all items are changed
...
...
src/component/axis.js
浏览文件 @
1940aff8
...
...
@@ -9,10 +9,21 @@ define(function(require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
graphic
=
require
(
'
../util/graphic
'
);
var
elementList
=
[
'
axisLine
'
,
'
axisTick
'
,
'
splitLine
'
,
'
splitArea
'
];
var
elementList
=
[
'
axisLine
'
,
'
axis
Label
'
,
'
axis
Tick
'
,
'
splitLine
'
,
'
splitArea
'
];
require
(
'
../coord/cartesian/AxisModel
'
);
// Mixin axis label interval calculation helper
var
axisLabelInterval
=
require
(
'
../coord/cartesian/axisLabelInterval
'
);
var
Axis2D
=
require
(
'
../coord/cartesian/Axis2D
'
);
Axis2D
.
prototype
.
getLabelInterval
=
function
()
{
var
labelInterval
=
this
.
_labelInterval
;
if
(
!
labelInterval
)
{
labelInterval
=
this
.
_labelInterval
=
axisLabelInterval
(
this
);
}
return
labelInterval
;
}
/**
* @inner
*/
...
...
@@ -81,13 +92,10 @@ define(function(require) {
this
.
group
.
removeAll
();
var
gridModel
=
ecModel
.
getComponent
(
'
grid
'
,
axisModel
.
get
(
'
gridIndex
'
));
var
labelInterval
=
axisModel
.
get
(
'
axisLabel.interval
'
);
var
labelInterval
=
axisModel
.
axis
.
getLabelInterval
(
);
this
.
_axisLinePosition
=
getAxisLinePosition
(
axisModel
,
gridModel
);
if
(
axisModel
.
get
(
'
axisLabel.show
'
))
{
labelInterval
=
this
.
_axisLabel
(
axisModel
,
gridModel
);
}
zrUtil
.
each
(
elementList
,
function
(
name
)
{
if
(
axisModel
.
get
(
name
+
'
.show
'
))
{
this
[
'
_
'
+
name
](
axisModel
,
gridModel
,
labelInterval
);
...
...
@@ -100,7 +108,7 @@ define(function(require) {
* @param {module:echarts/coord/cartesian/GridModel} gridModel
* @private
*/
_axisLabel
:
function
(
axisModel
,
gridModel
)
{
_axisLabel
:
function
(
axisModel
,
gridModel
,
labelInterval
)
{
var
axis
=
axisModel
.
axis
;
var
labelModel
=
axisModel
.
getModel
(
'
axisLabel
'
);
...
...
@@ -112,31 +120,11 @@ define(function(require) {
var
labels
=
axisModel
.
formatLabels
(
axis
.
scale
.
getTicksLabels
());
var
labelMargin
=
labelModel
.
get
(
'
margin
'
);
var
labelRotate
=
labelModel
.
get
(
'
rotate
'
);
var
labelInterval
=
labelModel
.
get
(
'
interval
'
);
var
isLabelIntervalFunction
=
typeof
labelInterval
===
'
function
'
;
var
textSpaceTakenRect
;
var
needsCheckTextSpace
;
var
autoLabelInterval
=
0
;
var
accumulatedLabelInterval
=
0
;
var
textList
=
[];
for
(
var
i
=
0
;
i
<
ticks
.
length
;
i
++
)
{
needsCheckTextSpace
=
false
;
var
tick
=
ticks
[
i
];
// Only ordinal scale support label interval
if
(
axis
.
scale
.
type
===
'
ordinal
'
)
{
if
(
labelInterval
===
'
auto
'
)
{
needsCheckTextSpace
=
true
;
}
else
if
(
isLabelIntervalFunction
&&
!
labelInterval
(
tick
,
axis
.
scale
.
getItem
(
tick
))
||
tick
%
(
labelInterval
+
1
)
)
{
continue
;
}
if
(
ifIgnoreOnTick
(
axis
,
i
,
labelInterval
))
{
continue
;
}
var
x
;
...
...
@@ -185,39 +173,8 @@ define(function(require) {
z
:
axisModel
.
get
(
'
z
'
)
});
textList
.
push
(
textEl
);
// Calculate label interval
if
(
needsCheckTextSpace
&&
!
labelRotate
)
{
var
rect
=
textEl
.
getBoundingRect
();
if
(
!
textSpaceTakenRect
)
{
textSpaceTakenRect
=
rect
.
clone
();
}
// There is no space for current label;
else
if
(
textSpaceTakenRect
.
intersect
(
rect
))
{
accumulatedLabelInterval
++
;
continue
;
}
else
{
textSpaceTakenRect
.
union
(
rect
);
}
autoLabelInterval
=
Math
.
max
(
autoLabelInterval
,
accumulatedLabelInterval
);
// Reset
accumulatedLabelInterval
=
0
;
}
}
for
(
var
i
=
0
;
i
<
textList
.
length
;
i
++
)
{
if
(
!
(
needsCheckTextSpace
&&
!
labelRotate
&&
i
%
(
autoLabelInterval
+
1
))
)
{
this
.
group
.
add
(
textList
[
i
]);
}
this
.
group
.
add
(
textEl
);
}
return
needsCheckTextSpace
?
autoLabelInterval
:
labelInterval
;
},
/**
...
...
src/coord/cartesian/Axis2D.js
浏览文件 @
1940aff8
...
...
@@ -39,6 +39,12 @@ define(function (require) {
constructor
:
Axis2D
,
/**
* Axis model
* @param {module:echarts/coord/cartesian/AxisModel}
*/
model
:
null
,
isHorizontal
:
function
()
{
var
position
=
this
.
position
;
return
position
===
'
top
'
||
position
===
'
bottom
'
;
...
...
src/coord/cartesian/Cartesian2D.js
浏览文件 @
1940aff8
...
...
@@ -14,8 +14,24 @@ define(function(require) {
type
:
'
cartesian2d
'
,
/**
* Base axis is the category axis if exists.
* If don't, x axis will be the base axis.
*
* Base axis will be used on stacking.
*
* @return {module:echarts/coord/cartesian/Axis2D}
*/
getBaseAxis
:
function
()
{
var
xAxis
=
this
.
getAxis
(
'
x
'
);
var
yAxis
=
this
.
getAxis
(
'
y
'
);
return
yAxis
.
scale
.
type
===
'
ordinal
'
?
yAxis
:
xAxis
;
},
/**
* If contain point
* @param {Array.<number>} point
* @return {boolean}
*/
containPoint
:
function
(
point
)
{
return
this
.
getAxis
(
'
x
'
).
contain
(
point
[
0
])
...
...
src/coord/cartesian/Grid.js
浏览文件 @
1940aff8
...
...
@@ -236,6 +236,9 @@ define(function(require, factory) {
// Inject axis into axisModel
axisModel
.
axis
=
axis
;
// Inject axisModel into axis
axis
.
model
=
axisModel
;
this
.
_axesList
.
push
(
axis
);
this
.
_axesMap
[
axisType
+
idx
]
=
axis
;
...
...
src/coord/cartesian/axisLabelInterval.js
0 → 100644
浏览文件 @
1940aff8
/**
* Helper function for axisLabelInterval calculation
*/
define
(
function
(
require
)
{
'
use strict
'
;
var
textContain
=
require
(
'
zrender/contain/text
'
);
return
function
(
axis
)
{
var
axisModel
=
axis
.
model
;
var
labelModel
=
axisModel
.
getModel
(
'
axisLabel
'
);
var
labelInterval
=
labelModel
.
get
(
'
interval
'
);
if
(
!
(
axis
.
isHorizontal
()
&&
axis
.
type
===
'
category
'
&&
labelInterval
===
'
auto
'
&&
!
labelModel
.
get
(
'
rotate
'
))
)
{
return
labelInterval
===
'
auto
'
?
0
:
labelInterval
;
}
var
ticks
=
axis
.
scale
.
getTicks
();
var
labels
=
axisModel
.
formatLabels
(
axis
.
scale
.
getTicksLabels
());
var
font
=
labelModel
.
getModel
(
'
textStyle
'
).
getFont
();
var
textSpaceTakenRect
;
var
autoLabelInterval
=
0
;
var
accumulatedLabelInterval
=
0
;
for
(
var
i
=
0
;
i
<
ticks
.
length
;
i
++
)
{
var
tick
=
ticks
[
i
];
var
tickCoord
=
axis
.
dataToCoord
(
tick
);
var
rect
=
textContain
.
getBoundingRect
(
labels
[
i
],
font
,
'
center
'
,
'
top
'
);
rect
.
x
+=
tickCoord
;
if
(
!
textSpaceTakenRect
)
{
textSpaceTakenRect
=
rect
.
clone
();
}
// There is no space for current label;
else
if
(
textSpaceTakenRect
.
intersect
(
rect
))
{
accumulatedLabelInterval
++
;
continue
;
}
else
{
textSpaceTakenRect
.
union
(
rect
);
}
autoLabelInterval
=
Math
.
max
(
autoLabelInterval
,
accumulatedLabelInterval
);
// Reset
accumulatedLabelInterval
=
0
;
}
return
autoLabelInterval
;
}
});
\ No newline at end of file
src/coord/polar/Polar.js
浏览文件 @
1940aff8
...
...
@@ -94,6 +94,28 @@ define(function(require) {
return
this
.
_radiusAxis
;
},
/**
* @param {module:echarts/coord/polar/Axis}
* @return {module:echarts/coord/polar/Axis}
*/
getOtherAxis
:
function
(
axis
)
{
var
angleAxis
=
this
.
_angleAxis
;
return
axis
===
angleAxis
?
this
.
_radiusAxis
:
angleAxis
;
},
/**
* Base axis is the category axis if exists.
* If don't, angle axis will be the base axis.
*
* Base axis will be used on stacking.
*
* @return {module:echarts/coord/polar/Axis}
*/
getBaseAxis
:
function
()
{
var
radiusAxis
=
this
.
_radiusAxis
;
return
radiusAxis
.
scale
.
type
===
'
ordinal
'
?
radiusAxis
:
this
.
_angleAxis
;
},
/**
* Convert series data to a list of (x, y) points
* @param {module:echarts/data/List} data
...
...
src/data/List.js
浏览文件 @
1940aff8
...
...
@@ -26,12 +26,15 @@ define(function (require) {
/**
* @constructor
* @alias module:echarts/data/List
*
* @param {Array.<string>} dimensions
* @param {module:echarts/model/Model} seriesModel
*/
var
List
=
function
(
dimensions
,
seriesModel
)
{
dimensions
=
dimensions
||
[
'
x
'
,
'
y
'
];
var
dimensionInfos
=
[]
;
var
dimensionInfos
=
{}
;
var
dimensionNames
=
[];
for
(
var
i
=
0
;
i
<
dimensions
.
length
;
i
++
)
{
var
dimensionName
;
...
...
@@ -40,6 +43,7 @@ define(function (require) {
dimensionName
=
dimensions
[
i
];
dimensionInfo
=
{
name
:
dimensionName
,
stackable
:
false
,
// Type can be 'float', 'int', 'number'
// Default is number, Precision of float may not enough
type
:
'
number
'
...
...
@@ -51,7 +55,7 @@ define(function (require) {
dimensionInfo
.
type
=
dimensionInfo
.
type
||
'
float
'
}
dimensionNames
.
push
(
dimensionName
);
dimensionInfos
.
push
(
dimensionInfo
)
;
dimensionInfos
[
dimensionName
]
=
dimensionInfo
;
}
/**
* @readOnly
...
...
@@ -61,6 +65,7 @@ define(function (require) {
/**
* Infomation of each data dimension, like data type.
* @type {Object}
*/
this
.
_dimensionInfos
=
dimensionInfos
;
...
...
@@ -152,12 +157,13 @@ define(function (require) {
var
dimensions
=
this
.
dimensions
;
var
size
=
data
.
length
;
var
dimensionInfoMap
=
this
.
_dimensionInfos
nameList
=
nameList
||
[];
// Init storage
for
(
var
i
=
0
;
i
<
dimensions
.
length
;
i
++
)
{
var
dimInfo
=
this
.
_dimensionInfos
[
i
];
var
dimInfo
=
dimensionInfoMap
[
dimensions
[
i
]
];
var
DataCtor
=
dataCtors
[
dimInfo
.
type
];
storage
[
dimensions
[
i
]]
=
new
DataCtor
(
size
);
}
...
...
@@ -195,7 +201,7 @@ define(function (require) {
// Store the data by dimensions
for
(
var
k
=
0
;
k
<
dimensions
.
length
;
k
++
)
{
var
dim
=
dimensions
[
k
];
var
dimInfo
=
this
.
_dimensionInfos
[
k
];
var
dimInfo
=
dimensionInfoMap
[
dim
];
var
dimStorage
=
storage
[
dim
];
var
dimValue
=
value
[
k
];
// PENDING NULL is empty or zero
...
...
@@ -222,7 +228,7 @@ define(function (require) {
var
modelIdx
=
optionModelIndices
[
i
];
var
model
=
optionModels
[
modelIdx
];
if
(
model
&&
model
.
option
)
{
nameList
[
i
]
=
model
.
option
.
name
||
''
;
nameList
[
i
]
=
model
.
option
.
name
||
(
''
+
i
)
;
}
}
}
...
...
@@ -365,20 +371,16 @@ define(function (require) {
return
dimensions
;
}
function
getStackDimMap
(
stackDim
,
dimensions
)
{
if
(
!
stackDim
)
{
return
{};
}
if
(
typeof
stackDim
===
'
string
'
)
{
stackDim
=
[
stackDim
];
}
/**
* @private
*/
listProto
.
_getStackDimMap
=
function
(
dimensions
)
{
var
stackDimMap
=
{};
var
dimensionsInfoMap
=
this
.
_dimensionInfos
;
// Avoid get the undefined value
for
(
var
i
=
0
;
i
<
dimensions
.
length
;
i
++
)
{
stackDimMap
[
dimensions
[
i
]]
=
false
;
}
for
(
var
i
=
0
;
i
<
stackDim
.
length
;
i
++
)
{
stackDimMap
[
stackDim
[
i
]]
=
true
;
var
dim
=
dimensions
[
i
]
stackDimMap
[
dim
]
=
!!
dimensionsInfoMap
[
dim
].
stackable
;
}
return
stackDimMap
;
}
...
...
@@ -409,7 +411,7 @@ define(function (require) {
var
indices
=
this
.
indices
;
// Only stacked on the value axis
var
stackDimMap
=
getStackDimMap
(
this
.
_rawValueDims
,
dimensions
);
var
stackDimMap
=
this
.
_getStackDimMap
(
dimensions
);
// Optimizing for 1 dim case
var
firstDimStack
=
stack
&&
stackDimMap
[
dimensions
[
0
]];
...
...
@@ -451,7 +453,7 @@ define(function (require) {
var
indices
=
this
.
indices
;
// Only stacked on the value axis
var
stackDimMap
=
getStackDimMap
(
this
.
_rawValueDims
,
dimensions
);
var
stackDimMap
=
this
.
_getStackDimMap
(
dimensions
);
// Optimizing for 1 dim case
var
firstDimStack
=
stack
&&
stackDimMap
[
dimensions
[
0
]];
...
...
@@ -660,7 +662,11 @@ define(function (require) {
* @param {*} context
*/
listProto
.
eachItemGraphicEl
=
function
(
cb
,
context
)
{
zrUtil
.
each
(
this
.
_graphicEls
,
cb
,
context
);
zrUtil
.
each
(
this
.
_graphicEls
,
function
(
el
,
idx
)
{
if
(
el
)
{
cb
&&
cb
.
call
(
context
,
el
,
idx
);
}
});
};
/**
...
...
@@ -668,7 +674,10 @@ define(function (require) {
* New list only change the indices.
*/
listProto
.
cloneShallow
=
function
()
{
var
list
=
new
List
(
this
.
_dimensionInfos
,
this
.
seriesModel
);
var
dimensionInfoList
=
zrUtil
.
map
(
this
.
dimensions
,
function
(
dim
)
{
return
this
.
_dimensionInfos
[
dim
];
},
this
);
var
list
=
new
List
(
dimensionInfoList
,
this
.
seriesModel
);
list
.
stackedOn
=
this
.
stackedOn
;
// FIXME
...
...
@@ -690,19 +699,30 @@ define(function (require) {
var
dimensions
;
var
categoryAxisModel
;
var
nameList
=
[];
// FIXME
// 这里 List 跟几个坐标系和坐标系 Model 耦合了
if
(
coordinateSystem
===
'
cartesian2d
'
)
{
var
xAxisModel
=
ecModel
.
getComponent
(
'
xAxis
'
,
seriesModel
.
get
(
'
xAxisIndex
'
));
var
yAxisModel
=
ecModel
.
getComponent
(
'
yAxis
'
,
seriesModel
.
get
(
'
yAxisIndex
'
));
if
(
xAxisModel
.
get
(
'
type
'
)
===
'
category
'
)
{
dimensions
=
[
'
x
'
,
'
y
'
];
dimensions
=
[{
name
:
'
x
'
,
type
:
'
int
'
},
{
name
:
'
y
'
,
stackable
:
true
}];
categoryAxisModel
=
xAxisModel
;
}
else
if
(
yAxisModel
.
get
(
'
type
'
)
===
'
category
'
)
{
dimensions
=
[
'
y
'
,
'
x
'
];
dimensions
=
[{
name
:
'
y
'
,
type
:
'
int
'
},
{
name
:
'
x
'
,
stackable
:
true
}];
categoryAxisModel
=
yAxisModel
;
}
...
...
@@ -725,12 +745,24 @@ define(function (require) {
var
radiusAxisModel
=
ecModel
.
findComponent
(
'
radiusAxis
'
,
axisFinder
);
if
(
angleAxisModel
.
get
(
'
type
'
)
===
'
category
'
)
{
dimensions
=
[
'
angle
'
,
'
radius
'
];
dimensions
=
[{
name
:
'
angle
'
,
type
:
'
int
'
},
{
name
:
'
radius
'
,
stackable
:
true
}];
categoryAxisModel
=
angleAxisModel
;
}
else
if
(
radiusAxisModel
.
get
(
'
type
'
)
===
'
category
'
)
{
dimensions
=
[
'
radius
'
,
'
angle
'
];
dimensions
=
[{
name
:
'
radius
'
,
type
:
'
int
'
},
{
name
:
'
angle
'
,
stackable
:
true
}];
categoryAxisModel
=
radiusAxisModel
;
}
...
...
@@ -746,8 +778,24 @@ define(function (require) {
}
}
var
nameList
=
[];
if
(
categoryAxisModel
)
{
nameList
=
categoryAxisModel
.
get
(
'
data
'
);
var
categories
=
categoryAxisModel
.
get
(
'
data
'
);
if
(
categories
)
{
var
dataLen
=
data
.
length
;
// Ordered data is given explicitly like
// [[1, 0.2], [2, 0.3], [3, 0.15]]
// Pick the category
if
(
data
[
0
]
&&
data
[
0
].
length
>
1
&&
categories
.
length
>
dataLen
)
{
nameList
=
[];
for
(
var
i
=
0
;
i
<
dataLen
;
i
++
)
{
nameList
[
i
]
=
categories
[
data
[
i
][
0
]];
}
}
else
{
nameList
=
categories
.
slice
();
}
}
}
var
list
=
new
List
(
dimensions
,
seriesModel
);
...
...
src/echarts.js
浏览文件 @
1940aff8
...
...
@@ -380,7 +380,16 @@ define(function (require) {
var
api
=
this
.
_extensionAPI
;
// Render all components
zrUtil
.
each
(
this
.
_componentsList
,
function
(
component
)
{
component
.
render
(
component
.
__model
,
ecModel
,
api
,
event
);
var
componentModel
=
component
.
__model
;
component
.
render
(
componentModel
,
ecModel
,
api
,
event
);
var
z
=
componentModel
.
get
(
'
z
'
);
var
zlevel
=
componentModel
.
get
(
'
zlevel
'
);
// Set z and zlevel
component
.
group
.
traverse
(
function
(
el
)
{
el
.
z
=
z
;
el
.
zlevel
=
zlevel
;
});
},
this
);
zrUtil
.
each
(
this
.
_chartsList
,
function
(
chart
)
{
...
...
@@ -393,6 +402,14 @@ define(function (require) {
var
chart
=
this
.
_chartsMap
[
id
];
chart
.
__keepAlive
=
true
;
chart
.
render
(
seriesModel
,
ecModel
,
api
,
event
);
var
z
=
seriesModel
.
get
(
'
z
'
);
var
zlevel
=
seriesModel
.
get
(
'
zlevel
'
);
// Set z and zlevel
chart
.
group
.
traverse
(
function
(
el
)
{
el
.
z
=
z
;
el
.
zlevel
=
zlevel
});
},
this
);
// Remove groups of charts
...
...
src/layout/line.js
0 → 100644
浏览文件 @
1940aff8
define
(
function
(
require
)
{
'
use strict
'
;
function
getSeriesStackId
(
seriesModel
)
{
return
seriesModel
.
get
(
'
stack
'
)
||
'
__ec_stack_
'
+
seriesModel
.
seriesIndex
;
}
return
function
(
seriesType
,
ecModel
,
api
)
{
var
lastStackCoords
=
{};
ecModel
.
eachSeriesByType
(
seriesType
,
function
(
lineSeries
)
{
var
data
=
lineSeries
.
getData
();
var
coordSys
=
lineSeries
.
coordinateSystem
;
var
dims
=
coordSys
.
type
===
'
cartesian2d
'
?
[
'
x
'
,
'
y
'
]
:
[
'
radius
'
,
'
angle
'
];
var
stackId
=
getSeriesStackId
(
lineSeries
);
var
baseAxis
=
coordSys
.
getBaseAxis
();
var
valueAxis
=
coordSys
.
getOtherAxis
(
baseAxis
);
var
valueAxisStart
=
valueAxis
.
getExtent
()[
0
];
var
baseCoordOffset
=
baseAxis
.
dim
===
'
x
'
?
0
:
1
;
lastStackCoords
[
stackId
]
=
lastStackCoords
[
stackId
]
||
[];
data
.
each
(
dims
,
function
(
x
,
y
,
idx
)
{
if
(
!
isNaN
(
y
)
&&
!
isNaN
(
x
))
{
var
lastCoord
=
lastStackCoords
[
stackId
][
idx
]
||
valueAxisStart
;
var
point
=
coordSys
.
dataToPoint
([
x
,
y
]);
var
stackPoint
=
[];
stackPoint
[
baseCoordOffset
]
=
point
[
baseCoordOffset
];
stackPoint
[
1
-
baseCoordOffset
]
=
lastCoord
;
lastStackCoords
[
stackId
][
idx
]
=
lastCoord
;
data
.
setItemLayout
(
idx
,
{
point
:
point
,
// Stack points for area charts
stackOn
:
stackPoint
});
}
},
true
);
});
}
});
\ No newline at end of file
src/layout/points.js
浏览文件 @
1940aff8
...
...
@@ -9,7 +9,9 @@ define(function (require) {
data
.
each
(
dims
,
function
(
x
,
y
,
idx
)
{
if
(
!
isNaN
(
y
)
&&
!
isNaN
(
x
))
{
var
point
=
coordSys
.
dataToPoint
([
x
,
y
]);
data
.
setItemLayout
(
idx
,
point
);
data
.
setItemLayout
(
idx
,
{
point
:
point
});
}
},
true
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录