Limit Results in Chart

Is it possible to limit results returned to only grouped items that have more than 2 entries. The charts expand too much and i don't need to see entries that have only one item.

Hello @jaitsujin,

You can do it with this JavaScript. It sorts the results and displays only required values.

Please see this post for the details:


This one works but it's a slightly different result from what i was looking for. The code above will only show me the first 5.
I need to show all items that have more than 2 entries.


As I understood, you display the count of entries. So you need to do one more thing.

Go to Dashboard Designer > Data Source > Aggregation. Group by the field you want, in my example it is Title. Then set aggregations to calculate the count of records. My aggregation name is "Total".


After that, you will need to update the Chart settings. In Dashboard Designer > Dashboard > Chart set the value to sum the aggregation, like this:

Next, you have two options:

  1. Use the code from the previous post. It will sort the results and display only top records. So if you want to display the top 3 records, you can use the following code in Dashboard Designer > Data Source > Advanced.
handlers.aggregationSuccess = function(data, logger) {

  function findLargest(){
    // sort descending
    data.groups.sort(function(a,b) {
        if (a.Total < b.Total) { return 1; }
        else if (a.Total == b.Total) { return 0; }
        else { return -1; }
    var top = new Array();
    for (var i = 0; i < 3; i++)
    data.groups = top;
  return true;
  1. Or you can filter data with this code sample in Dashboard Designer > Dashboard > Advanced. But it works only for one series, and it depends on your dashboard settings and data.
var handlers = {};
handlers.preRender = function(config, logger) {
 logger.debug('Configuration: ', config);
 config.series.forEach(function(serie){ ={
		 return group.items.length > 2;
 return true;

The second snippet was exactly what I was looking for. It returns all items that have more than 2 submission and filters out the rest. Perfect!

Thank you!

1 Like