Some minor tweaks for the scatter voronoi

master-patched
Bob Monteverde 12 years ago
parent eabda14d91
commit 6db030bdb4

@ -8058,13 +8058,10 @@ nv.models.scatter = function() {
if (clipVoronoi) {
var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
.data([id])
.enter();
pointClipsEnter.append('clipPath')
.attr('class', 'nv-point-clips')
.attr('id', 'nv-points-clip-' + id);
@ -8087,8 +8084,10 @@ nv.models.scatter = function() {
if (useVoronoi === true) {
if(vertices.length < 3) {
// Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
vertices.push([x.range()[0] - 2000, y.range()[0] - 2000, null, null]);
vertices.push([x.range()[1] + 2000, y.range()[1] + 2000, null, null]);
vertices.push([x.range()[0] - 2000, y.range()[0] + 2000, null, null]);
vertices.push([x.range()[1] + 2000, y.range()[1] - 2000, null, null]);
}
var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
return {
@ -8105,7 +8104,7 @@ nv.models.scatter = function() {
.attr('class', function(d,i) { return 'nv-path-'+i; });
pointPaths.exit().remove();
pointPaths
.attr('d', function(d) { return 'M' + d.data.join(',') + 'Z'; });
.attr('d', function(d) { return 'M' + d.data.join('L') + 'Z'; });
eventElements = pointPaths;

4
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -155,13 +155,10 @@ nv.models.scatter = function() {
if (clipVoronoi) {
var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
.data([id])
.enter();
pointClipsEnter.append('clipPath')
.attr('class', 'nv-point-clips')
.attr('id', 'nv-points-clip-' + id);
@ -184,8 +181,10 @@ nv.models.scatter = function() {
if (useVoronoi === true) {
if(vertices.length < 3) {
// Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
vertices.push([x.range()[0] - 2000, y.range()[0] - 2000, null, null]);
vertices.push([x.range()[1] + 2000, y.range()[1] + 2000, null, null]);
vertices.push([x.range()[0] - 2000, y.range()[0] + 2000, null, null]);
vertices.push([x.range()[1] + 2000, y.range()[1] - 2000, null, null]);
}
var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
return {
@ -202,7 +201,7 @@ nv.models.scatter = function() {
.attr('class', function(d,i) { return 'nv-path-'+i; });
pointPaths.exit().remove();
pointPaths
.attr('d', function(d) { return 'M' + d.data.join(',') + 'Z'; });
.attr('d', function(d) { return 'M' + d.data.join('L') + 'Z'; });
eventElements = pointPaths;

Loading…
Cancel
Save