Skip to content

Commit

Permalink
Merge pull request #59 from joshhjacobson/feature/fix-flipAxes
Browse files Browse the repository at this point in the history
Enable programmatic use of flipAxes(), address #50
  • Loading branch information
BigFatDog authored Jan 15, 2019
2 parents 70c1679 + bce4ad1 commit ecde298
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/bindEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const bindEvents = (
ctx,
pc,
xscale,
axis,
flags,
brushedQueue,
markedQueue,
Expand Down
5 changes: 3 additions & 2 deletions src/state/sideEffects.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const sideEffects = (
ctx,
pc,
xscale,
axis,
flags,
brushedQueue,
markedQueue,
Expand Down Expand Up @@ -76,8 +77,8 @@ const sideEffects = (
})
.on('flipAxes', d => {
if (d.value && d.value.length) {
d.value.forEach(function(axis) {
flipAxisAndUpdatePCP(config, pc, axis);
d.value.forEach(function(dimension) {
flipAxisAndUpdatePCP(config, pc, axis)(dimension);
});
pc.updateAxes(0);
}
Expand Down
9 changes: 7 additions & 2 deletions src/util/flipAxisAndUpdatePCP.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { select } from 'd3-selection';
import { select, selectAll } from 'd3-selection';

const flipAxisAndUpdatePCP = (config, pc, axis) =>
function(dimension) {
pc.flip(dimension);
pc.brushReset(dimension);
select(this.parentElement)

// select(this.parentElement)
pc.selection
.select('svg')
.selectAll('g.axis')
.filter(d => d === dimension)
.transition()
.duration(config.animationTime)
.call(axis.scale(config.dimensions[dimension].yscale));
Expand Down

0 comments on commit ecde298

Please sign in to comment.