Skip to content

Commit

Permalink
dataRange!!!map升级
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Jun 9, 2013
1 parent 46969de commit 91b938d
Show file tree
Hide file tree
Showing 7 changed files with 806 additions and 63 deletions.
17 changes: 13 additions & 4 deletions doc/example/map1.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -77,11 +77,20 @@
},
dataRange: {
min: 0,
max: 2000
//orient: 'horizontal', // 'vertical'
// backgroundColor: '#eee',
//x: 'right', // 'center' | 'left' | {number},
//y: 'top', // 'center' | 'top' | {number}
//backgroundColor: '#eee',
//borderColor: 'rgba(178,34,34,0.8)',
// borderWidth: 4,
//borderWidth: 4,
//padding: 10, // [5, 10, 15, 20]
//itemGap: 5,
//textStyle: {color: 'red'},
splitNumber: 0, // 分割段数,默认为5
color:['red','yellow'],//颜色
//text:['高','低'], // 文本,默认为数值文本
calculable : true,
max: 2000
},
toolbox: {
show : true,
Expand Down
28 changes: 27 additions & 1 deletion src/chart/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ define(function(require) {
}
}

// console.log(valueData)
switch (mapType) {
case 'china':
_buildMap(_getMapDataOfChina(), valueData);
Expand All @@ -98,6 +97,7 @@ define(function(require) {
}

function _buildMap(mapData, valueData) {
var legend = component.legend;
var dataRange = component.dataRange;
var seriesName;
var name;
Expand All @@ -121,6 +121,23 @@ define(function(require) {
for (var j = 0, k = data.seriesIndex.length; j < k; j++) {
queryTarget.push(series[data.seriesIndex[j]]);
seriesName += series[data.seriesIndex[j]].name + ' ';
if (legend
&& legend.hasColor(series[data.seriesIndex[j]].name)
) {
self.shapeList.push({
shape : 'circle',
zlevel : _zlevelBase + 1,
style : {
x : style.textX + 3 + j * 7,
y : style.textY - 10,
r : 3,
color : legend.getColor(
series[data.seriesIndex[j]].name
)
},
hoverable : false
});
}
}
queryTarget.push(defaultOption);
value = data.value;
Expand Down Expand Up @@ -229,9 +246,18 @@ define(function(require) {
self.clear();
_buildShape();
}

function ondataRange(param, status) {
if (component.dataRange) {
refresh();
status.needRefresh = true;
}
return;
}

self.init = init;
self.refresh = refresh;
self.ondataRange = ondataRange;

init(option, component);
}
Expand Down
Loading

0 comments on commit 91b938d

Please sign in to comment.