Sorting in SurveyJS Dashboard

Sorting is an interactive feature that allows users to reorder answers based on response count, either in ascending or descending order.

Sorting in SurveyJS Dashboard

By default, answers are displayed in the order defined in the survey JSON schema.

View Demo

Supported Visualization Types

Sorting is available for the following visualization types:

Enable or Disable Sorting

Sorting is enabled by default. To disable it for the entire dashboard, set the allowSortAnswers property to false when creating a Dashboard instance:

import { Dashboard } from "survey-analytics";

const dashboard = new Dashboard({
  questions: [ /* Survey questions to visualize */ ],
  data: [ /* Survey responses to aggregate */ ],
  items: [ /* Dashboard item configurations */ ],
  allowSortAnswers: false // Disables sorting globally
});

To override this setting for a specific dashboard item, configure the allowSortAnswers property in its visualizer object. Item-level settings take precedence over the global configuration.

import { Dashboard } from "survey-analytics";

const dashboard = new Dashboard({
  questions: [ /* ... */ ],
  data: [ /* ... */ ],
  allowSortAnswers: false, // Disable sorting globally
  items: [
    {
      name: "question1",
      visualizer: {
        allowSortAnswers: true // Re-enable sorting for this item
      }
    },
    // ...
  ]
});

Apply Sorting Programmatically

To define a sort order in code, set the answersOrder property to "asc" or "desc". You can specify this property globally in the IDashboardOptions configuration object or override it for individual dashboard items via the visualizer object. Item-level settings take precedence.

import { Dashboard } from "survey-analytics";

const dashboard = new Dashboard({
  questions: [ /* ... */ ],
  data: [ /* ... */ ],
  answersOrder: "asc", // Apply ascending sort globally
  items: [
    {
      name: "question1",
      visualizer: {
        answersOrder: "desc" // Override with descending sort for this item
      }
    },
    // ...
  ]
});

Other Interactive UI Features

Send feedback to the SurveyJS team

Need help? Visit our support page

Your cookie settings

We use cookies to make your browsing experience more convenient and personal. Some cookies are essential, while others help us analyse traffic. Your personal data and cookies may be used for ad personalization. By clicking “Accept All”, you consent to the use of all cookies as described in our Terms of Use and Privacy Statement. You can manage your preferences in “Cookie settings.”

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.