Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
302e2d93
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,体验更适合开发者的 AI 搜索 >>
提交
302e2d93
编写于
12月 03, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Geo name map, Grid layout enhancement, other tweaks
上级
6b52f7e0
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
65 addition
and
24 deletion
+65
-24
map/js/china.js
map/js/china.js
+1
-1
map/json/china.json
map/json/china.json
+1
-1
src/chart/map/mapSymbolLayout.js
src/chart/map/mapSymbolLayout.js
+1
-1
src/coord/cartesian/Grid.js
src/coord/cartesian/Grid.js
+0
-1
src/coord/cartesian/GridModel.js
src/coord/cartesian/GridModel.js
+22
-5
src/coord/cartesian/axisLabelInterval.js
src/coord/cartesian/axisLabelInterval.js
+3
-4
src/coord/geo/Geo.js
src/coord/geo/Geo.js
+27
-8
src/coord/geo/geoCreator.js
src/coord/geo/geoCreator.js
+9
-2
src/data/List.js
src/data/List.js
+1
-1
未找到文件。
map/js/china.js
浏览文件 @
302e2d93
此差异已折叠。
点击以展开。
map/json/china.json
浏览文件 @
302e2d93
此差异已折叠。
点击以展开。
src/chart/map/mapSymbolLayout.js
浏览文件 @
302e2d93
...
...
@@ -17,7 +17,7 @@ define(function (require) {
zrUtil
.
each
(
mapSeries
.
seriesGroup
,
function
(
subMapSeries
)
{
var
geo
=
subMapSeries
.
coordinateSystem
;
var
data
=
subMapSeries
.
getData
();
if
(
subMapSeries
.
get
(
'
showLegendSymbol
'
))
{
if
(
subMapSeries
.
get
(
'
showLegendSymbol
'
)
&&
ecModel
.
getComponent
(
'
legend
'
)
)
{
data
.
each
(
'
value
'
,
function
(
value
,
idx
)
{
var
name
=
data
.
getName
(
idx
);
var
region
=
geo
.
getRegion
(
name
);
...
...
src/coord/cartesian/Grid.js
浏览文件 @
302e2d93
...
...
@@ -85,7 +85,6 @@ define(function(require, factory) {
* @param {module:echarts/ExtensionAPI} api
*/
gridProto
.
resize
=
function
(
gridModel
,
api
)
{
var
gridRect
=
layout
.
parsePositionInfo
({
x
:
gridModel
.
get
(
'
x
'
),
y
:
gridModel
.
get
(
'
y
'
),
...
...
src/coord/cartesian/GridModel.js
浏览文件 @
302e2d93
...
...
@@ -5,13 +5,30 @@ define(function(require) {
'
use strict
'
;
require
(
'
./AxisModel
'
);
var
ComponentModel
=
require
(
'
../../model/Component
'
);
return
require
(
'
../../echarts
'
).
extendComponentModel
({
return
ComponentModel
.
extend
({
type
:
'
grid
'
,
dependencies
:
[
'
xAxis
'
,
'
yAxis
'
],
mergeDefaultAndTheme
:
function
(
option
,
ecModel
)
{
// Not specify layout with x2, width, y2, height
// FIXME 通用?
if
(
option
.
x2
==
null
||
option
.
width
==
null
||
option
.
x
!=
null
)
{
option
.
x
=
option
.
x
||
'
10%
'
;
option
.
x2
=
option
.
x2
||
'
10%
'
;
}
if
(
option
.
y2
==
null
||
option
.
height
==
null
||
option
.
y
!=
null
)
{
option
.
y
=
option
.
y
||
60
;
option
.
y2
=
option
.
y2
||
60
;
}
ComponentModel
.
prototype
.
mergeDefaultAndTheme
.
call
(
this
,
option
,
ecModel
);
},
/**
* @type {module:echarts/coord/cartesian/Grid}
*/
...
...
@@ -21,10 +38,10 @@ define(function(require) {
show
:
false
,
zlevel
:
0
,
// 一级层叠
z
:
0
,
// 二级层叠
x
:
'
10%
'
,
y
:
60
,
x2
:
'
10%
'
,
y2
:
60
,
//
x: '10%',
//
y: 60,
//
x2: '10%',
//
y2: 60,
// If grid size contain label
containLabel
:
false
,
// width: {totalWidth} - x - x2,
...
...
src/coord/cartesian/axisLabelInterval.js
浏览文件 @
302e2d93
...
...
@@ -44,14 +44,13 @@ define(function(require) {
// There is no space for current label;
else
if
(
textSpaceTakenRect
.
intersect
(
rect
))
{
accumulatedLabelInterval
++
;
continue
;
autoLabelInterval
=
Math
.
max
(
autoLabelInterval
,
accumulatedLabelInterval
)
;
}
else
{
textSpaceTakenRect
.
union
(
rect
);
// Reset
accumulatedLabelInterval
=
0
;
}
autoLabelInterval
=
Math
.
max
(
autoLabelInterval
,
accumulatedLabelInterval
);
// Reset
accumulatedLabelInterval
=
0
;
}
return
autoLabelInterval
;
...
...
src/coord/geo/Geo.js
浏览文件 @
302e2d93
...
...
@@ -16,7 +16,17 @@ define(function (require) {
require
(
'
./fix/geoCoord
'
)
];
function
Geo
(
name
,
map
,
geoJson
,
specialAreas
)
{
/**
* [Geo description]
* @param {string} name Geo name
* @param {string} map Map type
* @param {Object} geoJson
* @param {Object} [specialAreas]
* Specify the positioned areas by left, top, width, height
* @param {Object.<string, string>} [nameMap]
* Specify name alias
*/
function
Geo
(
name
,
map
,
geoJson
,
specialAreas
,
nameMap
)
{
View
.
call
(
this
,
name
);
...
...
@@ -33,7 +43,7 @@ define(function (require) {
this
.
_nameCoordMap
=
{};
this
.
loadGeoJson
(
geoJson
,
specialAreas
);
this
.
loadGeoJson
(
geoJson
,
specialAreas
,
nameMap
);
}
Geo
.
prototype
=
{
...
...
@@ -44,27 +54,36 @@ define(function (require) {
/**
* @param {Object} geoJson
* @param {Object} [specialAreas]
* Specify the positioned areas by left, top, width, height
* @param {Object.<string, string>} [nameMap]
* Specify name alias
*/
loadGeoJson
:
function
(
geoJson
,
specialAreas
)
{
loadGeoJson
:
function
(
geoJson
,
specialAreas
,
nameMap
)
{
// https://jsperf.com/try-catch-performance-overhead
try
{
this
.
regions
=
geoJson
?
parseGeoJson
(
geoJson
)
:
[];
specialAreas
=
specialAreas
||
{};
this
.
_specialAreas
=
specialAreas
;
}
catch
(
e
)
{
throw
'
Invalid geoJson format
\n
'
+
e
;
}
specialAreas
=
specialAreas
||
{};
nameMap
=
nameMap
||
{};
var
regions
=
this
.
regions
;
var
regionsMap
=
{};
for
(
var
i
=
0
;
i
<
regions
.
length
;
i
++
)
{
regionsMap
[
regions
[
i
].
name
]
=
regions
[
i
];
var
regionName
=
regions
[
i
].
name
;
// Try use the alias in nameMap
regionName
=
nameMap
[
regionName
]
||
regionName
;
regions
[
i
].
name
=
regionName
;
regionsMap
[
regionName
]
=
regions
[
i
];
// Add geoJson
this
.
addGeoCoord
(
region
s
[
i
].
n
ame
,
regions
[
i
].
center
);
this
.
addGeoCoord
(
region
N
ame
,
regions
[
i
].
center
);
// Some area like Alaska in USA map needs to be tansformed
// to look better
var
specialArea
=
specialAreas
[
region
s
[
i
].
n
ame
];
var
specialArea
=
specialAreas
[
region
N
ame
];
if
(
specialArea
)
{
regions
[
i
].
transformTo
(
specialArea
.
left
,
specialArea
.
top
,
specialArea
.
width
,
specialArea
.
height
...
...
src/coord/geo/geoCreator.js
浏览文件 @
302e2d93
...
...
@@ -75,7 +75,9 @@ define(function (require) {
// Warning
// }
var
geo
=
new
Geo
(
name
+
idx
,
name
,
mapData
.
geoJson
,
mapData
.
specialAreas
name
+
idx
,
name
,
mapData
.
geoJson
,
mapData
.
specialAreas
,
geoModel
.
get
(
'
nameMap
'
)
);
geoList
.
push
(
geo
);
...
...
@@ -115,8 +117,13 @@ define(function (require) {
// Warning
// }
var
nameMapList
=
zrUtil
.
map
(
mapSeries
,
function
(
singleMapSeries
)
{
return
singleMapSeries
.
get
(
'
nameMap
'
);
});
var
geo
=
new
Geo
(
mapType
,
mapType
,
mapData
.
geoJson
,
mapData
.
specialAreas
mapType
,
mapType
,
mapData
.
geoJson
,
mapData
.
specialAreas
,
zrUtil
.
mergeAll
(
nameMapList
)
);
geoList
.
push
(
geo
);
...
...
src/data/List.js
浏览文件 @
302e2d93
...
...
@@ -585,7 +585,7 @@ define(function (require) {
function
normalizeDimensions
(
dimensions
)
{
if
(
typeof
(
dimensions
)
===
'
string
'
)
{
if
(
!
zrUtil
.
isArray
(
dimensions
)
)
{
dimensions
=
[
dimensions
];
}
return
dimensions
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录