【问题标题】:Crossfilter Row-Chart count functionCrossfilter Row-Chart 计数功能
【发布时间】:2016-04-29 12:14:12
【问题描述】:

我有 {date, testscript, testcase, duration, clickcount} 形式的数据

我想过滤测试脚本和日期,然后得到一个计数。

就像一个不同于 testscript 和 date 在一起的:

X-Axis ManualTest:应该是 5,而不是 10,因为总是有两条记录具有相同的日期和测试脚本

X-Axis ErrorTest: 应该是 2

我如何做到这一点?

【问题讨论】:

  • 您的 JSFiddle 已损坏,因为外部资源的加载顺序错误。如果您可以通过以正确的顺序重新添加资源来修复它,那就太好了。您要做的是计算每种测试的唯一日期?如果是这样,Reductio 可以帮助解决这个问题:github.com/crossfilter/…
  • 嗨,Ethan,是的,你是对的,我想计算每种测试的唯一日期,就像我只想计算组合一样 -> 可能是 2011/11/11,测试脚本:ErrorTest,测试用例 AA 和 2011/11/11,测试脚本:ErrorTest,测试用例 BB 这应该算作 1,因为相同的日期相同的测试脚本

标签: dc.js crossfilter


【解决方案1】:

如上所述,您可能应该使用像 Reductio 这样的辅助库来执行此操作。在 Reductio 中,您使用 exception aggregation:

var clickcountGroup = reductio()
  .exception('date')
  .exceptionCount(true)(testcaseDim.group());

 testcaseRow
    .margins({ top: 5, left: 10, right: 10, bottom: 20 })
    .dimension(testcaseDim)
    .group(clickcountGroup)
    .valueAccessor(function(d){ return d.value.exceptionCount; })
    .elasticX(true);

https://jsfiddle.net/esjewett/4r9t3ozr/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-15
    • 2020-12-21
    • 1970-01-01
    • 1970-01-01
    • 2020-12-06
    相关资源
    最近更新 更多