Skip to content

Commit

Permalink
deprecate heatmap.filter taking a coordinate
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gordonwoodhull committed Mar 22, 2019
1 parent 44a26db commit eec12c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 3.0.12
* heatmap takes ordinary filter objects and conversion of coordinates is deprecated ([#1515](https://github.com/dc-js/dc.js/issues/1515))
* Provide alternate, more descriptive names for properties so that the meaning is not overloaded, to reduce confusion and improve code clarity:
* `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.
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).
Expand Down
11 changes: 8 additions & 3 deletions src/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,22 @@ dc.heatMap = function (parent, chartGroup) {
var filters = selection.data().map(function (kv) {
return dc.filters.TwoDimensionalFilter(kv.key);
});
_chart._filter([filters]);
_chart.filter([filters]);
_chart.redrawGroup();
});
}

var nonstandard_filter = _logger.deprecate(function(filter) {
return _chart._filter(dc.filters.TwoDimensionalFilter(filter));
}, 'heatmap.filter taking a coordinate is deprecated - please pass dc.filters.TwoDimensionalFilter instead');
dc.override(_chart, 'filter', function (filter) {
if (!arguments.length) {
return _chart._filter();
}

return _chart._filter(dc.filters.TwoDimensionalFilter(filter));
if(filter.filterType !== 'TwoDimensionalFilter' &&
!(Array.isArray(filter) && filter[0].filterType === 'TwoDimensionalFilter'))
return nonstandard_filter(filter);
return _chart._filter(filter);
});

/**
Expand Down

0 comments on commit eec12c0

Please sign in to comment.