score:2

Accepted answer

As always with elasticX and elasticY, dc.js is looking at all of the bins, whether or not they are empty.

You could argue that it is faithfully displaying all the data, it just happens that some of that data is zeroes. :-)

To remove those zeroes, use remove_empty_bins from the FAQ:

    function remove_empty_bins(source_group) {
        return {
            all: function () {
                return source_group.all().filter(function(d) {
                    //return Math.abs(d.value) > 0.00001; // if using floating-point numbers
                    return d.value !== 0; // if integers only
                });
            }
        };
    }
    chart1
        .group(remove_empty_bins(group1))
    chart2
        .group(remove_empty_bins(group2))

Fork of your fiddle.

Note that the scatter plot joins the data in a naive way which doesn't provide very good animated transitions. I generally advise just turning off the transitions for scatter plots with .transitionDuration(0) because they are not useful.


Related Query