Skip to content

Commit eec12c0

Browse files
deprecate heatmap.filter taking a coordinate
start reverting the override of filter in heatmap from 9aaf971 and fix #1515 this is not generally how filtering works - you need to pass the filter objects
1 parent 44a26db commit eec12c0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 3.0.12
2+
* heatmap takes ordinary filter objects and conversion of coordinates is deprecated ([#1515](https://github.com/dc-js/dc.js/issues/1515))
23
* Provide alternate, more descriptive names for properties so that the meaning is not overloaded, to reduce confusion and improve code clarity:
34
* `dataTable.group` and `dataGrid.group` took a nesting function, not a crossfilter group, so they are replaced with a new property called `section` ([#855](https://github.com/dc-js/dc.js/issues/855)). Additionally, `dataTable.section` is no longer mandatory and defaults to the empty string.
45
The old property names are still supported, but they emit an informational message recommending the better name. They could be deprecated in the future (but there is probably no need).

src/heatmap.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,22 @@ dc.heatMap = function (parent, chartGroup) {
106106
var filters = selection.data().map(function (kv) {
107107
return dc.filters.TwoDimensionalFilter(kv.key);
108108
});
109-
_chart._filter([filters]);
109+
_chart.filter([filters]);
110110
_chart.redrawGroup();
111111
});
112112
}
113113

114+
var nonstandard_filter = _logger.deprecate(function(filter) {
115+
return _chart._filter(dc.filters.TwoDimensionalFilter(filter));
116+
}, 'heatmap.filter taking a coordinate is deprecated - please pass dc.filters.TwoDimensionalFilter instead');
114117
dc.override(_chart, 'filter', function (filter) {
115118
if (!arguments.length) {
116119
return _chart._filter();
117120
}
118-
119-
return _chart._filter(dc.filters.TwoDimensionalFilter(filter));
121+
if(filter.filterType !== 'TwoDimensionalFilter' &&
122+
!(Array.isArray(filter) && filter[0].filterType === 'TwoDimensionalFilter'))
123+
return nonstandard_filter(filter);
124+
return _chart._filter(filter);
120125
});
121126

122127
/**

0 commit comments

Comments
 (0)