TCBI - Dynamic Buckets
Dynamic Buckets - Group data on aggregate values
The Dynamic Buckets add-on supports aggregating a column, bar, and line chart’s results into buckets. This enables you to dynamically or manually segment the result population into groups while still retaining the filtering functionality.
Steps to group data:
-
Create a column chart widget by choosing only one category.
-
In the first value define the measure by which the bucket will be calculated, for example sum(revenue). This value is not reflected in the widget.
-
In the second measure define the aggregation per bucket, for example count(client) / sum(revenue) / avg(revenue). You can define additional measures.
-
Click Apply to save the widget.
-
In the Widget Editor, enter the script that defines your bucket ranges. There are 2 type of bucket ranges you can define:
Manual Ranges: Allows you to manually define the buckets ranges and here is the example:
Manual Configuration Script
var options = {
type: "manual", // (required) Can be 'auto' or 'manual'
separator: " - ", // (optional)
clickBucketOption: 1, // (optional) Can be 1 (default) or 2. 1- sets column categories as filters,
// 2- exports column categories to CSV file.
ranges: [ // Manually define the buckets you want to use
// This will group if values between 0 & 1
{ name: "0-1", // Label for the bucket color: "#3471AD", // Color can be text or a hex code min: 0, // The lower limit for the bucket, put null for no lower limit max: 1 // The upper limit for the bucket, put null for no upper limit }
,
// This will group any values between 1 & 30
{ name: "1 - 30", color: "#F66500", min: 1, max: 30 }
,
// This will group any values between 30 & 60
{ name: "30 - 60", color: "#F6FF00", min: 30, max: 60 }
,
// This will group any values greater than 60
{ name: "> 60", color: "#42BC39", min: 60, max: null }
]
};
prism.dynamicBuckets(widget, options);
Dynamic Ranges: Allows you to define the number of buckets. Ranges will be calculated automatically by the Min and Max of the widget values. Here is the example:
Auto Configuration Script
var options =
{ type: "auto", separator: " - ", clickBucketOption: 1, numberOfBuckets: 5 }
;
prism.dynamicBuckets(widget, options);