Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
a6e52294
I
incubator-echarts
项目概览
missman
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
a6e52294
编写于
11月 23, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak
上级
733281de
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
117 addition
and
82 deletion
+117
-82
src/chart/funnel/FunnelSeries.js
src/chart/funnel/FunnelSeries.js
+4
-10
src/chart/line/LineView.js
src/chart/line/LineView.js
+4
-3
src/chart/pie/PieSeries.js
src/chart/pie/PieSeries.js
+6
-6
src/chart/pie/PieView.js
src/chart/pie/PieView.js
+17
-14
src/chart/pie/labelLayout.js
src/chart/pie/labelLayout.js
+3
-2
src/component/marker/MarkPointView.js
src/component/marker/MarkPointView.js
+3
-3
src/component/marker/markerHelper.js
src/component/marker/markerHelper.js
+24
-3
src/data/List.js
src/data/List.js
+3
-4
src/model/Series.js
src/model/Series.js
+7
-20
src/model/globalDefault.js
src/model/globalDefault.js
+1
-1
src/util/graphic.js
src/util/graphic.js
+3
-3
src/util/model.js
src/util/model.js
+40
-9
src/util/number.js
src/util/number.js
+1
-1
src/view/Chart.js
src/view/Chart.js
+1
-3
未找到文件。
src/chart/funnel/FunnelSeries.js
浏览文件 @
a6e52294
...
...
@@ -4,6 +4,7 @@ define(function(require) {
var
List
=
require
(
'
../../data/List
'
);
var
SeriesModel
=
require
(
'
../../model/Series
'
);
var
modelUtil
=
require
(
'
../../util/model
'
);
var
FunnelSeries
=
SeriesModel
.
extend
({
...
...
@@ -17,14 +18,8 @@ define(function(require) {
this
.
legendDataProvider
=
function
()
{
return
this
.
_dataBeforeProcessed
;
};
// Extend labelLine emphasis
// this._defaultLabelLine();
},
mergeOption
:
function
(
newOption
)
{
SeriesModel
.
prototype
.
mergeOption
.
call
(
this
,
newOption
);
this
.
_defaultLabelLine
();
this
.
_defaultLabelLine
(
option
);
},
getInitialData
:
function
(
option
,
ecModel
)
{
...
...
@@ -33,11 +28,10 @@ define(function(require) {
return
list
;
},
_defaultLabelLine
:
function
()
{
_defaultLabelLine
:
function
(
option
)
{
// Extend labelLine emphasis
this
.
defaultEmphasis
(
'
labelLine
'
,
[
'
show
'
]);
modelUtil
.
defaultEmphasis
(
option
.
labelLine
,
[
'
show
'
]);
var
option
=
this
.
option
;
var
labelLineNormalOpt
=
option
.
labelLine
.
normal
;
var
labelLineEmphasisOpt
=
option
.
labelLine
.
emphasis
;
// Not show label line if `label.normal.show = false`
...
...
src/chart/line/LineView.js
浏览文件 @
a6e52294
...
...
@@ -145,13 +145,13 @@ define(function(require) {
);
}
// Always update, or it is wrong in the case turning on legend
// Always update, or it is wrong in the case turning on legend
because points is not changed
symbolDraw
.
updateData
(
data
,
api
,
isSymbolIgnore
);
// Stop symbol animation and sync with line points
// FIXME performance?
data
.
eachItemGraphicEl
(
function
(
el
)
{
el
.
stopAnimation
();
el
.
stopAnimation
(
true
);
});
// In the case data zoom triggerred refreshing frequently
...
...
@@ -293,6 +293,7 @@ define(function(require) {
/**
* @private
*/
// FIXME Two value axis
_updateAnimation
:
function
(
data
,
stackedOnPoints
,
coordSys
,
api
)
{
var
polyline
=
this
.
_polyline
;
var
polygon
=
this
.
_polygon
;
...
...
@@ -339,7 +340,7 @@ define(function(require) {
}
}
if
(
polyline
.
animators
)
{
if
(
polyline
.
animators
&&
polyline
.
animators
.
length
)
{
polyline
.
animators
[
0
].
during
(
function
()
{
for
(
var
i
=
0
;
i
<
updatedDataInfo
.
length
;
i
++
)
{
var
el
=
updatedDataInfo
[
i
].
el
;
...
...
src/chart/pie/PieSeries.js
浏览文件 @
a6e52294
...
...
@@ -5,6 +5,7 @@ define(function(require) {
var
List
=
require
(
'
../../data/List
'
);
var
SeriesModel
=
require
(
'
../../model/Series
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
modelUtil
=
require
(
'
../../util/model
'
);
var
dataSelectableMixin
=
require
(
'
../helper/dataSelectableMixin
'
);
...
...
@@ -26,15 +27,13 @@ define(function(require) {
this
.
updateSelectedMap
();
this
.
_defaultLabelLine
();
this
.
_defaultLabelLine
(
option
);
},
// Overwrite
mergeOption
:
function
(
newOption
)
{
seriesModelProto
.
mergeOption
.
call
(
this
,
newOption
);
this
.
updateSelectedMap
();
this
.
_defaultLabelLine
();
},
getInitialData
:
function
(
option
,
ecModel
)
{
...
...
@@ -54,11 +53,10 @@ define(function(require) {
return
params
;
},
_defaultLabelLine
:
function
()
{
_defaultLabelLine
:
function
(
option
)
{
// Extend labelLine emphasis
this
.
defaultEmphasis
(
'
labelLine
'
,
[
'
show
'
]);
modelUtil
.
defaultEmphasis
(
option
.
labelLine
,
[
'
show
'
]);
var
option
=
this
.
option
;
var
labelLineNormalOpt
=
option
.
labelLine
.
normal
;
var
labelLineEmphasisOpt
=
option
.
labelLine
.
emphasis
;
// Not show label line if `label.normal.show = false`
...
...
@@ -82,6 +80,8 @@ define(function(require) {
minAngle
:
0
,
// 选中是扇区偏移量
selectedOffset
:
10
,
// If use strategy to avoid label overlapping
avoidLabelOverlap
:
true
,
// 选择模式,默认关闭,可选single,multiple
// selectedMode: false,
...
...
src/chart/pie/PieView.js
浏览文件 @
a6e52294
...
...
@@ -93,6 +93,19 @@ define(function (require) {
var
piePieceProto
=
PiePiece
.
prototype
;
function
getLabelStyle
(
data
,
idx
,
state
,
labelModel
)
{
var
textStyleModel
=
labelModel
.
getModel
(
'
textStyle
'
);
var
position
=
labelModel
.
get
(
'
position
'
);
var
isLabelInside
=
position
===
'
inside
'
||
position
===
'
inner
'
;
return
{
fill
:
textStyleModel
.
get
(
'
color
'
)
||
isLabelInside
?
'
#fff
'
:
data
.
getItemVisual
(
idx
,
'
color
'
),
textFont
:
textStyleModel
.
getFont
(),
text
:
data
.
hostModel
.
getFormattedLabel
(
idx
,
state
)
||
data
.
getName
(
idx
)
};
}
piePieceProto
.
updateData
=
function
(
data
,
idx
,
api
,
firstCreate
)
{
var
sector
=
this
.
childAt
(
0
);
...
...
@@ -167,17 +180,7 @@ define(function (require) {
var
labelLineModel
=
itemModel
.
getModel
(
'
labelLine.normal
'
);
var
labelLineHoverModel
=
itemModel
.
getModel
(
'
labelLine.emphasis
'
);
var
textStyleModel
=
labelModel
.
getModel
(
'
textStyle
'
);
var
labelPosition
=
labelModel
.
get
(
'
position
'
);
var
isLabelInside
=
labelPosition
===
'
inside
'
||
labelPosition
===
'
inner
'
;
labelText
.
setStyle
({
fill
:
textStyleModel
.
get
(
'
color
'
)
||
isLabelInside
?
'
#fff
'
:
visualColor
,
text
:
seriesModel
.
getFormattedLabel
(
idx
,
'
normal
'
)
||
data
.
getName
(
idx
),
textFont
:
textStyleModel
.
getFont
()
});
labelText
.
setStyle
(
getLabelStyle
(
data
,
idx
,
'
normal
'
,
labelModel
));
labelText
.
ignore
=
labelText
.
normalIgnore
=
!
labelModel
.
get
(
'
show
'
);
labelText
.
hoverIgnore
=
!
labelHoverModel
.
get
(
'
show
'
);
...
...
@@ -189,7 +192,7 @@ define(function (require) {
labelLine
.
setStyle
({
stroke
:
visualColor
});
labelLine
.
setStyle
(
labelLineModel
.
getLineStyle
());
labelLine
.
setStyle
(
labelLineModel
.
get
Model
(
'
lineStyle
'
).
get
LineStyle
());
sector
.
setStyle
(
zrUtil
.
extend
(
...
...
@@ -200,8 +203,8 @@ define(function (require) {
)
);
sector
.
hoverStyle
=
itemStyleModel
.
getModel
(
'
emphasis
'
).
getItemStyle
();
labelText
.
hoverStyle
=
labelHoverModel
.
getModel
(
'
textStyle
'
).
getItemStyle
(
);
labelLine
.
hoverStyle
=
labelLineHoverModel
.
getLineStyle
();
labelText
.
hoverStyle
=
getLabelStyle
(
data
,
idx
,
'
emphasis
'
,
labelHoverModel
);
labelLine
.
hoverStyle
=
labelLineHoverModel
.
get
Model
(
'
lineStyle
'
).
get
LineStyle
();
graphic
.
setHoverStyle
(
this
);
...
...
src/chart/pie/labelLayout.js
浏览文件 @
a6e52294
...
...
@@ -216,7 +216,8 @@ define(function (require) {
labelLayoutList
.
push
(
layout
.
label
);
});
!
hasLabelRotate
&&
avoidOverlap
(
labelLayoutList
,
cx
,
cy
,
r
,
viewWidth
,
viewHeight
);
if
(
!
hasLabelRotate
&&
seriesModel
.
get
(
'
avoidLabelOverlap
'
))
{
avoidOverlap
(
labelLayoutList
,
cx
,
cy
,
r
,
viewWidth
,
viewHeight
);
}
};
});
\ No newline at end of file
src/component/marker/MarkPointView.js
浏览文件 @
a6e52294
...
...
@@ -77,7 +77,7 @@ define(function (require) {
}
var
mpData
=
createList
(
coordSys
,
seriesData
,
mpModel
);
var
dims
=
coordSys
.
dimensions
;
var
dims
=
coordSys
&&
coordSys
.
dimensions
;
// Overwrite getRawValue
// FIXME
...
...
@@ -97,7 +97,7 @@ define(function (require) {
if
(
xPx
!=
null
&&
yPx
!=
null
)
{
point
=
[
xPx
,
yPx
];
}
else
{
else
if
(
coordSys
)
{
var
x
=
mpData
.
get
(
dims
[
0
],
idx
);
var
y
=
mpData
.
get
(
dims
[
1
],
idx
);
point
=
coordSys
.
dataToPoint
([
x
,
y
]);
...
...
@@ -129,7 +129,7 @@ define(function (require) {
/**
* @inner
* @param {module:echarts/coord/*}
coordSys
* @param {module:echarts/coord/*}
[coordSys]
* @param {module:echarts/data/List} seriesData
* @param {module:echarts/model/Model} mpModel
*/
...
...
src/component/marker/markerHelper.js
浏览文件 @
a6e52294
...
...
@@ -62,10 +62,22 @@ define(function (require) {
average
:
curry
(
markerTypeCalculatorWithExtent
,
0.5
)
};
/**
* Transform markPoint data item to format used in List by do the following
* 1. Calculate statistic like `max`, `min`, `average`
* 2. Convert `item.xAxis`, `item.yAxis` to `item.value` array
* @param {module:echarts/data/List} data
* @param {module:echarts/coord/*} [coordSys]
* @param {Object} item
* @return {Object}
*/
var
dataTransform
=
function
(
data
,
coordSys
,
item
)
{
// 1. If not specify the position with pixel directly
// 2. If value is not a data array. Which uses xAxis, yAxis to specify the value on each dimension
if
(
isNaN
(
item
.
x
)
||
isNaN
(
item
.
y
)
&&
!
zrUtil
.
isArray
(
item
.
value
))
{
if
(
isNaN
(
item
.
x
)
||
isNaN
(
item
.
y
)
&&
!
zrUtil
.
isArray
(
item
.
value
)
&&
coordSys
)
{
var
valueAxisDim
;
var
baseAxisDim
;
var
valueAxis
;
...
...
@@ -113,11 +125,20 @@ define(function (require) {
return
item
;
};
// Filter data which is out of coordinateSystem range
/**
* Filter data which is out of coordinateSystem range
* [dataFilter description]
* @param {module:echarts/coord/*} [coordSys]
* @param {Array.<number>} coordDataIdx
* @param {Object} item
* @return {boolean}
*/
var
dataFilter
=
function
(
coordSys
,
coordDataIdx
,
item
)
{
var
value
=
item
.
value
;
value
=
[
value
[
coordDataIdx
[
0
]],
value
[
coordDataIdx
[
1
]]];
return
coordSys
.
containData
(
value
);
// Alwalys return true if there is no coordSys
return
coordSys
?
coordSys
.
containData
(
value
)
:
true
;
};
return
{
...
...
src/data/List.js
浏览文件 @
a6e52294
...
...
@@ -790,18 +790,17 @@ define(function (require) {
/**
* Create a data differ
* @param {module:echarts/data/List} o
ld
List
* @param {module:echarts/data/List} o
ther
List
* @return {module:echarts/data/DataDiffer}
*/
listProto
.
diff
=
function
(
o
ld
List
)
{
listProto
.
diff
=
function
(
o
ther
List
)
{
var
idList
=
this
.
_idList
;
return
new
DataDiffer
(
o
ldList
?
old
List
.
indices
:
[],
this
.
indices
,
function
(
idx
)
{
o
therList
?
other
List
.
indices
:
[],
this
.
indices
,
function
(
idx
)
{
return
idList
[
idx
]
||
(
idx
+
''
);
}
);
};
/**
* Get visual property.
* @param {string} key
...
...
src/model/Series.js
浏览文件 @
a6e52294
...
...
@@ -4,6 +4,7 @@ define(function(require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
formatUtil
=
require
(
'
../util/format
'
);
var
modelUtil
=
require
(
'
../util/model
'
);
var
ComponentModel
=
require
(
'
./Component
'
);
var
encodeHTML
=
formatUtil
.
encodeHTML
;
...
...
@@ -64,7 +65,7 @@ define(function(require) {
zrUtil
.
merge
(
option
,
this
.
getDefaultOption
());
// Default label emphasis `position` and `show`
this
.
defaultEmphasis
(
'
label
'
);
modelUtil
.
defaultEmphasis
(
option
.
label
);
},
mergeOption
:
function
(
newSeriesOption
,
ecModel
)
{
...
...
@@ -76,25 +77,11 @@ define(function(require) {
this
.
_data
=
data
;
this
.
_dataBeforeProcessed
=
data
.
cloneShallow
();
}
this
.
defaultEmphasis
(
'
label
'
);
},
/**
* Util for default emphasis option from normal option like `position` and `show`
* @param {string} optName
* @param {Array.<string>} [subOpts=['position', 'show']]
*/
defaultEmphasis
:
function
(
optName
,
subOpts
)
{
var
opt
=
this
.
get
(
optName
);
if
(
opt
&&
opt
.
normal
)
{
var
emphasisOpt
=
opt
.
emphasis
=
opt
.
emphasis
||
{};
subOpts
=
subOpts
||
[
'
position
'
,
'
show
'
];
zrUtil
.
each
(
subOpts
,
function
(
subOptName
)
{
emphasisOpt
[
subOptName
]
=
zrUtil
.
retrieve
(
emphasisOpt
[
subOptName
],
opt
.
normal
[
subOptName
]);
});
}
// FIXME
// Default label emphasis `position` and `show`
// Do it after option is merged. In case newSeriesOption only
// set the value in emphasis
// modelUtil.defaultNormalEmphasis(this.option.label);
},
/**
...
...
src/model/globalDefault.js
浏览文件 @
a6e52294
...
...
@@ -18,7 +18,7 @@ define(function () {
// 浅色
// color: ['#bcd3bb', '#e88f70', '#edc1a5', '#9dc5c8', '#e1e8c8', '#7b7c68', '#e5b5b5', '#f0b489', '#928ea8', '#bda29a'],
// 深色
color
:
[
'
#
314656
'
,
'
#61a0a8
'
,
'
#c23531
'
,
'
#dd8668
'
,
'
#91c7ae
'
,
'
#6e7074
'
,
'
#61a0a8
'
,
'
#bda29a
'
,
'
#44525d
'
,
'
#c4ccd3
'
],
color
:
[
'
#
c23531
'
,
'
#314656
'
,
'
#61a0a8
'
,
'
#dd8668
'
,
'
#91c7ae
'
,
'
#6e7074
'
,
'
#61a0a8
'
,
'
#bda29a
'
,
'
#44525d
'
,
'
#c4ccd3
'
],
// color: ['#0088bb', '#a4d2aa', '#ea9695', '#eddf93', '#9bd6ec', '#f7c753', '#c78682', '#6bc3bc', '#e5362d', '#fbeabf'],
// 默认需要 Grid 配置项
...
...
src/util/graphic.js
浏览文件 @
a6e52294
...
...
@@ -302,15 +302,15 @@ define(function(require) {
/**
* Set text option in the style
* @param {Object}
s
tyle
* @param {Object}
textS
tyle
* @param {module:echarts/model/Model} labelModel
* @param {string} color
*/
graphic
.
setText
=
function
(
s
tyle
,
labelModel
,
color
)
{
graphic
.
setText
=
function
(
textS
tyle
,
labelModel
,
color
)
{
var
labelPosition
=
labelModel
.
get
(
'
position
'
)
||
'
inside
'
;
var
labelColor
=
labelPosition
.
indexOf
(
'
inside
'
)
>=
0
?
'
white
'
:
color
;
var
textStyleModel
=
labelModel
.
getModel
(
'
textStyle
'
);
zrUtil
.
extend
(
s
tyle
,
{
zrUtil
.
extend
(
textS
tyle
,
{
textFont
:
textStyleModel
.
getFont
(),
textPosition
:
labelPosition
,
textFill
:
textStyleModel
.
get
(
'
color
'
)
||
labelColor
...
...
src/util/model.js
浏览文件 @
a6e52294
...
...
@@ -4,7 +4,7 @@ define(function(require) {
var
AXIS_DIMS
=
[
'
x
'
,
'
y
'
,
'
z
'
,
'
radius
'
,
'
angle
'
];
var
u
til
=
{};
var
modelU
til
=
{};
/**
* Create "each" method to iterate names.
...
...
@@ -14,11 +14,11 @@ define(function(require) {
* @param {Array.<string>=} attrs
* @return {Function}
*/
u
til
.
createNameEach
=
function
(
names
,
attrs
)
{
modelU
til
.
createNameEach
=
function
(
names
,
attrs
)
{
names
=
names
.
slice
();
var
capitalNames
=
zrUtil
.
map
(
names
,
u
til
.
capitalFirst
);
var
capitalNames
=
zrUtil
.
map
(
names
,
modelU
til
.
capitalFirst
);
attrs
=
(
attrs
||
[]).
slice
();
var
capitalAttrs
=
zrUtil
.
map
(
attrs
,
u
til
.
capitalFirst
);
var
capitalAttrs
=
zrUtil
.
map
(
attrs
,
modelU
til
.
capitalFirst
);
return
function
(
callback
,
context
)
{
zrUtil
.
each
(
names
,
function
(
name
,
index
)
{
...
...
@@ -36,7 +36,7 @@ define(function(require) {
/**
* @public
*/
u
til
.
capitalFirst
=
function
(
str
)
{
modelU
til
.
capitalFirst
=
function
(
str
)
{
return
str
?
str
.
charAt
(
0
).
toUpperCase
()
+
str
.
substr
(
1
)
:
str
;
};
...
...
@@ -54,14 +54,14 @@ define(function(require) {
* }
* @param {Object} context
*/
util
.
eachAxisDim
=
u
til
.
createNameEach
(
AXIS_DIMS
,
[
'
axisIndex
'
,
'
axis
'
,
'
index
'
]);
modelUtil
.
eachAxisDim
=
modelU
til
.
createNameEach
(
AXIS_DIMS
,
[
'
axisIndex
'
,
'
axis
'
,
'
index
'
]);
/**
* If value is not array, then translate it to array.
* @param {*} value
* @return {Array} [value] or value
*/
u
til
.
normalizeToArray
=
function
(
value
)
{
modelU
til
.
normalizeToArray
=
function
(
value
)
{
return
zrUtil
.
isArray
(
value
)
?
value
:
value
==
null
...
...
@@ -80,7 +80,7 @@ define(function(require) {
* @param {Function} edgeIdGetter Giving node and edgeType, return an array of edge id.
* @return {Function} Input: sourceNode, Output: Like {nodes: [], dims: {}}
*/
u
til
.
createLinkedNodesFinder
=
function
(
forEachNode
,
forEachEdgeType
,
edgeIdGetter
)
{
modelU
til
.
createLinkedNodesFinder
=
function
(
forEachNode
,
forEachEdgeType
,
edgeIdGetter
)
{
return
function
(
sourceNode
)
{
var
result
=
{
...
...
@@ -139,5 +139,36 @@ define(function(require) {
}
};
return
util
;
/**
* Sync default option between normal and emphasis like `position` and `show`
* In case some one will write code like
* label: {
* normal: {
* show: false
* },
* emphasis: {
* show: true,
* position: 'outside',
* textStyle: {
* fontSize: 18
* }
* }
* }
* @param {Object} opt
* @param {Array.<string>} [subOpts=['position', 'show']]
*/
modelUtil
.
defaultEmphasis
=
function
(
opt
,
subOpts
)
{
if
(
opt
)
{
var
emphasisOpt
=
opt
.
emphasis
=
opt
.
emphasis
||
{};
var
normalOpt
=
opt
.
normal
=
opt
.
normal
||
{};
subOpts
=
subOpts
||
[
'
position
'
,
'
show
'
,
'
textStyle
'
];
// Default emphasis option from normal
zrUtil
.
each
(
subOpts
,
function
(
subOptName
)
{
emphasisOpt
[
subOptName
]
=
zrUtil
.
retrieve
(
emphasisOpt
[
subOptName
],
normalOpt
[
subOptName
]);
});
}
};
return
modelUtil
;
});
\ No newline at end of file
src/util/number.js
浏览文件 @
a6e52294
...
...
@@ -85,7 +85,7 @@ define(function (require) {
number
.
round
=
function
(
x
)
{
// PENDING
return
+
(
+
x
).
toFixed
(
12
);
}
}
;
number
.
asc
=
function
(
arr
)
{
arr
.
sort
(
function
(
a
,
b
)
{
...
...
src/view/Chart.js
浏览文件 @
a6e52294
...
...
@@ -97,14 +97,12 @@ define(function (require) {
*/
function
elSetState
(
el
,
state
)
{
if
(
el
)
{
el
.
trigger
(
state
);
if
(
el
.
type
===
'
group
'
)
{
for
(
var
i
=
0
;
i
<
el
.
childCount
();
i
++
)
{
elSetState
(
el
.
childAt
(
i
),
state
);
}
}
else
{
el
.
trigger
(
state
);
}
}
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录