dc.js 散点图和弹性行为

dc.js Scatter Plot and elasticY behavior

elasticY(true)是否应该让散点图在触发重绘事件时重新计算y轴范围?

我已经使用散点刷示例进行了演示。每个图表都添加了以下属性:

.yAxisPadding('5%')  // Allow the max values to be brushed
.elasticY(true)      // Allow the chart to recalculate the Y axis range

这是一个 jsFiddle 示例。

我认为通过刷左散点图,选择图表中间的几个点,会导致右散点图重新计算其 Y 轴范围。但这似乎不正确。是错误还是我遗漏了什么?

elasticXelasticY 一样,dc.js 正在查看所有垃圾箱,无论它们是否为空。

您可能会争辩说它忠实地显示了所有数据,只是碰巧其中一些数据为零。 :-)

要删除这些零,请使用常见问题解答中的 remove_empty_bins

    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.

请注意,散点图 joins the data in a naive way 不能提供很好的动画过渡。我通常建议使用 .transitionDuration(0) 关闭散点图的过渡,因为它们没有用。