dc数据类型,不对行进行分组 [英] dc datatable without grouping the rows

查看:131
本文介绍了dc数据类型,不对行进行分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能有一个直流数据表,而不显示组中的数据?我只想显示所有群组中的所有资料!

Is it possible to have a dc data table without showing the data in groups? I just want to show all the data across all groups!

我的代码如下:

dc.dataTable(".dc-data-table")
  .dimension(dateDimension)
  .group(function (d) {
    return ''
  })
  .size(10) // (optional) max number of records to be shown, :default = 25
  .columns([
      function (d) {
          return getFormattedDate(d.dd);
      },
      function (d) {
          return d.referredfor;
      },
      function (d) {
          return numberFormat(d.cost);
      },
      function (d) {
          return d.gender;
      }
  ])
  .sortBy(function (d) {
      return d.dd;
  })
  .order(d3.ascending)
  .renderlet(function (table) {
      table.selectAll(".dc-table-group").classed("info", true);
  });

这显示了我的数据表,但是有一个空行:

This shows my data table but with an empty row like so:

推荐答案

它看起来不像目前有一种方法来做到这一点。听起来像一个合理的要求!您可以提交增强请求,甚至更好的公关。

It doesn't look like there is currently a way to do this. Sounds like a reasonable request! You might submit an enhancement request, or even better, a PR.

以下是 renderGroups 中的相关代码:

https://github.com /dc-js/dc.js/blob/master/src/data-table.js#L121

它是按键嵌套数据,然后为每个组添加表行。禁用此选项很容易,但是问题是稍后 renderRows 选择这些组行,以便在其下添加数据:

It is nesting the data by key and then adding a table row for each group. It would be trivial to disable this, but the problem is that later, renderRows selects those "group rows" in order to add data under them:

https ://github.com/dc-js/dc.js/blob/master/src/data-table.js#L156

编辑:一个选项 .showGroups(),从2.0 beta 16开始

it's an option, .showGroups(), as of 2.0 beta 16

这篇关于dc数据类型,不对行进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆