Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
41d9690a
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,发现更多精彩内容 >>
提交
41d9690a
编写于
5月 04, 2016
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Line connectNulls, Fix #3009, #2579
上级
87fc7a39
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
97 addition
and
55 deletion
+97
-55
src/chart/bar/BarSeries.js
src/chart/bar/BarSeries.js
+0
-8
src/chart/line/LineSeries.js
src/chart/line/LineSeries.js
+14
-28
src/chart/line/LineView.js
src/chart/line/LineView.js
+4
-2
src/chart/line/poly.js
src/chart/line/poly.js
+65
-16
src/model/Series.js
src/model/Series.js
+1
-0
test/area.html
test/area.html
+13
-1
未找到文件。
src/chart/bar/BarSeries.js
浏览文件 @
41d9690a
...
@@ -53,14 +53,6 @@ define(function(require) {
...
@@ -53,14 +53,6 @@ define(function(require) {
// label: {
// label: {
// normal: {
// normal: {
// show: false
// show: false
// formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
// // 默认自适应,水平布局为'top',垂直布局为'right',可选为
// // 'inside' | 'insideleft' | 'insideTop' | 'insideRight' | 'insideBottom' |
// // 'outside' |'left' | 'right'|'top'|'bottom'
// position:
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
// }
// }
// },
// },
itemStyle
:
{
itemStyle
:
{
...
...
src/chart/line/LineSeries.js
浏览文件 @
41d9690a
...
@@ -33,29 +33,12 @@ define(function(require) {
...
@@ -33,29 +33,12 @@ define(function(require) {
label
:
{
label
:
{
normal
:
{
normal
:
{
// show: false,
position
:
'
top
'
position
:
'
top
'
// formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
// position: 默认自适应,水平布局为'top',垂直布局为'right',可选为
// 'inside'|'left'|'right'|'top'|'bottom'
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
}
}
// emphasis: {
// show: false,
// position: 'top'
// formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
// position: 默认自适应,水平布局为'top',垂直布局为'right',可选为
// 'inside'|'left'|'right'|'top'|'bottom'
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
// }
},
},
// itemStyle: {
// itemStyle: {
// normal: {
// normal: {},
// // color: 各异
// emphasis: {}
// },
// emphasis: {
// // color: 各异,
// }
// },
// },
lineStyle
:
{
lineStyle
:
{
normal
:
{
normal
:
{
...
@@ -63,24 +46,27 @@ define(function(require) {
...
@@ -63,24 +46,27 @@ define(function(require) {
type
:
'
solid
'
type
:
'
solid
'
}
}
},
},
// areaStyle: {
// areaStyle: {
},
// },
//
smooth: false,
smooth
:
false
,
//
smoothMonotone: null,
smoothMonotone
:
null
,
// 拐点图形类型
// 拐点图形类型
symbol
:
'
emptyCircle
'
,
symbol
:
'
emptyCircle
'
,
// 拐点图形大小
// 拐点图形大小
symbolSize
:
4
,
symbolSize
:
4
,
// 拐点图形旋转控制
// 拐点图形旋转控制
//
symbolRotate: null,
symbolRotate
:
null
,
// 是否显示 symbol, 只有在 tooltip hover 的时候显示
// 是否显示 symbol, 只有在 tooltip hover 的时候显示
showSymbol
:
true
,
showSymbol
:
true
,
// 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略)
// 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略)
// showAllSymbol: false
showAllSymbol
:
false
,
//
// 大数据过滤,'average', 'max', 'min', 'sum'
// 是否连接断点
// sampling: 'none'
connectNulls
:
false
,
// 数据过滤,'average', 'max', 'min', 'sum'
sampling
:
'
none
'
,
animationEasing
:
'
linear
'
animationEasing
:
'
linear
'
}
}
...
...
src/chart/line/LineView.js
浏览文件 @
41d9690a
...
@@ -306,7 +306,8 @@ define(function(require) {
...
@@ -306,7 +306,8 @@ define(function(require) {
smooth
=
getSmooth
(
seriesModel
.
get
(
'
smooth
'
));
smooth
=
getSmooth
(
seriesModel
.
get
(
'
smooth
'
));
polyline
.
setShape
({
polyline
.
setShape
({
smooth
:
smooth
,
smooth
:
smooth
,
smoothMonotone
:
seriesModel
.
get
(
'
smoothMonotone
'
)
smoothMonotone
:
seriesModel
.
get
(
'
smoothMonotone
'
),
connectNulls
:
seriesModel
.
get
(
'
connectNulls
'
)
});
});
if
(
polygon
)
{
if
(
polygon
)
{
...
@@ -330,7 +331,8 @@ define(function(require) {
...
@@ -330,7 +331,8 @@ define(function(require) {
polygon
.
setShape
({
polygon
.
setShape
({
smooth
:
smooth
,
smooth
:
smooth
,
stackedOnSmooth
:
stackedOnSmooth
,
stackedOnSmooth
:
stackedOnSmooth
,
smoothMonotone
:
seriesModel
.
get
(
'
smoothMonotone
'
)
smoothMonotone
:
seriesModel
.
get
(
'
smoothMonotone
'
),
connectNulls
:
seriesModel
.
get
(
'
connectNulls
'
)
});
});
}
}
...
...
src/chart/line/poly.js
浏览文件 @
41d9690a
...
@@ -15,14 +15,26 @@ define(function (require) {
...
@@ -15,14 +15,26 @@ define(function (require) {
var
cp0
=
[];
var
cp0
=
[];
var
cp1
=
[];
var
cp1
=
[];
function
isPointNull
(
p
)
{
return
isNaN
(
p
[
0
])
||
isNaN
(
p
[
1
]);
}
function
drawSegment
(
function
drawSegment
(
ctx
,
points
,
start
,
s
top
,
l
en
,
ctx
,
points
,
start
,
s
egLen
,
allL
en
,
dir
,
smoothMin
,
smoothMax
,
smooth
,
smoothMonotone
dir
,
smoothMin
,
smoothMax
,
smooth
,
smoothMonotone
,
connectNulls
)
{
)
{
var
prevIdx
=
0
;
var
idx
=
start
;
var
idx
=
start
;
for
(
var
k
=
0
;
k
<
l
en
;
k
++
)
{
for
(
var
k
=
0
;
k
<
segL
en
;
k
++
)
{
var
p
=
points
[
idx
];
var
p
=
points
[
idx
];
if
(
idx
>=
stop
||
idx
<
0
||
isNaN
(
p
[
0
])
||
isNaN
(
p
[
1
]))
{
if
(
idx
>=
allLen
||
idx
<
0
)
{
break
;
}
if
(
isPointNull
(
p
))
{
if
(
connectNulls
)
{
idx
+=
dir
;
continue
;
}
break
;
break
;
}
}
...
@@ -32,21 +44,26 @@ define(function (require) {
...
@@ -32,21 +44,26 @@ define(function (require) {
}
}
else
{
else
{
if
(
smooth
>
0
)
{
if
(
smooth
>
0
)
{
var
prevIdx
=
idx
-
dir
;
var
nextIdx
=
idx
+
dir
;
var
nextIdx
=
idx
+
dir
;
var
nextP
=
points
[
nextIdx
];
if
(
connectNulls
)
{
// Find next point not null
while
(
nextP
&&
isPointNull
(
points
[
nextIdx
]))
{
nextIdx
+=
dir
;
nextP
=
points
[
nextIdx
];
}
}
var
ratioNextSeg
=
0.5
;
var
ratioNextSeg
=
0.5
;
var
prevP
=
points
[
prevIdx
];
var
prevP
=
points
[
prevIdx
];
var
nextP
=
points
[
nextIdx
];
var
nextP
=
points
[
nextIdx
];
// Last point
// Last point
if
((
dir
>
0
&&
(
idx
===
len
-
1
||
isNaN
(
nextP
[
0
])
||
isNaN
(
nextP
[
1
])))
if
(
!
nextP
||
isPointNull
(
nextP
))
{
||
(
dir
<=
0
&&
(
idx
===
0
||
isNaN
(
nextP
[
0
])
||
isNaN
(
nextP
[
1
])))
)
{
v2Copy
(
cp1
,
p
);
v2Copy
(
cp1
,
p
);
}
}
else
{
else
{
// If next data is null
// If next data is null
in not connect case
if
(
is
NaN
(
nextP
[
0
])
||
isNaN
(
nextP
[
1
])
)
{
if
(
is
PointNull
(
nextP
)
&&
!
connectNulls
)
{
nextP
=
p
;
nextP
=
p
;
}
}
...
@@ -88,6 +105,7 @@ define(function (require) {
...
@@ -88,6 +105,7 @@ define(function (require) {
}
}
}
}
prevIdx
=
idx
;
idx
+=
dir
;
idx
+=
dir
;
}
}
...
@@ -125,7 +143,9 @@ define(function (require) {
...
@@ -125,7 +143,9 @@ define(function (require) {
smoothConstraint
:
true
,
smoothConstraint
:
true
,
smoothMonotone
:
null
smoothMonotone
:
null
,
connectNulls
:
false
},
},
style
:
{
style
:
{
...
@@ -142,11 +162,24 @@ define(function (require) {
...
@@ -142,11 +162,24 @@ define(function (require) {
var
result
=
getBoundingBox
(
points
,
shape
.
smoothConstraint
);
var
result
=
getBoundingBox
(
points
,
shape
.
smoothConstraint
);
if
(
shape
.
connectNulls
)
{
// Must remove first and last null values avoid draw error in polygon
for
(;
len
>
0
;
len
--
)
{
if
(
!
isPointNull
(
points
[
len
-
1
]))
{
break
;
}
}
for
(;
i
<
len
;
i
++
)
{
if
(
!
isPointNull
(
points
[
i
]))
{
break
;
}
}
}
while
(
i
<
len
)
{
while
(
i
<
len
)
{
i
+=
drawSegment
(
i
+=
drawSegment
(
ctx
,
points
,
i
,
len
,
len
,
ctx
,
points
,
i
,
len
,
len
,
1
,
result
.
min
,
result
.
max
,
shape
.
smooth
,
1
,
result
.
min
,
result
.
max
,
shape
.
smooth
,
shape
.
smoothMonotone
shape
.
smoothMonotone
,
shape
.
connectNulls
)
+
1
;
)
+
1
;
}
}
}
}
...
@@ -168,7 +201,9 @@ define(function (require) {
...
@@ -168,7 +201,9 @@ define(function (require) {
smoothConstraint
:
true
,
smoothConstraint
:
true
,
smoothMonotone
:
null
smoothMonotone
:
null
,
connectNulls
:
false
},
},
buildPath
:
function
(
ctx
,
shape
)
{
buildPath
:
function
(
ctx
,
shape
)
{
...
@@ -180,16 +215,30 @@ define(function (require) {
...
@@ -180,16 +215,30 @@ define(function (require) {
var
smoothMonotone
=
shape
.
smoothMonotone
;
var
smoothMonotone
=
shape
.
smoothMonotone
;
var
bbox
=
getBoundingBox
(
points
,
shape
.
smoothConstraint
);
var
bbox
=
getBoundingBox
(
points
,
shape
.
smoothConstraint
);
var
stackedOnBBox
=
getBoundingBox
(
stackedOnPoints
,
shape
.
smoothConstraint
);
var
stackedOnBBox
=
getBoundingBox
(
stackedOnPoints
,
shape
.
smoothConstraint
);
if
(
shape
.
connectNulls
)
{
// Must remove first and last null values avoid draw error in polygon
for
(;
len
>
0
;
len
--
)
{
if
(
!
isPointNull
(
points
[
len
-
1
]))
{
break
;
}
}
for
(;
i
<
len
;
i
++
)
{
if
(
!
isPointNull
(
points
[
i
]))
{
break
;
}
}
}
while
(
i
<
len
)
{
while
(
i
<
len
)
{
var
k
=
drawSegment
(
var
k
=
drawSegment
(
ctx
,
points
,
i
,
len
,
len
,
ctx
,
points
,
i
,
len
,
len
,
1
,
bbox
.
min
,
bbox
.
max
,
shape
.
smooth
,
1
,
bbox
.
min
,
bbox
.
max
,
shape
.
smooth
,
smoothMonotone
smoothMonotone
,
shape
.
connectNulls
);
);
drawSegment
(
drawSegment
(
ctx
,
stackedOnPoints
,
i
+
k
-
1
,
len
,
k
,
ctx
,
stackedOnPoints
,
i
+
k
-
1
,
k
,
len
,
-
1
,
stackedOnBBox
.
min
,
stackedOnBBox
.
max
,
shape
.
stackedOnSmooth
,
-
1
,
stackedOnBBox
.
min
,
stackedOnBBox
.
max
,
shape
.
stackedOnSmooth
,
smoothMonotone
smoothMonotone
,
shape
.
connectNulls
);
);
i
+=
k
+
1
;
i
+=
k
+
1
;
...
...
src/model/Series.js
浏览文件 @
41d9690a
...
@@ -70,6 +70,7 @@ define(function(require) {
...
@@ -70,6 +70,7 @@ define(function(require) {
zrUtil
.
merge
(
option
,
this
.
getDefaultOption
());
zrUtil
.
merge
(
option
,
this
.
getDefaultOption
());
// Default label emphasis `position` and `show`
// Default label emphasis `position` and `show`
// FIXME Set label in merge
modelUtil
.
defaultEmphasis
(
modelUtil
.
defaultEmphasis
(
option
.
label
,
[
'
position
'
,
'
show
'
,
'
textStyle
'
,
'
distance
'
,
'
formatter
'
]
option
.
label
,
[
'
position
'
,
'
show
'
,
'
textStyle
'
,
'
distance
'
,
'
formatter
'
]
);
);
...
...
test/area.html
浏览文件 @
41d9690a
...
@@ -33,6 +33,11 @@
...
@@ -33,6 +33,11 @@
var
data2
=
[];
var
data2
=
[];
var
data3
=
[];
var
data3
=
[];
xAxisData
.
push
(
'
类目
'
+
-
1
);
data1
.
push
(
'
-
'
);
data2
.
push
(
'
-
'
);
data3
.
push
(
'
-
'
);
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
xAxisData
.
push
(
'
类目
'
+
i
);
xAxisData
.
push
(
'
类目
'
+
i
);
data1
.
push
((
-
Math
.
random
()
-
0.2
).
toFixed
(
3
));
data1
.
push
((
-
Math
.
random
()
-
0.2
).
toFixed
(
3
));
...
@@ -51,6 +56,10 @@
...
@@ -51,6 +56,10 @@
data2
.
push
((
Math
.
random
()
+
0.3
).
toFixed
(
3
));
data2
.
push
((
Math
.
random
()
+
0.3
).
toFixed
(
3
));
data3
.
push
((
Math
.
random
()
+
0.2
).
toFixed
(
3
));
data3
.
push
((
Math
.
random
()
+
0.2
).
toFixed
(
3
));
}
}
xAxisData
.
push
(
'
类目
'
+
i
);
data1
.
push
(
'
-
'
);
data2
.
push
(
'
-
'
);
data3
.
push
(
'
-
'
);
var
itemStyle
=
{
var
itemStyle
=
{
normal
:
{
normal
:
{
...
@@ -103,7 +112,8 @@
...
@@ -103,7 +112,8 @@
symbolSize
:
10
,
symbolSize
:
10
,
data
:
data1
,
data
:
data1
,
itemStyle
:
itemStyle
,
itemStyle
:
itemStyle
,
smooth
:
true
smooth
:
true
,
connectNulls
:
true
},
{
},
{
name
:
'
line2
'
,
name
:
'
line2
'
,
type
:
'
line
'
,
type
:
'
line
'
,
...
@@ -111,6 +121,7 @@
...
@@ -111,6 +121,7 @@
symbolSize
:
10
,
symbolSize
:
10
,
data
:
data2
,
data
:
data2
,
itemStyle
:
itemStyle
,
itemStyle
:
itemStyle
,
connectNulls
:
true
,
smooth
:
true
smooth
:
true
},
{
},
{
name
:
'
line3
'
,
name
:
'
line3
'
,
...
@@ -124,6 +135,7 @@
...
@@ -124,6 +135,7 @@
show
:
true
show
:
true
}
}
},
},
connectNulls
:
true
,
smooth
:
true
smooth
:
true
}]
}]
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录