简体   繁体   English

DC.JS散点图未过滤

[英]DC.JS Scatter Plot not filtering

I am a big fan of the Dimensional Charting Javascript Library , but I am having an issue with the scatter plot feature. 我是Dimensional Charting Javascript Library的忠实拥护者 ,但是散点图功能存在问题。 This chart type does not seem to filter the same way other charts do. 这种图表类型似乎不像其他图表那样过滤。

Here is an example: Fiddle of Scatter Plot 这是一个示例: 散点图小提琴

When I filter the typeDimension, I can see the row chart gets filtered but the scatter plot does not. 当我过滤typeDimension时,我可以看到行图被过滤了,而散点图却没有。

    typeDimension.filter("foo");
    dc.redrawAll();

My expectation is that the scatter plot would update to show only the points that fit with the filter criteria. 我的期望是,散点图将更新为仅显示符合过滤条件的点。

Any help is appreciated. 任何帮助表示赞赏。 Thanks! 谢谢! - DJ -DJ

I opened an issue at github.com/NickQiZhu/dc.js/issues/491. 我在github.com/NickQiZhu/dc.js/issues/491中打开了一个问题。 The feedback is that the functionality to transition the scatterPlot points based on applied filters is not released yet. 反馈是尚未发布基于所应用的过滤器转换scatterPlot点的功能。

I ended up using a bubbleChart instead and achieved what I needed. 我最终使用了一个bubbleChart来实现我所需要的。

I ended up overriding the MIN_RADIUS parameter however so that smaller bubbles could be displayed: 我最终重写了MIN_RADIUS参数,以便可以显示较小的气泡:

    bubbleChart.width(500)
        .height(200)
        .dimension(typeDimension)
        .group(typeGroup)
        .x(d3.scale.linear().domain([0, 20]))
        .y(d3.scale.linear().domain([0, 1000]))
        .keyAccessor(function (d) {
        return d.value.count;
    })
        .valueAccessor(function (d) {
        return d.value.avgSpeed;
    })
        .radiusValueAccessor(function (d) {
        return 1;
    });
    bubbleChart.MIN_RADIUS = 1;

Here is a jsfiddle for using a bubblechart: http://jsfiddle.net/djmartin_umich/ymU5c/ 这是使用气泡图的jsfiddle: http : //jsfiddle.net/djmartin_umich/ymU5c/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM