Displaying counts and percentage figures on a bar chart

Bar charts normally display one value per bar. You can choose whether this is:

  • the count (number of respondents who chose that response)
  • the percentage (number of respondents as a percentage of the total)

If you want to display both the counts and the percentage value, you need to pass in the counts and use the Chart Designer to calculate the percentages from the counts.

To ensure that the chart designer uses the number of respondents as its value for 100%, you must pass in a variable or variable code containing that value. This is done by creating a derived variable which has a code that is true for all respondents. This code then has a count value of the number of respondents.

You can then exclude this code from the final bar chart. You can only exclude codes from terms in the Analysis field that have not been transposed.

  1. Click VariablesIcon.png on the Snap toolbar to open the Variables window.
  2. Select the variable you wish to chart. Here we are using Q2.
  3. Click CloneSurveyIcon.png on the Variables window toolbar to create a copy of the variable.
  4. Set the Type to Derived. (The values in this variable are derived from the answers to Q2.)
  5. Set the Name to V2Q2 to remind you that it is derived from Q2.
  6. Set the Response to Multiple, so that you can have more than one code selected.
  7. Select to the Values column for the first code Daily and enter Q2=1
  8. Repeat for the other codes in Q2.
Derived variable to count the number of respondents
  1. Create an additional code and name it Hidden total. Set the value to TRUE.
  2. Click 1 2 3  button on the Variables window toolbar to check the number of responses for the parts of your new variable.
  3. You will get a message warning you that this will cause any changes to be kept. Click OK. The counts are displayed. The count for Hidden total should be the same as the base value in your table.
  4. Click SaveIcon.png to save your variable.

Create the chart

  1. Click AnalysisChartIcon.png on the Snap toolbar to create a chart.
  2. Set the style to Horizontal Bar Counts and set the analysis to V2Q2.
  3. Check Counts.
  4. Click Apply to display your chart.
  5. Double click on the Hidden total bar to open the Chart Designer and check the Exclude series box to stop the display of that bar.
  6. In this type of chart, each of the bar heights is a datapoint in a series. In the left hand pane, double-click Series to open it, then Daily then select Datapoint Labels defaults.
  7. Select the Above Point radio button as the Text Location in the Appearance tab. This specifies where the counts and percentage figures will be placed.
  8. Check Value and Percent under the Datapoint Label. This will display the counts and percentage figures at the end of the bar.
Chart designer showing the label appearance
  1. Repeat for the other series that you wish to display (Twice a week, Weekly and Monthly).
  2. Click Apply to display the new version of the chart.
  3. The percentage values are not correct as they have not been calculated using the Hidden total value. Select Y Axis in the left hand pane of the Chart Designer dialog.
  4. Select the Scale Type tab and select the Percent radio button.
  5. Select Category Maximum as the Percent base. This uses the highest count as the number to calculate the percentages from. In this chart, it is the value in Hidden total, the same as the respondent base.
Chart designer showing the percent scale type
  1. Click Apply.
Bar chart showing counts and percentages for frequency of visit

Further changes can be made using the Chart Designer to give your chart the desired look.

Change the way the labels on the y-axis are displayed

  1. Select Axis Labels under Y Axis in the left hand pane of the Chart Designer dialog.
  2. Select the Format tab in the right hand pane.
  3. Select 0% as the Format Code.
Chart designer showing the axis labels format
  1. If you wish to make the y axis maximum 100%, select Y Axis in the left hand pane.
  2. Clear the Automatic box.
  3. Change the Maximum to 1.
Chart designer showing the value scale
  1. Click OK.
Chart showing counts and percentages for frequency of visit
Contents