vap-visual
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -250,2 +250,3 @@ "use strict"; | ||
.attr('id', function (d) { return "area-".concat(d.properties ? d.properties.id : d.name); }); | ||
var TextGROUT = this.ROOT.selectAll('g._region_text').data(features).enter().append('g').attr('class', '_region_text'); | ||
this.GROUP.append('path') | ||
@@ -261,11 +262,2 @@ .attr('d', function (d) { return _this.project.drawArea(path, d); }) | ||
.attr('class', function (d) { return '_region_path ' + (d.properties.className || ''); }); | ||
this.GROUP.append('text').text(function (d) { return d.properties._nickName; }) | ||
.attr('x', function (d) { return root(d.properties.cp)[0]; }) | ||
.attr('y', function (d) { | ||
var y = root(d.properties.cp)[1]; | ||
if (d.geometry) { | ||
return y; | ||
} | ||
return y + 20; | ||
}); | ||
if (this.BACKGROUND) { | ||
@@ -286,2 +278,20 @@ this.BACKGROUND.selectAll('path') | ||
} | ||
TextGROUT.append('text').text(function (d) { return d.properties._nickName; }) | ||
.attr('x', function (d) { | ||
console.log(root(d.properties.cp)[0], d.properties); | ||
if (d.properties.textPX) { | ||
return root(d.properties.cp)[0] + d.properties.textPX; | ||
} | ||
return root(d.properties.cp)[0]; | ||
}) | ||
.attr('y', function (d) { | ||
var y = root(d.properties.cp)[1]; | ||
if (d.properties.textPY) { | ||
y += d.properties.textPY; | ||
} | ||
if (d.geometry) { | ||
return y; | ||
} | ||
return y + 20; | ||
}); | ||
}; | ||
@@ -311,12 +321,11 @@ AreaDrawer.prototype.sort = function (data) { | ||
AreaDrawer.prototype.update = function () { | ||
var _this = this; | ||
this.GROUP.select('path').style('fill', function (d, i) { | ||
var fullName = d.properties.name; | ||
if (_this.DATA_MAP.has(fullName)) { | ||
var data = _this.DATA_MAP.get(fullName); | ||
var value = data[_this.props.valueField] / _this.MAX; | ||
return _this.channel.getItemFill(value); | ||
} | ||
return _this.channel.getItemFill(0); | ||
}); | ||
// this.GROUP.select('path').style('fill', (d: any, i) => { | ||
// let fullName = d.properties.name; | ||
// if (this.DATA_MAP.has(fullName)) { | ||
// let data = this.DATA_MAP.get(fullName); | ||
// let value = data[this.props.valueField] / this.MAX; | ||
// return this.channel.getItemFill(value); | ||
// } | ||
// return this.channel.getItemFill(0); | ||
// }) | ||
}; | ||
@@ -323,0 +332,0 @@ return AreaDrawer; |
{ | ||
"name": "vap-visual", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "vap-visual - A Visual FrameWork base on d3", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
712178
16282