Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
56c289b7
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,发现更多精彩内容 >>
提交
56c289b7
编写于
10月 14, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
continuous data range, calculable fix
上级
f6cc0131
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
59 addition
and
39 deletion
+59
-39
src/component/dataRange/ContinuousView.js
src/component/dataRange/ContinuousView.js
+44
-31
src/component/dataRange/DataRangeModel.js
src/component/dataRange/DataRangeModel.js
+9
-4
src/component/dataRange/PiecewiseModel.js
src/component/dataRange/PiecewiseModel.js
+1
-1
src/component/dataRange/typeDefaulter.js
src/component/dataRange/typeDefaulter.js
+1
-0
test/dataRange-scatter-continuous.html
test/dataRange-scatter-continuous.html
+3
-2
test/dataRange-scatter-layout2.html
test/dataRange-scatter-layout2.html
+1
-1
未找到文件。
src/component/dataRange/ContinuousView.js
浏览文件 @
56c289b7
...
...
@@ -47,6 +47,11 @@ define(function(require) {
* @private
*/
this
.
_orient
;
/**
* @private
*/
this
.
_useHandle
;
},
/**
...
...
@@ -57,7 +62,9 @@ define(function(require) {
if
(
!
event
||
event
.
type
!==
'
dataRangeSelected
'
||
event
.
from
!==
this
.
uid
)
{
this
.
_buildView
();
}
this
.
_updateView
();
else
{
this
.
_updateView
();
}
},
/**
...
...
@@ -67,18 +74,23 @@ define(function(require) {
this
.
group
.
removeAll
();
var
dataRangeModel
=
this
.
dataRangeModel
;
var
dataRangeText
=
dataRangeModel
.
get
(
'
text
'
);
var
thisGroup
=
this
.
group
;
this
.
_orient
=
dataRangeModel
.
get
(
'
orient
'
);
this
.
_useHandle
=
dataRangeModel
.
get
(
'
calculable
'
);
this
.
_resetInterval
();
this
.
_renderBar
(
thisGroup
,
!
dataRangeText
);
this
.
_renderBar
(
thisGroup
);
var
dataRangeText
=
dataRangeModel
.
get
(
'
text
'
);
dataRangeText
&&
this
.
_renderEndsText
(
thisGroup
,
dataRangeText
,
0
);
dataRangeText
&&
this
.
_renderEndsText
(
thisGroup
,
dataRangeText
,
1
);
// After updating view, inner shapes is built completely,
// and then background can be rendered.
this
.
_updateView
();
this
.
renderBackground
(
thisGroup
);
this
.
positionGroup
(
thisGroup
);
...
...
@@ -124,13 +136,13 @@ define(function(require) {
/**
* @private
*/
_renderBar
:
function
(
targetGroup
,
renderHandle
)
{
_renderBar
:
function
(
targetGroup
)
{
var
dataRangeModel
=
this
.
dataRangeModel
;
var
shapes
=
this
.
_shapes
;
var
itemSize
=
dataRangeModel
.
itemSize
;
var
handleEndsMax
=
[
0
,
itemSize
[
1
]];
var
api
=
this
.
api
;
var
orient
=
this
.
_orient
;
var
useHandle
=
this
.
_useHandle
;
var
itemAlign
=
this
.
getItemAlignByOrient
(
orient
===
'
horizontal
'
?
'
vertical
'
:
'
horizontal
'
,
...
...
@@ -142,14 +154,18 @@ define(function(require) {
// Bar
barGroup
.
add
(
shapes
.
outOfRange
=
createPolygon
());
barGroup
.
add
(
shapes
.
inRange
=
createPolygon
(
null
,
zrUtil
.
bind
(
this
.
_modifyHandle
,
this
,
'
all
'
),
'
move
'
null
,
zrUtil
.
bind
(
this
.
_modifyHandle
,
this
,
'
all
'
),
useHandle
?
'
move
'
:
null
));
var
textRect
=
dataRangeModel
.
textStyleModel
.
getTextRect
(
'
国
'
);
var
textSize
=
Math
.
max
(
textRect
.
width
,
textRect
.
height
);
// Handle
if
(
renderHandle
)
{
if
(
useHandle
)
{
var
handleEndsMax
=
[
0
,
itemSize
[
1
]];
shapes
.
handleGroups
=
[];
shapes
.
handleThumbs
=
[];
shapes
.
handleLabels
=
[];
...
...
@@ -215,6 +231,10 @@ define(function(require) {
* @private
*/
_modifyHandle
:
function
(
handleIndex
,
dx
,
dy
)
{
if
(
!
this
.
_useHandle
)
{
return
;
}
// Transform dx, dy to bar coordination.
var
vertex
=
this
.
_applyTransform
([
dx
,
dy
],
this
.
_shapes
.
barGroup
,
true
);
this
.
_updateInterval
(
handleIndex
,
vertex
[
1
]);
...
...
@@ -309,27 +329,21 @@ define(function(require) {
.
setStyle
(
'
fill
'
,
visualOutOfRange
.
barColor
)
.
setShape
(
'
points
'
,
visualOutOfRange
.
barPoints
);
each
([
0
,
1
],
function
(
handleIndex
)
{
this
.
_useHandle
&&
each
([
0
,
1
],
function
(
handleIndex
)
{
var
handleThumbs
=
shapes
.
handleThumbs
;
if
(
handleThumbs
)
{
handleThumbs
[
handleIndex
].
setStyle
(
'
fill
'
,
visualInRange
.
handlesColor
[
handleIndex
]
);
}
shapes
.
handleThumbs
[
handleIndex
].
setStyle
(
'
fill
'
,
visualInRange
.
handlesColor
[
handleIndex
]
);
var
handleLabels
=
shapes
.
handleLabels
;
if
(
handleLabels
)
{
handleLabels
[
handleIndex
].
setStyle
({
text
:
dataRangeModel
.
formatValueText
(
dataInterval
[
handleIndex
]),
textAlign
:
this
.
_applyTransform
(
this
.
_orient
===
'
horizontal
'
?
(
handleIndex
===
0
?
'
bottom
'
:
'
top
'
)
:
'
left
'
,
shapes
.
barGroup
)
});
}
shapes
.
handleLabels
[
handleIndex
].
setStyle
({
text
:
dataRangeModel
.
formatValueText
(
dataInterval
[
handleIndex
]),
textAlign
:
this
.
_applyTransform
(
this
.
_orient
===
'
horizontal
'
?
(
handleIndex
===
0
?
'
bottom
'
:
'
top
'
)
:
'
left
'
,
shapes
.
barGroup
)
});
},
this
);
...
...
@@ -404,15 +418,14 @@ define(function(require) {
* @private
*/
_updateHandlePosition
:
function
(
handleEnds
)
{
var
shapes
=
this
.
_shapes
;
var
handleGroups
=
shapes
.
handleGroups
;
if
(
!
handleGroups
)
{
if
(
!
this
.
_useHandle
)
{
return
;
}
var
shapes
=
this
.
_shapes
;
each
([
0
,
1
],
function
(
handleIndex
)
{
var
handleGroup
=
handleGroups
[
handleIndex
];
var
handleGroup
=
shapes
.
handleGroups
[
handleIndex
];
handleGroup
.
position
[
1
]
=
handleEnds
[
handleIndex
];
// Update handle label location
...
...
src/component/dataRange/DataRangeModel.js
浏览文件 @
56c289b7
...
...
@@ -41,8 +41,8 @@ define(function(require) {
z
:
4
,
// 二级层叠
show
:
true
,
min
:
-
Infinity
,
// 最小值,如果不指定,则是所控制的series的最小值,兼容ec2而保留,不推荐指定
max
:
Infinity
,
// 最大值,如果不指定,则是所控制的series的最大值,兼容ec2而保留,不推荐指定
min
:
0
,
// 最小值,
max
:
200
,
// 最大值,
dimension
:
null
,
inRange
:
null
,
// 'color', 'colorH', 'colorS', 'colorL', 'colorA',
...
...
@@ -62,6 +62,7 @@ define(function(require) {
inverse
:
false
,
seriesIndex
:
null
,
// 所控制的series indices,默认所有有value的series.
splitNumber
:
5
,
// 分割段数,默认为5,为0时为线性渐变 (contimous)
backgroundColor
:
'
rgba(0,0,0,0)
'
,
borderColor
:
'
#ccc
'
,
// 值域边框颜色
contentColor
:
'
#5793f3
'
,
...
...
@@ -224,8 +225,12 @@ define(function(require) {
*/
resetExtent
:
function
()
{
var
thisOption
=
this
.
option
;
var
dataExtent
=
[
Infinity
,
-
Infinity
];
// Can not calculate data extent by data here.
// Because series and data may be modified in processing stage.
// So we do not support the feature "auto min/max".
// var dataExtent = [Infinity, -Infinity];
// zrUtil.each(thisOption.seriesIndex, function (seriesIndex) {
// var data = this.ecModel.getSeriesByIndex(seriesIndex).getData();
// // FIXME
...
...
@@ -254,7 +259,7 @@ define(function(require) {
var
optDim
=
this
.
option
.
dimension
;
return
optDim
!=
null
?
optDim
:
list
.
dimensions
[
list
.
dimensions
.
length
-
1
]
:
list
.
dimensions
[
list
.
dimensions
.
length
-
1
]
;
},
/**
...
...
src/component/dataRange/PiecewiseModel.js
浏览文件 @
56c289b7
...
...
@@ -16,10 +16,10 @@ define(function(require) {
defaultOption
:
{
selected
:
null
,
align
:
'
auto
'
,
// 'auto', 'left', 'right'
splitNumber
:
5
,
// 分割段数,默认为5,为0时为线性渐变
itemWidth
:
20
,
// 值域图形宽度,线性渐变水平布局宽度为该值 * 10
itemHeight
:
14
,
// 值域图形高度,线性渐变垂直布局高度为该值 * 10
itemSymbol
:
'
roundRect
'
,
splitList
:
null
,
selectedMode
:
'
multiple
'
,
itemGap
:
10
// 各个item之间的间隔,单位px,默认为10,
// 横向布局时为水平间隔,纵向布局时为纵向间隔
...
...
src/component/dataRange/typeDefaulter.js
浏览文件 @
56c289b7
define
(
function
(
require
)
{
require
(
'
../../model/Component
'
).
registerSubTypeDefaulter
(
'
dataRange
'
,
function
(
option
)
{
// Compatible with ec2, when splitNumber === 0, continuous dataRange will be used.
return
(
!
(
option
.
splitList
...
...
test/dataRange-scatter-continuous.html
浏览文件 @
56c289b7
...
...
@@ -75,8 +75,9 @@
y
:
100
,
// itemHeight: 100,
backgroundColor
:
'
#ddd
'
,
visualSelected
:
{
data
:
[
'
red
'
,
'
pink
'
,
'
black
'
]
// calculable: true,
inRange
:
{
color
:
[
'
red
'
,
'
pink
'
,
'
black
'
]
}
}
],
...
...
test/dataRange-scatter-layout2.html
浏览文件 @
56c289b7
...
...
@@ -86,7 +86,7 @@
dataRange
:
[
{
show
:
true
,
splitNumber
:
7
,
splitNumber
:
0
,
// selectedMode: 'single',
selectedMode
:
'
multiple
'
,
backgroundColor
:
'
#eee
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录