Merge branch 'master' into development

master
Robin Hu 11 years ago
commit 0497069de8

@ -62,12 +62,10 @@ nv.models.scatter = function() {
container = d3.select(this); container = d3.select(this);
//add series index to each data point for reference //add series index to each data point for reference
data = data.map(function(series, i) { data.forEach(function(series, i) {
series.values = series.values.map(function(point) { series.values.forEach(function(point) {
point.series = i; point.series = i;
return point;
}); });
return series;
}); });
//------------------------------------------------------------ //------------------------------------------------------------
@ -169,9 +167,9 @@ nv.models.scatter = function() {
var pX = getX(point,pointIndex); var pX = getX(point,pointIndex);
var pY = getY(point,pointIndex); var pY = getY(point,pointIndex);
return [x(pX)+ Math.random() * 1e-7, return [x(pX)+ Math.random() * 1e-7,
y(pY)+ Math.random() * 1e-7, y(pY)+ Math.random() * 1e-7,
groupIndex, groupIndex,
pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
}) })
.filter(function(pointArray, pointIndex) { .filter(function(pointArray, pointIndex) {
@ -239,17 +237,17 @@ nv.models.scatter = function() {
pointPaths.exit().remove(); pointPaths.exit().remove();
pointPaths pointPaths
.attr('d', function(d) { .attr('d', function(d) {
if (d.data.length === 0) if (d.data.length === 0)
return 'M 0 0' return 'M 0 0'
else else
return 'M' + d.data.join('L') + 'Z'; return 'M' + d.data.join('L') + 'Z';
}); });
var mouseEventCallback = function(d,mDispatch) { var mouseEventCallback = function(d,mDispatch) {
if (needsUpdate) return 0; if (needsUpdate) return 0;
var series = data[d.series]; var series = data[d.series];
if (typeof series === 'undefined') return; if (typeof series === 'undefined') return;
var point = series.values[d.point]; var point = series.values[d.point];
mDispatch({ mDispatch({
@ -290,7 +288,7 @@ nv.models.scatter = function() {
.selectAll('.nv-point') .selectAll('.nv-point')
//.data(dataWithPoints) //.data(dataWithPoints)
//.style('pointer-events', 'auto') // recativate events, disabled by css //.style('pointer-events', 'auto') // recativate events, disabled by css
.on('click', function(d,i) { .on('click', function(d,i) {
//nv.log('test', d, i); //nv.log('test', d, i);
if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
var series = data[d.series], var series = data[d.series],
@ -449,7 +447,7 @@ nv.models.scatter = function() {
chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) { chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) {
d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex) d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex)
.classed("hover",isHoverOver); .classed("hover",isHoverOver);
}; };
@ -470,7 +468,7 @@ nv.models.scatter = function() {
chart.dispatch = dispatch; chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart); chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) { chart.x = function(_) {
if (!arguments.length) return getX; if (!arguments.length) return getX;
getX = d3.functor(_); getX = d3.functor(_);

Loading…
Cancel
Save