Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
600d74cc
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,发现更多精彩内容 >>
提交
600d74cc
编写于
1月 12, 2018
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix map and data zoom in empty mode.
上级
7b8d9695
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
217 addition
and
30 deletion
+217
-30
src/component/dataZoom/AxisProxy.js
src/component/dataZoom/AxisProxy.js
+21
-4
src/data/List.js
src/data/List.js
+25
-14
test/dataset-charts.html
test/dataset-charts.html
+20
-12
test/dataset-pivot.html
test/dataset-pivot.html
+151
-0
未找到文件。
src/component/dataZoom/AxisProxy.js
浏览文件 @
600d74cc
...
...
@@ -63,6 +63,12 @@ var AxisProxy = function (dimName, axisIndex, dataZoomModel, ecModel) {
* @type {module: echarts/component/dataZoom/DataZoomModel}
*/
this
.
_dataZoomModel
=
dataZoomModel
;
/**
* @readOnly
* @private
*/
this
.
hasSeriesStacked
;
};
AxisProxy
.
prototype
=
{
...
...
@@ -238,10 +244,18 @@ AxisProxy.prototype = {
return
;
}
var
targetSeries
=
this
.
getTargetSeriesModels
();
// Culculate data window and data extent, and record them.
this
.
_dataExtent
=
calculateDataExtent
(
this
,
this
.
_dimName
,
this
.
getTargetSeriesModels
()
);
this
.
_dataExtent
=
calculateDataExtent
(
this
,
this
.
_dimName
,
targetSeries
);
this
.
hasSeriesStacked
=
false
;
each
(
targetSeries
,
function
(
series
)
{
var
data
=
series
.
getData
();
var
dataDim
=
data
.
mapDimension
(
this
.
_dimName
);
if
(
data
.
isStacked
(
dataDim
))
{
this
.
hasSeriesStacked
=
true
;
}
},
this
);
var
dataWindow
=
this
.
calculateDataWindow
(
dataZoomModel
.
option
);
...
...
@@ -294,11 +308,14 @@ AxisProxy.prototype = {
var
otherAxisModel
=
this
.
getOtherAxisModel
();
if
(
dataZoomModel
.
get
(
'
$fromToolbox
'
)
&&
otherAxisModel
&&
otherAxisModel
.
get
(
'
type
'
)
===
'
category
'
&&
otherAxisModel
.
hasSeriesStacked
)
{
filterMode
=
'
empty
'
;
}
// TODO
// filterMode 'weakFilter' and 'empty' is not optimized for huge data yet.
// Process series data
each
(
seriesModels
,
function
(
seriesModel
)
{
var
seriesData
=
seriesModel
.
getData
();
...
...
src/data/List.js
浏览文件 @
600d74cc
...
...
@@ -664,7 +664,7 @@ listProto.getDataExtent = function (dim, stack) {
var
dimData
=
this
.
_storage
[
dim
];
var
initialExtent
=
[
Infinity
,
-
Infinity
];
stack
=
(
stack
||
false
)
&&
isStacked
(
this
,
dim
);
stack
=
(
stack
||
false
)
&&
this
.
isStacked
(
dim
);
if
(
!
dimData
)
{
return
initialExtent
;
...
...
@@ -721,10 +721,10 @@ listProto.setApproximateExtent = function (extent, dim, stack) {
this
.
_approximateExtent
[
dim
]
=
extent
.
slice
();
};
function
isStacked
(
list
,
concreteDim
)
{
var
dimensionInfo
=
list
.
_dimensionInfos
[
concreteDim
];
return
dimensionInfo
&&
dimensionInfo
.
stackable
&&
list
.
stackedOn
;
}
listProto
.
isStacked
=
function
(
concreteDim
)
{
var
dimensionInfo
=
this
.
_dimensionInfos
[
concreteDim
];
return
dimensionInfo
&&
dimensionInfo
.
stackable
&&
this
.
stackedOn
;
}
;
/**
* Get sum of data in one dimension
...
...
@@ -1157,7 +1157,7 @@ listProto.selectRange = function (range, stack) {
}
if
(
!
quickFinished
)
{
if
(
dimSize
===
1
)
{
stack
=
stack
||
isStacked
(
this
,
dim0
);
stack
=
stack
||
this
.
isStacked
(
dim0
);
for
(
var
i
=
0
;
i
<
originalCount
;
i
++
)
{
var
rawIndex
=
this
.
getRawIndex
(
i
);
var
val
=
stack
?
this
.
get
(
dim0
,
i
,
true
)
:
this
.
_getFast
(
dim0
,
rawIndex
);
...
...
@@ -1283,17 +1283,28 @@ listProto.map = function (dimensions, cb, stack, context) {
var
tmpRetValue
=
[];
var
chunkSize
=
this
.
_chunkSize
;
this
.
each
(
dimensions
,
function
()
{
var
idx
=
arguments
[
arguments
.
length
-
1
];
var
retValue
=
cb
&&
cb
.
apply
(
this
,
arguments
);
var
dimSize
=
dimensions
.
length
;
var
dataCount
=
this
.
count
();
var
values
=
[];
for
(
var
dataIndex
=
0
;
dataIndex
<
dataCount
;
dataIndex
++
)
{
for
(
var
dimIndex
=
0
;
dimIndex
<
dimSize
;
dimIndex
++
)
{
values
[
dimIndex
]
=
this
.
get
(
dimensions
[
dimIndex
],
dataIndex
,
stack
);
}
values
[
dimSize
]
=
dataIndex
;
var
retValue
=
cb
&&
cb
.
apply
(
context
,
values
);
if
(
retValue
!=
null
)
{
// a number
if
(
typeof
retValue
===
'
number
'
)
{
// a number
or string (in oridinal dimension)?
if
(
typeof
retValue
!==
'
object
'
)
{
tmpRetValue
[
0
]
=
retValue
;
retValue
=
tmpRetValue
;
}
var
chunkIndex
=
Math
.
floor
(
idx
/
chunkSize
);
var
chunkOffset
=
idx
%
chunkSize
;
var
rawIndex
=
this
.
getRawIndex
(
dataIndex
);
var
chunkIndex
=
Math
.
floor
(
rawIndex
/
chunkSize
);
var
chunkOffset
=
rawIndex
%
chunkSize
;
for
(
var
i
=
0
;
i
<
retValue
.
length
;
i
++
)
{
var
dim
=
dimensions
[
i
];
var
dimStore
=
storage
[
dim
];
...
...
@@ -1302,7 +1313,7 @@ listProto.map = function (dimensions, cb, stack, context) {
}
}
}
}
,
stack
,
context
);
}
return
list
;
};
...
...
test/dataset-charts.html
浏览文件 @
600d74cc
...
...
@@ -22,11 +22,11 @@
<
!-- <
div id="layout0"></div>
<div
id=
"layout0"
></div>
<div
id=
"layout1"
></div>
<div
id=
"layout2"
></div>
<div
id=
"layout3"
></div>
<div id="layout4"></div>
-->
<div
id=
"layout4"
></div>
<div
id=
"layout5"
></div>
...
...
@@ -67,6 +67,14 @@
[
55.2
,
67.1
,
69.2
,
72.4
,
53.9
,
39.1
]
];
var
arrayRowsPairValueColumns
=
[
[
'
2012
'
,
null
,
'
2013
'
,
null
,
'
2014
'
,
'
amount
'
],
[
41.1
,
2585
,
30.4
,
2473
,
65.1
,
3418
],
[
86.5
,
2316
,
92.1
,
3255
,
85.7
,
2485
],
[
24.1
,
1532
,
67.2
,
1452
,
79.5
,
4689
],
[
55.2
,
5312
,
67.1
,
3266
,
69.2
,
1354
]
];
// No 北京 上海 江苏
var
nameValueGeo0
=
[
{
name
:
'
天津
'
,
value
:
514
},
...
...
@@ -354,26 +362,26 @@
var
option
=
{
legend
:
{},
tooltip
:
{},
xAxis
:
{},
yAxis
:
{},
dataset
:
[{
source
:
arrayRowsNoColumnHeader
},
{
source
:
arrayRowsNoRowHeader
source
:
arrayRowsPairValueColumns
}],
series
:
[{
type
:
'
scatter
'
,
radius
:
50
,
center
:
[
'
25%
'
,
'
25%
'
],
sourceHeader
:
false
type
:
'
scatter
'
},
{
type
:
'
scatter
'
},
{
type
:
'
scatter
'
}]
};
testHelper
.
create
(
echarts
,
'
layout5
'
,
{
title
:
'
no sourceHeader
'
,
title
:
'
column (dimension name duplicated)
'
,
height
:
400
,
option
:
option
,
dataTables
:
[
arrayRowsNoColumnHeader
,
arrayRowsNoRowHeader
arrayRowsPairValueColumns
],
info
:
{
legend
:
'
<default>
'
,
...
...
test/dataset-pivot.html
0 → 100644
浏览文件 @
600d74cc
<html>
<head>
<meta
charset=
"utf-8"
>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<script
src=
"lib/testHelper.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<link
rel=
"stylesheet"
href=
"lib/reset.css"
/>
</head>
<body>
<style>
.test-title
{
background
:
rgb
(
0
,
112
,
6
);
color
:
#fff
;
}
</style>
<div
id=
"layout0"
></div>
<script>
var
arrayRows0
=
[
[
'
product
'
,
'
2015
'
,
'
2016
'
,
'
2017
'
],
[
'
Matcha Latte
'
,
43.3
,
85.8
,
93.7
],
[
'
Milk Tea
'
,
83.1
,
73.4
,
55.1
],
[
'
Cheese Cocoa
'
,
86.4
,
65.2
,
82.5
],
[
'
Walnut Brownie
'
,
72.4
,
53.9
,
39.1
]
];
var
arrayRows1
=
[
[
'
product
'
,
'
2012
'
,
'
2013
'
,
'
2014
'
,
'
2015
'
,
'
2016
'
,
'
2017
'
],
[
'
Matcha Latte
'
,
41.1
,
30.4
,
65.1
,
53.3
,
83.8
,
98.7
],
[
'
Milk Tea
'
,
86.5
,
92.1
,
85.7
,
83.1
,
73.4
,
55.1
],
[
'
Cheese Cocoa
'
,
24.1
,
67.2
,
79.5
,
86.4
,
65.2
,
82.5
],
[
'
Walnut Brownie
'
,
55.2
,
67.1
,
69.2
,
72.4
,
53.9
,
39.1
]
];
function
loadLifeData
(
cb
)
{
$
.
getJSON
(
'
data/life-expectancy-table.json
'
,
function
(
data
)
{
cb
(
data
);
})
}
</script>
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
loadLifeData
(
function
(
data
)
{
var
sizeValue
=
'
57%
'
;
var
option
=
{
legend
:
{},
tooltip
:
{},
toolbox
:
{
feature
:
{
dataZoom
:
{}
}
},
grid
:
[
{
right
:
sizeValue
,
bottom
:
sizeValue
},
{
left
:
sizeValue
,
bottom
:
sizeValue
},
{
right
:
sizeValue
,
top
:
sizeValue
},
{
left
:
sizeValue
,
top
:
sizeValue
}
],
xAxis
:
[
{
type
:
'
value
'
,
gridIndex
:
0
,
name
:
'
Income
'
},
{
type
:
'
category
'
,
gridIndex
:
1
,
name
:
'
Country
'
,
boundaryGap
:
false
,
axisLabel
:
{
rotate
:
50
,
interval
:
0
}},
{
type
:
'
category
'
,
gridIndex
:
2
,
name
:
'
Year
'
,
boundaryGap
:
false
},
{
type
:
'
category
'
,
gridIndex
:
3
,
name
:
'
Country
'
,
boundaryGap
:
false
,
axisLabel
:
{
rotate
:
50
,
interval
:
0
}}
],
yAxis
:
[
{
type
:
'
value
'
,
gridIndex
:
0
,
name
:
'
Life Expectency
'
},
{
type
:
'
value
'
,
gridIndex
:
1
,
name
:
'
Income
'
},
{
type
:
'
value
'
,
gridIndex
:
2
,
name
:
'
Population
'
},
{
type
:
'
category
'
,
gridIndex
:
3
,
name
:
'
Year
'
,
boundaryGap
:
false
}
],
dataset
:
{
source
:
data
},
series
:
[
{
type
:
'
scatter
'
,
symbolSize
:
3
,
xAxisIndex
:
0
,
yAxisIndex
:
0
,
encode
:
{
x
:
'
Income
'
,
y
:
'
Life Expectency
'
}
},
{
type
:
'
scatter
'
,
symbolSize
:
3
,
xAxisIndex
:
1
,
yAxisIndex
:
1
,
encode
:
{
x
:
'
Country
'
,
y
:
'
Income
'
}
},
{
type
:
'
scatter
'
,
symbolSize
:
3
,
xAxisIndex
:
2
,
yAxisIndex
:
2
,
encode
:
{
x
:
'
Year
'
,
y
:
'
Population
'
}
},
{
type
:
'
scatter
'
,
symbolSize
:
3
,
xAxisIndex
:
3
,
yAxisIndex
:
3
,
encode
:
{
x
:
'
Country
'
,
y
:
'
Year
'
}
}
]
};
testHelper
.
create
(
echarts
,
'
layout0
'
,
{
option
:
option
,
height
:
700
,
dataTable
:
data
});
});
});
</script>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录