提交 0afdb7bb 编写于 作者: L lang

Map location competitable with 2.0

上级 146ab530
......@@ -77,7 +77,7 @@ define(function (require) {
// mapValueCalculation: 'sum',
// 地图数值计算结果小数精度
// mapValuePrecision: 0,
// 显示图例颜色标识(系列标识的小圆点)
// 显示图例颜色标识(系列标识的小圆点),图例开启时有效
showLegendSymbol: true,
// 选择模式,默认关闭,可选single,multiple
// selectedMode: false,
......
......@@ -13,7 +13,7 @@ define(function (require) {
mapModel.needsDrawMap &&
this._renderArea(mapModel, ecModel, api);
mapModel.get('showLegendSymbol')
mapModel.get('showLegendSymbol') && ecModel.getComponent('legend')
&& this._renderSymbols(mapModel, ecModel, api);
},
......
......@@ -17,7 +17,9 @@ define(function (require) {
z: 0,
center: ['50%', '50%'],
x: 'center',
y: 'center',
width: '70%',
......
......@@ -14,14 +14,12 @@ define(function (require) {
* @param {module:echarts/ExtensionAPI} api
*/
var resizeGeo = function (locModel, api) {
var center;
if (locModel.type === 'series.map') {
locModel = locModel.getModel('mapLocation');
center = [locModel.get('x'), locModel.get('y')];
}
else {
center = locModel.get('center');
}
var x = locModel.get('x');
var y = locModel.get('y');
var width = locModel.get('width');
var height = locModel.get('height');
......@@ -29,8 +27,9 @@ define(function (require) {
var viewHeight = api.getHeight();
var parsePercent = numberUtil.parsePercent;
var cx = parsePercent(center[0], viewWidth);
var cy = parsePercent(center[1], viewHeight);
var cx = parsePercent(x, viewWidth);
var cy = parsePercent(y, viewHeight);
width = parsePercent(width, viewWidth);
height = parsePercent(height, viewHeight);
......@@ -44,6 +43,29 @@ define(function (require) {
width = rect.width / rect.height * height;
}
// Special position
// FIXME
switch (x) {
case 'center':
break;
case 'right':
cx -= width;
break;
default:
cx += width / 2;
break;
}
switch (y) {
case 'center':
break;
case 'bottom':
cy -= height;
break;
default:
cy += height / 2;
break;
}
this.transformTo(cx, cy, width, height);
}
......
......@@ -16,14 +16,14 @@
require([
'echarts',
'geoJson/world_geo',
'geoJson/china_geo',
'echarts/chart/scatter',
'echarts/component/legend',
'echarts/component/geo'
], function (echarts, worldJson) {
], function (echarts, chinaJson) {
echarts.registerMap('world', worldJson);
echarts.registerMap('china', chinaJson);
var placeList = [
{name:'海门', geoCoord:[121.15, 31.89]},
......@@ -252,7 +252,7 @@
data: ['scatter', 'scatter2']
},
geo: {
map: 'world'
map: 'china'
},
tooltip: {
trigger: 'axis',
......
......@@ -75,7 +75,8 @@
type: 'map',
mapType: 'world',
mapLocation: {
// y : 60
y : 60,
width: '80%'
},
itemStyle: itemStyle,
data:[
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册