目录

DC.js - capMixin( capMixin)

capMixin可以将低于某个值的数据元素列表分组为“其他”。 它适用于行图和饼图。 capMixin的层次结构如下图所示。

capMixin

capMixin提供了四种查找Others部分的方法,它们如下 -

Method 1: cap( [count]) - 获取或设置将包含在上限中的元素数。

Method 2: othersGrouper( [grouperFunction]) - 获取或设置执行“其他”组的函数。 提供的默认功能如下。

chart.othersGrouper(function (topItems, restItems) {
   var restItemsSum = d3.sum(restItems, _chart.valueAccessor()),
   restKeys = restItems.map(_chart.keyAccessor());
   if (restItemsSum > 0) {
      return topItems.concat([{
         others: restKeys,
         key: _chart.othersLabel(),
         value: restItemsSum
      }]);
   }
   return topItems;
});

Method 3: othersLabel( [label]) - 获取或设置“其他”组的标签。

Method 4: takeFront( [takeFront]) - 获取或设置封顶的方向。 如果设置,则图表从排序的数据元素数组中获取前面的项目; 否则它将采取最后的项目。

↑回到顶部↑
WIKI教程 @2018