Skip to main content Skip to complementary content

Visualizing variations from a reference point in a bar chart

In this example, you will create a horizontal stacked bar chart to present results from a customer satisfaction survey. The goal is to visualize data as positive or negative variations from 0, the fixed reference point.

Completed bar chart displaying survey results

Completed bar chart showing survey results for happiness scores by country

What you will do

In this example, you will use survey data in a bar chart to rank overall satisfaction by customer. The data shows the satisfaction levels of each customer with an organization's products and services. Data is organized by survey batch and outlines what percentage of each customer's representatives fall into each of the predefined satisfaction levels grouped by the survey:

  • Always

  • Most of the time

  • Sometimes

  • Rarely

  • Never

  • Unknown

In the data, the fixed reference point 0 is the most neutral satisfaction score. Positive and negative variations from this reference point indicate higher and lower customer satisfaction, respectively.

Preparations

Create a new app and paste the Example load script into a new section in the Data load editor. Then, load the data.

After loading the data, switch to sheet view.

Example load script

Part 1: Create a master dimension

Before creating the bar chart, add a master dimension to set the specific colors needed in the chart. The colors can range from red to green as customer satisfaction scores increase.

  1. Click Master items Master items in the assets panel.

  2. Click Create new next to Dimensions to add a master dimension.

  3. Select Satisfaction_Level in the left side panel.

  4. Under Name, enter Satisfaction Level.

  5. Click Create.

  6. Select the master dimension in the Dimensions list and click Edit. Click Continue.

  7. In the dialog, switch to the Value colors tab.

  8. In the list of field values, assign the following hex codes for each respective value:

    • Always: 276e27
    • Most of the time: 46c646
    • Never: f93f17
    • Rarely: f8981d
    • Sometimes: ffcf02
    • Unknown: b0afae

Part 2: Configure chart data

  1. Drag a bar chart onto the sheet.

  2. Add Customer as the first dimension.

  3. Add the Satisfaction Level master dimension as the second dimension.

  4. Add the following measure:

    avg(Satisfaction_Value)*Satisfaction_Sign/100
  5. For the measure you just added, enter Score as the Label.

Part 3: Configure sorting

Sort the data in the chart to reflect the balance between survey results and the meanings of the satisfaction ranks. Additionally, use the Satisfaction_Order field, which presents each of the satisfaction ranks in numeric order, to sort how the dimension values are stacked.

  1. In the properties panel, expand Sorting.

  2. Expand Customer.

  3. Set Sorting to Custom, and check the Sort by expression checkbox.

  4. Use the following Expression:

    avg(Satisfaction_Value*Satisfaction_Score)
  5. Change the sorting to Descending.

  6. Uncheck the Sort numerically and Sort alphabetically checkboxes.

  7. Expand Satisfaction Level.

  8. Set Sorting to Custom, and check the Sort by expression checkbox.

  9. Use the following Expression:

    sum(Satisfaction_Order)
  10. Uncheck the Sort numerically and Sort alphabetically checkboxes.

  11. Expand Score.

  12. Set Sorting to Custom.

  13. Uncheck the Sort numerically and Sort alphabetically checkboxes.

Part 4: Configure presentation

Now that the data and sorting have been defined, adjust the presentation of the chart.

  1. In the properties panel, expand AppearanceGeneral.

  2. Add the Title Customer Satisfaction.

  3. Expand AppearancePresentation.

  4. Switch from Grouped to Stacked presentation.

  5. Switch from Vertical to Horizontal orientation.

  6. Turn Value labels on.

  7. Turn Segment labels on.

  8. Turn Total labels on.

  9. Click Palette Styling.

  10. Under General, set the Title font size to 22px.

  11. Under Chart, set the following properties:

    • For Axis title, set the font size to 18px.

    • For Axis label, set the font size to 18px.

    • For Value labels, set the font size to 16px.

    • For Legend title, set the font size to 18px.

    • For Legend labels, set the font size to 16px.

  12. Expand AppearanceColors and legend.

  13. Set Colors to Custom.

  14. In the drop down menu, select By dimension and ensure the Satisfaction Level dimension is selected.

Results

The completed bar chart should look like the following.

Completed bar chart displaying survey results

Completed bar chart showing survey results for happiness scores by country

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!