How to fix Histogram selectionChanged from Carto Airship 1.04 to 2.00?

by smarchan   Last Updated June 13, 2019 06:22 AM

I have spent quite a bit of time playing around with this generous example provided by Jorge Sanz of Carto:

https://gist.github.com/jsanz/8025628d669f1d9d0647f658f5511774

One thing I've gotten stuck on that I can't seem to resolve is updating the version of Airship that is being incorporated from 1.03 to 2.05.

Based on a review of the changelog it seems that a "breaking change" occured in version 2.00 regarding "Histogram selectionChange" in order to allow category histograms as well as numerical. I'm guessing this is the change that is breaking Jorge Sanz's example above [when referencing the new airship.js], but after several evenings of trial and error I figured I'd reach out for help.

If I had to guess I believe the issue is either in lines 31-38 of vue-component-histogram.js :

    widget.addEventListener('selectionChanged', event => {
        this.$emit(
            'selection-changed',
            event.detail !== null 
            ? event.detail 
            : []
        )    

});

or lines 65-68 of vue_config.js

        if (this.population.selection && this.population.selection.length == 2){
            const [minSel, maxSel] = this.population.selection;
            filterConditions.push(`between($pop_max,${minSel*1e6},${maxSel*1e6})`);

}

Truly wish I could have figured this out on my own, but appreciate in advance any help from this community.

Warm regards



Related Questions


Updated November 01, 2017 17:22 PM

Updated July 01, 2018 00:22 AM

Updated August 10, 2018 11:22 AM

Updated August 17, 2017 15:22 PM

Updated November 14, 2017 04:22 AM