Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heat map filtering #532

Open
dtfoster opened this issue Mar 2, 2014 · 1 comment
Open

Heat map filtering #532

dtfoster opened this issue Mar 2, 2014 · 1 comment
Milestone

Comments

@dtfoster
Copy link

dtfoster commented Mar 2, 2014

I've noticed that filtering in the new heat map chart type only changes the colouring of the boxes correctly when clicking on a box or axis label. When calling the filter method manually (heatmapChart.filter([1,1]) for example), all of the boxes are greyed out after the filter, even though the filtering of the data has been applied correctly.

I think the issue is that the hasFilter function isn't currently set up to deal with 2 element arrays as input, such as [1,1]. I suggest something like the following to fix the issue:

_chart.hasFilter = function (filter) {
    if (!arguments.length) return _filters.length > 0;
    if (filter instanceof Array){
        var out;
        out = false;
        _filters.forEach(function(x){
            if (x.isFiltered(filter)){
            out = true
            }
        })
        return out
    }else{
        return _filters.indexOf(filter) >= 0
    };
};
@gordonwoodhull
Copy link
Contributor

Thanks for the report and possible fix!

Would you be willing to submit a PR with tests that fail before and succeed after your fix? The current tests are in spec/heatmap-spec.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants