Heat Map not applying filters


#1

Hello, I have a Heat Map that is grouped by a field of type TIME and another of type INTEGER, I also have the dataZoom enabled with .set("dataZoom", "dragFilter"), the problem is that when I select a range of values ​​the filter is only applied to the field of type INTEGER and not to the one of type TIME. Am I doing something wrong? This is my code:

let provider = cf.provider("Elasticsearch");
let source = provider.source("ny_sales");
let metric0 = cf.Metric("count");
let metricColor = cf.Metric("count");
let group1 = cf.Attribute("sale_time")
    .func("MONTH")
    .limit(10)
    .sort("desc", cf.Metric());
let group2 = cf.Attribute("company")
    .limit(10)
    .sort("desc", cf.Metric());
let myData = source.groupby(group1).colgroupby(group2)
    .metrics(metric0);
let grid = cf.Grid()
    .top(10)
    .right(10)
    .bottom(10)
    .left(10);
let color = cf.Color()
    .palette(["#a50026", "#d73027", "#d73027", "#f46d43", "#fdae61", "#fee090"])
    .metric(metricColor);
let myChart = myData.graph("Heat Map")
    .set("showValues", true)
    .set("grid", grid)
    .set("color", color)
    .set("dataZoom", "dragFilter")
    .element('hm-container')
    .execute();

#2

I see, you should know that the current version of ChartFactor (5.1.28) does not support filtering by a time field if it is not sorted by the same field, so if you do not want to change the sorting, you can notify your users that filtering by a time field that is not sorted is not currently supported, using the notification event, like this:

let myChart = myData.graph("Heat Map")
    .set("showValues", true)
    .set("grid", grid)
    .set("color", color)
    .on('notification', event => {
        console.log(event.message)
        // message wil be: Filtering by unordered dates (${group.name}) is not supported
    });
    .set("dataZoom", "dragFilter")
    .element('hm-container')
    .execute();

#3

Well, I think I’ll do both, notify and sort by the time field if the user requires it at the time of being notified


#4

That’s good, just remember that regardless of whether the field is sorted ascending or descending when you apply the filter by selecting a range of values ​​this filter will be applied starting with the date that is lowest to the highest.