UI-38 fixed all scatter-based charts for use on IE9

This commit is contained in:
Dingo 2012-12-08 19:02:47 -05:00
parent 2338ebc8ce
commit 5f79dba1ea
2 changed files with 11 additions and 11 deletions

View File

@ -197,9 +197,7 @@ nv.addGraph(function() {
.color(keyColor) .color(keyColor)
//.clipEdge(true); //.clipEdge(true);
chart.stacked.scatter // chart.stacked.scatter.clipVoronoi(false);
.sizeRange([64,64])
.useVoronoi(false);
chart.xAxis chart.xAxis
.tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) }); .tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) });

View File

@ -189,22 +189,24 @@ nv.models.scatter = function() {
vertices.push([x.range()[0] - 2000, y.range()[0] + 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]); vertices.push([x.range()[1] + 2000, y.range()[1] - 2000, null, null]);
} }
var bounds = d3.geom.polygon([
[0,0],
[0,height],
[width,height],
[width,0]
]);
var voronoi = d3.geom.voronoi(vertices).map(function(d, i) { var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
return { return {
'data': d.map(function(f) { 'data': bounds.clip(d),
//keep the voronoi paths within the svg bounding box (for IE9 support)
f[0] = f[0] > width ? width : f[0];
f[0] = f[0] < 0 ? 0 : f[0];
f[1] = f[1] > height ? height : f[1];
f[1] = f[1] < 0 ? 0 : f[1];
return f;
}),
'series': vertices[i][2], 'series': vertices[i][2],
'point': vertices[i][3] 'point': vertices[i][3]
} }
}); });
var pointPaths = wrap.select('.nv-point-paths').selectAll('path') var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
.data(voronoi); .data(voronoi);
pointPaths.enter().append('path') pointPaths.enter().append('path')