Skip to content

Commit

Permalink
Fix key accessor when binding g.box. Fix filter highlighting when bru…
Browse files Browse the repository at this point in the history
…shing enabled.
  • Loading branch information
mtraynham authored and gordonwoodhull committed Nov 25, 2016
1 parent d2fb820 commit f393074
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/box-plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ dc.boxPlot = function (parent, chartGroup) {
.duration(_chart.transitionDuration())
.tickFormat(_tickFormat);

var boxesG = _chart.chartBodyG().selectAll('g.box').data(_chart.data(), function (d) { return d.key; });
var boxesG = _chart.chartBodyG().selectAll('g.box').data(_chart.data(), _chart.keyAccessor());

renderBoxes(boxesG);
updateBoxes(boxesG);
Expand Down Expand Up @@ -184,13 +184,26 @@ dc.boxPlot = function (parent, chartGroup) {

_chart.fadeDeselectedArea = function () {
if (_chart.hasFilter()) {
_chart.g().selectAll('g.box').each(function (d) {
if (_chart.isSelectedNode(d)) {
_chart.highlightSelected(this);
} else {
_chart.fadeDeselected(this);
}
});
if (_chart.isOrdinal()) {
_chart.g().selectAll('g.box').each(function (d) {
if (_chart.isSelectedNode(d)) {
_chart.highlightSelected(this);
} else {
_chart.fadeDeselected(this);
}
});
} else {
var extent = _chart.brush().extent();
var start = extent[0];
var end = extent[1];
_chart.g().selectAll('g.box').each(function (d) {
if (d.key < start || d.key >= end) {
_chart.fadeDeselected(this);
} else {
_chart.highlightSelected(this);
}
});
}
} else {
_chart.g().selectAll('g.box').each(function () {
_chart.resetHighlight(this);
Expand Down

0 comments on commit f393074

Please sign in to comment.