The Dynamic Buckets add-on supports aggregating a column chart’s results into buckets. This enables you to dynamically or manually segment the result population into groups while still retaining the filtering functionality.
Clicking on a column in the chart selects the specific members that make up the bucket.
Step by step how to:
- Create a column chart widget. The position of the fields in this chart is counter-intuitive; so please pay attention and follow the instructions below:
- Choose only one category. Pick the same field that you want to apply aggregation to (Y-axis values). In this example; we use 'Identification' from 'Company/Individuals'.
- As a first value; pick the measure by which the bucket will be grouped. The most common one is SUM(Revenue). In the example below; I've used a User-Define Field '# Licensed Users'.
- As a second value; define the aggregation values for the buckets; for example count(identification) / sum(revenue) / avg(revenue).
Widget designer for the example above should look like this:
- Add a custom script. Click on Options; the triple dots on the top right corner; and pick Edit Script.
- In the Widget Editor; enter the script that defines your bucket ranges. There are 2 type of bucket ranges you can define:
A) Manual Ranges: Allow you to manually define the buckets ranges.
To create buckets for the example above you should add following bucket ranges:
1-5 greater equal 1 and less than 6
6-10 greater equal 6 and less than 11
11-25 greater equal 11 and less than 26
26-50 greater equal 26 and less than 51
51-100 greater equal 51 and less than 101
101-250greater equal 101 and less than 251
251-500greater equal 251 and less than 501
501+ greater equal 501
Code
|
var options = { |
B) Dynamic Ranges: Allow you to define the number of buckets. Ranges will be calculated automatically by the Min and Max of the widget values.
Click here to learn more about this scenario.
Add the following code to the end of the script to create the buckets:
prism.dynamicBuckets(widget; options )
- Save the script; click Apply and refresh the page. The widget now displays the data divided into buckets you defined.