Skip to content

Commit 27c700e

Browse files
committed
update
1 parent 1aae39a commit 27c700e

7 files changed

Lines changed: 68 additions & 35 deletions

File tree

dist/Mapv.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ function drawHoneycomb(obj) {
27882788
draw(x, y, gridsW - 1, 'rgba(0,0,0,0.4)', ctx);
27892789
}
27902790

2791-
if (obj.sup.getDrawOptions().label && obj.sup.getDrawOptions().label && !isTooSmall && !isTooBig) {
2791+
if (obj.sup.getDrawOptions().label && obj.sup.getDrawOptions().label.show && !isTooSmall && !isTooBig) {
27922792
ctx.save();
27932793
ctx.textBaseline = 'middle';
27942794
ctx.textAlign = 'center';
@@ -3104,11 +3104,22 @@ IntensityDrawer.prototype.defaultGradient = {
31043104
};
31053105

31063106
IntensityDrawer.prototype.drawMap = function () {
3107+
this.Scale && this.Scale.set({
3108+
min: 0,
3109+
max: this.getMax(),
3110+
colors: this.getGradient()
3111+
});
3112+
3113+
this.dataRange.setMax(this.getMax());
3114+
31073115
this.beginDrawMap();
31083116

31093117
var self = this;
31103118
var ctx = this.getCtx();
31113119

3120+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
3121+
3122+
31123123
var data = this.getLayer().getData();
31133124
var drawOptions = this.getDrawOptions();
31143125
ctx.strokeStyle = drawOptions.strokeStyle;
@@ -3133,7 +3144,15 @@ IntensityDrawer.prototype.drawMap = function () {
31333144
if (dataType === 'polygon') {
31343145

31353146
for (var i = 0, len = data.length; i < len; i++) {
3136-
var geo = data[i].pgeo;
3147+
var item = data[i];
3148+
var geo = item.pgeo;
3149+
3150+
var isTooSmall = self.masker.min && (item.count < self.masker.min);
3151+
var isTooBig = self.masker.max && (item.count > self.masker.max);
3152+
if (isTooSmall || isTooBig) {
3153+
continue;
3154+
}
3155+
31373156
ctx.beginPath();
31383157
ctx.moveTo(geo[0][0], geo[0][1]);
31393158
ctx.fillStyle = this.dataRange.getColorByGradient(data[i].count);
@@ -3181,14 +3200,6 @@ IntensityDrawer.prototype.drawMap = function () {
31813200
ctx.stroke();
31823201
}
31833202

3184-
this.Scale && this.Scale.set({
3185-
min: 0,
3186-
max: self.getMax(),
3187-
colors: this.getGradient()
3188-
});
3189-
3190-
this.dataRange.setMax(self.getMax());
3191-
31923203
this.endDrawMap();
31933204
};
31943205

dist/Mapv.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editor/public/javascripts/Mapv.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ function drawHoneycomb(obj) {
27882788
draw(x, y, gridsW - 1, 'rgba(0,0,0,0.4)', ctx);
27892789
}
27902790

2791-
if (obj.sup.getDrawOptions().label && obj.sup.getDrawOptions().label && !isTooSmall && !isTooBig) {
2791+
if (obj.sup.getDrawOptions().label && obj.sup.getDrawOptions().label.show && !isTooSmall && !isTooBig) {
27922792
ctx.save();
27932793
ctx.textBaseline = 'middle';
27942794
ctx.textAlign = 'center';
@@ -3104,11 +3104,22 @@ IntensityDrawer.prototype.defaultGradient = {
31043104
};
31053105

31063106
IntensityDrawer.prototype.drawMap = function () {
3107+
this.Scale && this.Scale.set({
3108+
min: 0,
3109+
max: this.getMax(),
3110+
colors: this.getGradient()
3111+
});
3112+
3113+
this.dataRange.setMax(this.getMax());
3114+
31073115
this.beginDrawMap();
31083116

31093117
var self = this;
31103118
var ctx = this.getCtx();
31113119

3120+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
3121+
3122+
31123123
var data = this.getLayer().getData();
31133124
var drawOptions = this.getDrawOptions();
31143125
ctx.strokeStyle = drawOptions.strokeStyle;
@@ -3133,7 +3144,15 @@ IntensityDrawer.prototype.drawMap = function () {
31333144
if (dataType === 'polygon') {
31343145

31353146
for (var i = 0, len = data.length; i < len; i++) {
3136-
var geo = data[i].pgeo;
3147+
var item = data[i];
3148+
var geo = item.pgeo;
3149+
3150+
var isTooSmall = self.masker.min && (item.count < self.masker.min);
3151+
var isTooBig = self.masker.max && (item.count > self.masker.max);
3152+
if (isTooSmall || isTooBig) {
3153+
continue;
3154+
}
3155+
31373156
ctx.beginPath();
31383157
ctx.moveTo(geo[0][0], geo[0][1]);
31393158
ctx.fillStyle = this.dataRange.getColorByGradient(data[i].count);
@@ -3181,14 +3200,6 @@ IntensityDrawer.prototype.drawMap = function () {
31813200
ctx.stroke();
31823201
}
31833202

3184-
this.Scale && this.Scale.set({
3185-
min: 0,
3186-
max: self.getMax(),
3187-
colors: this.getGradient()
3188-
});
3189-
3190-
this.dataRange.setMax(self.getMax());
3191-
31923203
this.endDrawMap();
31933204
};
31943205

editor/public/javascripts/Mapv.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/point_intensity.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
mapv: mapv, // 对应的mapv实例
6161
zIndex: 1, // 图层层级
6262
dataType: 'point', // 数据类型,点类型
63-
dataRangeControl: false,
63+
dataRangeControl: true,
6464
data: data, // 数据
6565
drawType: 'intensity', // 展示形式
6666
drawOptions: { // 绘制参数

src/Drawer/DensityDrawer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function drawHoneycomb(obj) {
346346
draw(x, y, gridsW - 1, 'rgba(0,0,0,0.4)', ctx);
347347
}
348348

349-
if (obj.sup.getDrawOptions().label && obj.sup.getDrawOptions().label && !isTooSmall && !isTooBig) {
349+
if (obj.sup.getDrawOptions().label && obj.sup.getDrawOptions().label.show && !isTooSmall && !isTooBig) {
350350
ctx.save();
351351
ctx.textBaseline = 'middle';
352352
ctx.textAlign = 'center';

src/Drawer/IntensityDrawer.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,22 @@ IntensityDrawer.prototype.defaultGradient = {
2424
};
2525

2626
IntensityDrawer.prototype.drawMap = function () {
27+
this.Scale && this.Scale.set({
28+
min: 0,
29+
max: this.getMax(),
30+
colors: this.getGradient()
31+
});
32+
33+
this.dataRange.setMax(this.getMax());
34+
2735
this.beginDrawMap();
2836

2937
var self = this;
3038
var ctx = this.getCtx();
3139

40+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
41+
42+
3243
var data = this.getLayer().getData();
3344
var drawOptions = this.getDrawOptions();
3445
ctx.strokeStyle = drawOptions.strokeStyle;
@@ -53,7 +64,15 @@ IntensityDrawer.prototype.drawMap = function () {
5364
if (dataType === 'polygon') {
5465

5566
for (var i = 0, len = data.length; i < len; i++) {
56-
var geo = data[i].pgeo;
67+
var item = data[i];
68+
var geo = item.pgeo;
69+
70+
var isTooSmall = self.masker.min && (item.count < self.masker.min);
71+
var isTooBig = self.masker.max && (item.count > self.masker.max);
72+
if (isTooSmall || isTooBig) {
73+
continue;
74+
}
75+
5776
ctx.beginPath();
5877
ctx.moveTo(geo[0][0], geo[0][1]);
5978
ctx.fillStyle = this.dataRange.getColorByGradient(data[i].count);
@@ -101,14 +120,6 @@ IntensityDrawer.prototype.drawMap = function () {
101120
ctx.stroke();
102121
}
103122

104-
this.Scale && this.Scale.set({
105-
min: 0,
106-
max: self.getMax(),
107-
colors: this.getGradient()
108-
});
109-
110-
this.dataRange.setMax(self.getMax());
111-
112123
this.endDrawMap();
113124
};
114125

0 commit comments

Comments
 (0)