Likert Scale Chart (stacked bar chart)

 

 

 

A Likert scale is a rating scale used to measure opinions, attitudes, or behaviors. It consists of a statement or a question, followed by a series of five or seven answer statements. Respondents choose the option that best corresponds with how they feel about the statement or question.

 

Aggregation Structure:

Basic Settings

  1. Use the Advanced mode of the aggregation editor

  2. Select the relevant data collection

  3. Name the aggregation

  4. Make sure the Single Result / Einzelergebnis is turned off

 

Aggregation

 

Group Stage #1

{ "_id": "$answers.massnamenwirksamkeit43.answers.gradNr", "count": { "$sum": 1 }, "Massnahmenwirksamkeit": { "$first": "$answers.massnamenwirksamkeit43.answers.grad" } }

 

Group Stage #2

{ "_id": "", "values": { "$push": { "entry": { "k": "$Massnahmenwirksamkeit", "v": "$count" } } } }

 

Project

{     "_id": 0,     "values": {         "$arrayToObject": {             "$map": {                 "input": "$values",                 "as": "current",                 "in": "$$current.entry"             }         }     } }


Replace Root

 

Filter:

Select any filters that are relevant.

 

Lookup Paths:

 

Chart configuration (Editor)

The configuration below is the configuration of the chart shown in the example above. Not all elements used in the configuration are necessary.

Essential are:

  • indexBy: ‘value’

  • layout: ‘horizontal’

  • groupMode: ‘stacked’

  • keys and legend section as shown below, (with the keys adapted to your relevant language)

Displaying multiple likert scale charts in one widget:

If you wish to display multiple likert scale charts in one widget because they belong together in a survey, for example, you can use a calculation to display them together.

Calculation

In the widget editor select the chart type “Bar Chart”, then click on Calculation / Berechnung, and add a new calculation:

 

When you are in the Calculation Editor follow these steps:

  1. Name your aggregation

  2. Add the relevant aggregations to the calculation and give a code to each.
    Best practice: Do not use upper-case letters or numbers in the beginning

  3. Use the scrip in the image to add and display the aggregations together.

  4. Keep in mind, the aggregation in line 3 will be displayed in the bottom of the chart and the last one, in this case line 9 (koopbegr) will be displayed at the top of the chart.

  5. Click “Preview” or “Vorschau” to see if it works.

  6. Click “Save as new” or “Speichern als neu”.

Chart configuration (Editor)

The chart configuration functions the same as if you used a single aggregation, so feel free to use the chart configuration posted above and adapt it to your preferences.