Skip to content

Commit faef863

Browse files
Merge branch 'release/3.0.2'
2 parents 0a758f4 + cea8966 commit faef863

28 files changed

+596
-317
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.0.2
2+
* Allow row chart `.xAxis` to be settable. Since the type of axis can't be detected by the chart, provide [example](https://dc-js.github.io/dc.js/examples/row-top-axis.html) of setting the position of axis and grid lines manually.
3+
* In a composite chart, the brush is only applied on the parent, by Deepak Kumar. This fixes many composite chart brushing issues, but let us know if it broke any of your use cases! ([#1408](https://github.com/dc-js/dc.js/pull/1408) / [#1424](https://github.com/dc-js/dc.js/issues/1424) / [#479](https://github.com/dc-js/dc.js/issues/479) / [#390](https://github.com/dc-js/dc.js/issues/390) / [#706](https://github.com/dc-js/dc.js/issues/706) / [#878](https://github.com/dc-js/dc.js/issues/878))
4+
15
## 3.0.1
26
* Test compatibility with D3v4 as well as D3v5, by Deepak Kumar ([#1430](https://github.com/dc-js/dc.js/pull/1430))
37
* Add new charts/widgets to class hierarchy in documentation

dc.js

Lines changed: 62 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dc",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"license": "Apache-2.0",
55
"copyright": "2017",
66
"description": "A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js ",

spec/composite-chart-spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ describe('dc.compositeChart', function () {
704704
});
705705

706706
it('should filter the child charts', function () {
707+
jasmine.clock().tick(100);
707708
expect(otherDimension.top(Infinity).length).toBe(4);
708709
});
709710

@@ -714,6 +715,7 @@ describe('dc.compositeChart', function () {
714715
});
715716

716717
it('should filter down to fewer points', function () {
718+
jasmine.clock().tick(100);
717719
expect(otherDimension.top(Infinity).length).toBe(2);
718720
});
719721

spec/coordinate-grid-chart-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ describe('dc.coordinateGridChart', function () {
741741
});
742742

743743
it('should update its range chart\'s filter', function () {
744-
expect(chart.rangeChart().filter()).toEqual(chart.filter());
744+
expect(dc.utils.arraysEqual(chart.rangeChart().filter(), chart.filter())).toEqual(true);
745745
});
746746

747747
it('should trigger redraw on its range chart', function () {

src/bar-chart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ dc.barChart = function (parent, chartGroup) {
228228
bars.classed(dc.constants.SELECTED_CLASS, false);
229229
bars.classed(dc.constants.DESELECTED_CLASS, false);
230230
}
231-
} else if (_chart.brushOn()) {
231+
} else if (_chart.brushOn() || _chart.parentBrushOn()) {
232232
if (!_chart.brushIsEmpty(brushSelection)) {
233233
var start = brushSelection[0];
234234
var end = brushSelection[1];

src/box-plot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ dc.boxPlot = function (parent, chartGroup) {
192192
}
193193
});
194194
} else {
195-
if (!_chart.brushOn()) {
195+
if (!(_chart.brushOn() || _chart.parentBrushOn())) {
196196
return;
197197
}
198198
var start = brushSelection[0];

src/composite-chart.js

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,42 +60,21 @@ dc.compositeChart = function (parent, chartGroup) {
6060
child.svg(_chart.svg());
6161
child.xUnits(_chart.xUnits());
6262
child.transitionDuration(_chart.transitionDuration(), _chart.transitionDelay());
63-
child.brushOn(_chart.brushOn());
63+
child.parentBrushOn(_chart.brushOn());
64+
child.brushOn(false);
6465
child.renderTitle(_chart.renderTitle());
6566
child.elasticX(_chart.elasticX());
6667
}
6768

6869
return g;
6970
});
7071

71-
_chart._brushing = function () {
72-
// Avoids infinite recursion (mutual recursion between range and focus operations)
73-
// Source Event will be null when brush.move is called programmatically (see below as well).
74-
if (!d3.event.sourceEvent) { return; }
75-
76-
// Ignore event if recursive event - i.e. not directly generated by user action (like mouse/touch etc.)
77-
// In this case we are more worried about this handler causing brush move programmatically which will
78-
// cause this handler to be invoked again with a new d3.event (and current event set as sourceEvent)
79-
// This check avoids recursive calls
80-
if (d3.event.sourceEvent.type && ['start', 'brush', 'end'].indexOf(d3.event.sourceEvent.type) !== -1) {
81-
return;
82-
}
83-
84-
var brushSelection = d3.event.selection;
85-
if (brushSelection) {
86-
brushSelection = brushSelection.map(_chart.x().invert);
87-
}
88-
brushSelection = _chart.extendBrush(brushSelection);
89-
90-
_chart.redrawBrush(brushSelection, false);
91-
92-
var brushIsEmpty = _chart.brushIsEmpty(brushSelection);
93-
94-
_chart.replaceFilter(brushIsEmpty ? null : brushSelection);
95-
72+
_chart.applyBrushSelection = function (rangedFilter) {
73+
_chart.replaceFilter(rangedFilter);
9674
for (var i = 0; i < _children.length; ++i) {
97-
_children[i].replaceFilter(brushIsEmpty ? null : brushSelection);
75+
_children[i].replaceFilter(rangedFilter);
9876
}
77+
_chart.redrawGroup();
9978
};
10079

10180
_chart._prepareYAxis = function () {
@@ -285,10 +264,11 @@ dc.compositeChart = function (parent, chartGroup) {
285264
};
286265

287266
_chart.fadeDeselectedArea = function (brushSelection) {
288-
for (var i = 0; i < _children.length; ++i) {
289-
var child = _children[i];
290-
child.brush(_chart.brush());
291-
child.fadeDeselectedArea(brushSelection);
267+
if (_chart.brushOn()) {
268+
for (var i = 0; i < _children.length; ++i) {
269+
var child = _children[i];
270+
child.fadeDeselectedArea(brushSelection);
271+
}
292272
}
293273
};
294274

0 commit comments

Comments
 (0)