Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
BroHammie committed May 15, 2016
1 parent fc60684 commit 69baa72
Show file tree
Hide file tree
Showing 3 changed files with 571 additions and 509 deletions.
60 changes: 49 additions & 11 deletions d3.parcoords.js
Expand Up @@ -1183,7 +1183,7 @@ pc.brushMode = function(mode) {
.y(__.dimensions[axis].yscale)
.on("brushstart", function() {
if(d3.event.sourceEvent !== null) {
events.brushstart.call(pc, __.brushed);
events.brushstart.call(pc, __.brushed);
d3.event.sourceEvent.stopPropagation();
}
})
Expand Down Expand Up @@ -1654,16 +1654,54 @@ pc.brushMode = function(mode) {
});
};

function brushExtents() {
var extents = {};
d3.keys(__.dimensions).forEach(function(d) {
var brush = brushes[d];
if (brush !== undefined && !brush.empty()) {
var extent = brush.extent();
extents[d] = extent;
}
});
return extents;
function brushExtents(extents) {
if (typeof(extents) === 'undefined') {
extents = {};
d3.keys(__.dimensions).forEach(function (d) {
var brush = brushes[d];
if (brush !== undefined && !brush.empty()) {
var extent = brush.extent();
extents[d] = extent;
}
});
return extents;
}
else {
//first get all the brush selections
var brushSelections = {};
g.selectAll('.brush')
.each(function (d) {
brushSelections[d] = d3.select(this);

});

// loop over each dimension and update appropriately (if it was passed in through extents)
d3.keys(__.dimensions).forEach(function (d) {
if (extents[d] === undefined) {
return;
}

var brush = brushes[d];
if (brush !== undefined) {
//update the extent
brush.extent(extents[d]);

//redraw the brush
brushSelections[d]
.transition()
.duration(0)
.call(brush);

//fire some events
brush.event(brushSelections[d]);
}
});

//redraw the chart
pc.renderBrushed();

return pc;
}
}

function brushFor(axis) {
Expand Down

0 comments on commit 69baa72

Please sign in to comment.