
- DC.js 教程
- DC.js - 主頁
- DC.js - 簡介
- DC.js - 安裝
- DC.js - 概念
- Crossfilter 入門
- D3.js 入門
- DC.js - Mixin
- DC.js - baseMixin
- DC.js - capMixin
- DC.js - colorMixin
- DC.js - marginMixin
- DC.js - coordinateGridMixin
- DC.js - 餅圖
- DC.js - 折線圖
- DC.js - 柱狀圖
- DC.js - 複合圖表
- DC.js - 系列圖表
- DC.js - 散點圖
- DC.js - 氣泡圖
- DC.js - 熱圖
- DC.js - 資料計數
- DC.js - 資料表格
- DC.js - 資料網格
- DC.js - 圖例
- DC.js 儀表盤工作示例
- DC.js 有用資源
- DC.js - 快速指南
- DC.js - 有用資源
- DC.js - 討論
DC.js - capMixin
capMixin 能夠將低於特定值的資料元素列表歸組為“其他”。它適用於行圖和餅圖。capMixin 的層次結構定義如下所示。

capMixin 提供了四種方法來查詢其他部分,如下所示 −
方法 1: cap( [count]) − 獲取或設定包含在上限中的元素數。
方法 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; });
方法 3: othersLabel( [label]) − 獲取或設定“其他”組的標籤。
方法 4: takeFront( [takeFront]) − 獲取或設定上限的方向。如果設定了該方向,圖表則從資料元素的有序陣列中取前面的專案;否則,圖表將取後面的專案。
廣告