Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
b849c5e5
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,发现更多精彩内容 >>
提交
b849c5e5
编写于
2月 03, 2016
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize extended coordinate system for BMap extension
上级
cf1b877c
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
111 addition
and
74 deletion
+111
-74
build/config/bmap.js
build/config/bmap.js
+1
-3
build/wrap/endExtension.js
build/wrap/endExtension.js
+0
-1
extension/bmap/BMapCoordSys.js
extension/bmap/BMapCoordSys.js
+45
-27
src/ExtensionAPI.js
src/ExtensionAPI.js
+1
-1
src/chart/heatmap/HeatmapLayer.js
src/chart/heatmap/HeatmapLayer.js
+4
-4
src/chart/heatmap/HeatmapSeries.js
src/chart/heatmap/HeatmapSeries.js
+3
-3
src/chart/heatmap/HeatmapView.js
src/chart/heatmap/HeatmapView.js
+8
-1
src/chart/helper/createListFromArray.js
src/chart/helper/createListFromArray.js
+8
-5
src/chart/lines/LinesSeries.js
src/chart/lines/LinesSeries.js
+7
-3
src/coord/View.js
src/coord/View.js
+6
-6
src/coord/cartesian/Cartesian2D.js
src/coord/cartesian/Cartesian2D.js
+6
-6
src/coord/cartesian/Grid.js
src/coord/cartesian/Grid.js
+3
-0
src/coord/geo/Geo.js
src/coord/geo/Geo.js
+6
-5
src/coord/geo/geoCreator.js
src/coord/geo/geoCreator.js
+3
-0
src/coord/polar/Polar.js
src/coord/polar/Polar.js
+6
-6
src/coord/polar/polarCreator.js
src/coord/polar/polarCreator.js
+2
-0
src/layout/barGrid.js
src/layout/barGrid.js
+0
-1
test/geoLine.html
test/geoLine.html
+2
-2
未找到文件。
build/config/bmap.js
浏览文件 @
b849c5e5
...
...
@@ -10,9 +10,7 @@
'
../wrap/startExtension.js
'
,
'
../wrap/nut.js
'
],
endFile
:
[
'
../wrap/endExtension.js
'
]
end
:
'
require("extension/bmap/bmap") }));
'
},
include
:[
'
extension/bmap/bmap
'
...
...
build/wrap/endExtension.js
已删除
100644 → 0
浏览文件 @
cf1b877c
}));
extension/bmap/BMapCoordSys.js
浏览文件 @
b849c5e5
define
(
function
require
()
{
function
Overlay
(
root
)
{
this
.
_root
=
root
;
}
Overlay
.
prototype
=
new
BMap
.
Overlay
();
/**
* 初始化
*
* @param {BMap.Map} map
* @override
*/
Overlay
.
prototype
.
initialize
=
function
(
map
)
{
map
.
getPanes
().
labelPane
.
appendChild
(
this
.
_root
);
return
this
.
_root
;
};
/**
* @override
*/
Overlay
.
prototype
.
draw
=
function
()
{};
define
(
function
(
require
)
{
var
echarts
=
require
(
'
echarts
'
);
function
BMapCoordSys
(
bmap
)
{
function
BMapCoordSys
(
bmap
,
api
)
{
this
.
_bmap
=
bmap
;
this
.
dimensions
=
[
'
lng
'
,
'
lat
'
];
this
.
_mapOffset
=
[
0
,
0
];
this
.
_api
=
api
;
}
BMapCoordSys
.
prototype
.
dimensions
=
[
'
lng
'
,
'
lat
'
];
BMapCoordSys
.
prototype
.
setMapOffset
=
function
(
mapOffset
)
{
this
.
_mapOffset
=
mapOffset
;
};
...
...
@@ -53,11 +35,47 @@ define(function require() {
return
[
pt
.
lng
,
pt
.
lat
];
};
BMapCoordSys
.
prototype
.
getViewRect
=
function
()
{
var
api
=
this
.
_api
;
return
new
echarts
.
graphic
.
BoundingRect
(
0
,
0
,
api
.
getWidth
(),
api
.
getHeight
());
};
BMapCoordSys
.
prototype
.
getRoamTransform
=
function
()
{
return
echarts
.
matrix
.
create
();
};
var
Overlay
;
BMapCoordSys
.
create
=
function
(
ecModel
,
api
)
{
var
bmapCoordSys
;
var
root
=
api
.
getDom
();
// TODO Dispose
ecModel
.
eachComponent
(
'
bmap
'
,
function
(
bmapModel
)
{
if
(
typeof
BMap
===
'
undefined
'
)
{
throw
new
Error
(
'
BMap api is not loaded
'
);
}
if
(
!
Overlay
)
{
Overlay
=
function
(
root
)
{
this
.
_root
=
root
;
}
Overlay
.
prototype
=
new
BMap
.
Overlay
();
/**
* 初始化
*
* @param {BMap.Map} map
* @override
*/
Overlay
.
prototype
.
initialize
=
function
(
map
)
{
map
.
getPanes
().
labelPane
.
appendChild
(
this
.
_root
);
return
this
.
_root
;
};
/**
* @override
*/
Overlay
.
prototype
.
draw
=
function
()
{};
}
if
(
bmapCoordSys
)
{
throw
new
Error
(
'
Only one bmap component can exist
'
);
}
...
...
@@ -127,14 +145,14 @@ define(function require() {
});
});
}
bmapCoordSys
=
new
BMapCoordSys
(
bmapModel
.
__bmap
);
bmapCoordSys
=
new
BMapCoordSys
(
bmapModel
.
__bmap
,
api
);
bmapCoordSys
.
setMapOffset
(
bmapModel
.
__mapOffset
||
[
0
,
0
]);
bmapModel
.
coordinateSystem
=
bmapCoordSys
;
});
ecModel
.
eachSeries
(
function
(
seriesModel
)
{
var
coordSys
=
seriesModel
.
get
(
'
coordinateSystem
'
);
if
(
coordSys
===
'
geo
'
)
{
if
(
coordSys
===
'
bmap
'
)
{
seriesModel
.
coordinateSystem
=
bmapCoordSys
;
}
});
...
...
src/ExtensionAPI.js
浏览文件 @
b849c5e5
...
...
@@ -6,7 +6,7 @@ define(function(require) {
var
echartsAPIList
=
[
'
getDom
'
,
'
getZr
'
,
'
getWidth
'
,
'
getHeight
'
,
'
dispatchAction
'
,
'
on
'
,
'
off
'
,
'
getDataURL
'
,
'
getConnectedDataURL
'
'
on
'
,
'
off
'
,
'
getDataURL
'
,
'
getConnectedDataURL
'
,
'
getModel
'
,
'
getOption
'
];
function
ExtensionAPI
(
chartInstance
)
{
...
...
src/chart/heatmap/HeatmapLayer.js
浏览文件 @
b849c5e5
...
...
@@ -7,7 +7,6 @@
*/
define
(
function
(
require
)
{
var
BRUSH_SIZE
=
20
;
var
GRADIENT_LEVELS
=
256
;
var
zrUtil
=
require
(
'
zrender/core/util
'
);
...
...
@@ -21,6 +20,7 @@ define(function (require) {
this
.
canvas
=
canvas
;
this
.
blurSize
=
30
;
this
.
pointSize
=
20
;
this
.
opacity
=
1
;
this
.
_gradientPixels
=
{};
...
...
@@ -37,7 +37,7 @@ define(function (require) {
var
brush
=
this
.
_getBrush
();
var
gradientInRange
=
this
.
_getGradient
(
data
,
colorFunc
,
'
inRange
'
);
var
gradientOutOfRange
=
this
.
_getGradient
(
data
,
colorFunc
,
'
outOfRange
'
);
var
r
=
BRUSH_SIZE
+
this
.
blurSize
;
var
r
=
this
.
pointSize
+
this
.
blurSize
;
var
canvas
=
this
.
canvas
;
var
ctx
=
canvas
.
getContext
(
'
2d
'
);
...
...
@@ -91,7 +91,7 @@ define(function (require) {
_getBrush
:
function
()
{
var
brushCanvas
=
this
.
_brushCanvas
||
(
this
.
_brushCanvas
=
zrUtil
.
createCanvas
());
// set brush size
var
r
=
BRUSH_SIZE
+
this
.
blurSize
;
var
r
=
this
.
pointSize
+
this
.
blurSize
;
var
d
=
r
*
2
;
brushCanvas
.
width
=
d
;
brushCanvas
.
height
=
d
;
...
...
@@ -110,7 +110,7 @@ define(function (require) {
// draw circle in the left to the canvas
ctx
.
beginPath
();
ctx
.
arc
(
-
r
,
r
,
BRUSH_SIZE
,
0
,
Math
.
PI
*
2
,
true
);
ctx
.
arc
(
-
r
,
r
,
this
.
pointSize
,
0
,
Math
.
PI
*
2
,
true
);
ctx
.
closePath
();
ctx
.
fill
();
return
brushCanvas
;
...
...
src/chart/heatmap/HeatmapSeries.js
浏览文件 @
b849c5e5
...
...
@@ -26,9 +26,9 @@ define(function (require) {
// Geo coordinate system
geoIndex
:
0
,
// No blur
// Available when heatmap is on geo
blur
Size
:
20
blurSize
:
30
,
point
Size
:
20
}
});
});
\ No newline at end of file
src/chart/heatmap/HeatmapView.js
浏览文件 @
b849c5e5
...
...
@@ -49,6 +49,12 @@ define(function (require) {
};
}
function
isGeoCoordSys
(
coordSys
)
{
var
dimensions
=
coordSys
.
dimensions
;
// Not use coorSys.type === 'geo' because coordSys maybe extended
return
dimensions
[
0
]
===
'
lng
'
&&
dimensions
[
1
]
===
'
lat
'
;
}
return
require
(
'
../../echarts
'
).
extendChartView
({
type
:
'
heatmap
'
,
...
...
@@ -72,7 +78,7 @@ define(function (require) {
if
(
coordSys
.
type
===
'
cartesian2d
'
)
{
this
.
_renderOnCartesian
(
coordSys
,
seriesModel
,
api
);
}
else
if
(
coordSys
.
type
===
'
geo
'
)
{
else
if
(
isGeoCoordSys
(
coordSys
)
)
{
this
.
_renderOnGeo
(
coordSys
,
seriesModel
,
visualMapOfThisSeries
,
api
);
...
...
@@ -150,6 +156,7 @@ define(function (require) {
var
data
=
seriesModel
.
getData
();
var
hmLayer
=
this
.
_hmLayer
||
(
this
.
_hmLayer
||
new
HeatmapLayer
());
hmLayer
.
blurSize
=
seriesModel
.
get
(
'
blurSize
'
);
hmLayer
.
pointSize
=
seriesModel
.
get
(
'
pointSize
'
);
var
rect
=
geo
.
getViewRect
().
clone
();
var
roamTransform
=
geo
.
getRoamTransform
();
...
...
src/chart/helper/createListFromArray.js
浏览文件 @
b849c5e5
...
...
@@ -33,11 +33,14 @@ define(function(require) {
var
creator
=
creators
[
coordSysName
];
var
registeredCoordSys
=
CoordinateSystem
.
get
(
coordSysName
);
// FIXME
var
result
=
creator
?
creator
(
data
,
seriesModel
,
ecModel
)
var
result
=
creator
&&
creator
(
data
,
seriesModel
,
ecModel
);
var
dimensions
=
result
&&
result
.
dimensions
;
if
(
!
dimensions
)
{
// Get dimensions from registered coordinate system
:
((
registeredCoordSys
&&
registeredCoordSys
.
dimensions
)
||
[
'
x
'
,
'
y
'
]);
var
dimensions
=
result
.
dimensions
;
var
categoryAxisModel
=
result
.
categoryAxisModel
;
dimensions
=
(
registeredCoordSys
&&
registeredCoordSys
.
dimensions
)
||
[
'
x
'
,
'
y
'
];
dimensions
=
completeDimensions
(
dimensions
,
data
,
dimensions
.
concat
([
'
value
'
]));
}
var
categoryAxisModel
=
result
&&
result
.
categoryAxisModel
;
var
categoryDimIndex
=
dimensions
[
0
].
type
===
'
ordinal
'
?
0
:
(
dimensions
[
1
].
type
===
'
ordinal
'
?
1
:
-
1
);
...
...
@@ -150,7 +153,7 @@ define(function(require) {
function
createNameList
(
result
,
data
)
{
var
nameList
=
[];
if
(
result
.
categoryAxisModel
)
{
if
(
result
&&
result
.
categoryAxisModel
)
{
// FIXME Two category axis
var
categories
=
result
.
categoryAxisModel
.
getCategories
();
if
(
categories
)
{
...
...
src/chart/lines/LinesSeries.js
浏览文件 @
b849c5e5
...
...
@@ -5,7 +5,7 @@ define(function (require) {
var
SeriesModel
=
require
(
'
../../model/Series
'
);
var
List
=
require
(
'
../../data/List
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
//
var CoordinateSystem = require('../../CoordinateSystem');
var
CoordinateSystem
=
require
(
'
../../CoordinateSystem
'
);
return
SeriesModel
.
extend
({
...
...
@@ -26,13 +26,17 @@ define(function (require) {
));
});
var
coordSys
=
option
.
coordinateSystem
;
//
var coordSys = option.coordinateSystem;
// if (coordSys !== 'cartesian2d' && coordSys !== 'geo') {
// throw new Error('Coordinate system can only be cartesian2d or geo in lines');
// }
// var dimensions = coordSys === 'geo' ? ['lng', 'lat'] : ['x', 'y'];
var
dimensions
=
(
coordSys
&&
coordSys
.
dimensions
)
||
[
'
x
'
,
'
y
'
];
var
coordSys
=
CoordinateSystem
.
get
(
option
.
coordinateSystem
);
if
(
!
coordSys
)
{
throw
new
Error
(
'
Invalid coordinate system
'
);
}
var
dimensions
=
coordSys
.
dimensions
;
var
fromData
=
new
List
(
dimensions
,
this
);
var
toData
=
new
List
(
dimensions
,
this
);
...
...
src/coord/View.js
浏览文件 @
b849c5e5
...
...
@@ -26,12 +26,6 @@ define(function (require) {
*/
this
.
name
=
name
;
/**
* @param {Array.<string>}
* @readOnly
*/
this
.
dimensions
=
[
'
x
'
,
'
y
'
];
Transformable
.
call
(
this
);
this
.
_roamTransform
=
new
TransformDummy
();
...
...
@@ -45,6 +39,12 @@ define(function (require) {
type
:
'
view
'
,
/**
* @param {Array.<string>}
* @readOnly
*/
dimensions
:
[
'
x
'
,
'
y
'
],
/**
* Set bounding rect
* @param {number} x
...
...
src/coord/cartesian/Cartesian2D.js
浏览文件 @
b849c5e5
...
...
@@ -8,12 +8,6 @@ define(function(require) {
function
Cartesian2D
(
name
)
{
Cartesian
.
call
(
this
,
name
);
/**
* @type {Array.<string>}
* @readOnly
*/
this
.
dimensions
=
[
'
x
'
,
'
y
'
];
}
Cartesian2D
.
prototype
=
{
...
...
@@ -22,6 +16,12 @@ define(function(require) {
type
:
'
cartesian2d
'
,
/**
* @type {Array.<string>}
* @readOnly
*/
dimensions
:
[
'
x
'
,
'
y
'
],
/**
* Base axis will be used on stacking.
*
...
...
src/coord/cartesian/Grid.js
浏览文件 @
b849c5e5
...
...
@@ -388,6 +388,9 @@ define(function(require, factory) {
return
grids
;
};
// For deciding which dimensions to use when creating list data
Grid
.
dimensions
=
Cartesian2D
.
prototype
.
dimensions
;
require
(
'
../../CoordinateSystem
'
).
register
(
'
grid
'
,
Grid
);
return
Grid
;
...
...
src/coord/geo/Geo.js
浏览文件 @
b849c5e5
...
...
@@ -35,11 +35,6 @@ define(function (require) {
* @type {string}
*/
this
.
map
=
map
;
/**
* @param {Array.<string>}
* @readOnly
*/
this
.
dimensions
=
[
'
lng
'
,
'
lat
'
];
this
.
_nameCoordMap
=
{};
...
...
@@ -52,6 +47,12 @@ define(function (require) {
type
:
'
geo
'
,
/**
* @param {Array.<string>}
* @readOnly
*/
dimensions
:
[
'
lng
'
,
'
lat
'
],
/**
* @param {Object} geoJson
* @param {Object} [specialAreas]
...
...
src/coord/geo/geoCreator.js
浏览文件 @
b849c5e5
...
...
@@ -55,6 +55,9 @@ define(function (require) {
var
geoCreator
=
{
// For deciding which dimensions to use when creating list data
dimensions
:
Geo
.
prototype
.
dimensions
,
create
:
function
(
ecModel
,
api
)
{
var
geoList
=
[];
...
...
src/coord/polar/Polar.js
浏览文件 @
b849c5e5
...
...
@@ -32,12 +32,6 @@ define(function(require) {
*/
this
.
cy
=
0
;
/**
* @param {Array.<string>}
* @readOnly
*/
this
.
dimensions
=
[
'
radius
'
,
'
angle
'
];
/**
* @type {module:echarts/coord/polar/RadiusAxis}
* @private
...
...
@@ -57,6 +51,12 @@ define(function(require) {
type
:
'
polar
'
,
/**
* @param {Array.<string>}
* @readOnly
*/
dimensions
:
[
'
radius
'
,
'
angle
'
],
/**
* If contain coord
* @param {Array.<number>} point
...
...
src/coord/polar/polarCreator.js
浏览文件 @
b849c5e5
...
...
@@ -94,6 +94,8 @@ define(function (require) {
var
polarCreator
=
{
dimensions
:
Polar
.
prototype
.
dimensions
,
create
:
function
(
ecModel
,
api
)
{
var
polarList
=
[];
ecModel
.
eachComponent
(
'
polar
'
,
function
(
polarModel
,
idx
)
{
...
...
src/layout/barGrid.js
浏览文件 @
b849c5e5
...
...
@@ -191,7 +191,6 @@ define(function(require) {
y
=
lastCoord
;
width
=
columnWidth
;
height
=
coord
[
1
]
-
lastCoord
;
if
(
Math
.
abs
(
height
)
<
barMinHeight
)
{
// Include zero to has a positive bar
height
=
(
height
<=
0
?
-
1
:
1
)
*
barMinHeight
;
...
...
test/geoLine.html
浏览文件 @
b849c5e5
...
...
@@ -191,9 +191,9 @@
var
toCoord
=
geoCoordMap
[
dataItem
[
1
].
name
];
if
(
fromCoord
&&
toCoord
)
{
res
.
push
([{
geoC
oord
:
fromCoord
c
oord
:
fromCoord
},
{
geoC
oord
:
toCoord
c
oord
:
toCoord
}]);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录