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).

This worksheet explains how to create a bar chart that shows both the counts and the percentage values on a single chart:

Note: To show either counts or percents on a bar chart, use the preconfigured chart styles supplied with Snap: Bar Counts Labelled or Bar percent labelled.

### Background

Bar charts are different from tables because you can only display one value for each bar (the height of the bar on the scale).

You can represent counts and percentage values together in a table.

For a bar chart, the height of the bar must be either the counts or the percentage. 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.

### More about the bar chart styles

The examples below use the Bar 2D style to display an item in the Analysis field.

If you enter a term in the Analysis field, the Snap bar chart styles identify the separate items by colour, and use a key to tell you which bar is associated with which question or question code.

If you enter a term in the Break field, the Snap bar chart styles identify the separate item by labelling the X-axis below the bars. (This also happens if you enter the term in the Analysis field and check Transpose.)

You can enter analysis terms in both the Analysis and the Break fields (as for a cross-tabulation) and see the results displayed as a bar chart.

If you are only using a single term, you can choose whether to have your bars identified by a colour key or labelled.

If you want your chart to give the exact values for each bar, you can display them on the chart.

Bar chart of counts using the Bar 2D Transposed Labelled style. The term is in the Analysis field and the Transpose box is checked.

When you display a percentage, you need to know what it is a percentage of. The base percents shown in the table are calculated as the percentage of all the respondents that gave that response.

If you are charting a single-response question, the total number of responses is probably the same as the number of respondents. If you are charting a multi-response question, there will be more responses than respondents.

The Chart Designer can’t work out how many respondents there are from the number of responses, so it can’t calculate the percentages automatically. You must tell it.

### Step 1: Creating a table of the analysis

1. Open the snCrocodile survey supplied with Snap.
2. Click  on the Snap toolbar to create a table.
3. Set the analysis to q2.
4. Check Counts and Base Percents.

5. Click [Apply] to display your table. You can use this to confirm that you have displayed the correct values on the chart.

1. Click  on the Snap toolbar to create a chart.
2. Set the style to Bar 2D and set the analysis to q2.

3. Click [Apply] to display your chart.

This shows a basic bar chart with no figures displayed on the bars.

4. Download this style (`Bar 2D percentage not set.csf`) and save it to a known place.
5. Click  on the chart toolbar to open the Results Definition dialog.
6. Browse for the downloaded style and click [Apply] to apply it to your chart. The style displays counts and percentages on the bars.

7. Compare the percentage figures on the chart to the figures on the table. You will see that they do not match. This is because the figures on the chart are calculated automatically using the size of the largest bar. To make the figures display correctly, you need to tell the Chart Designer what the base figure is that it should use to calculate the percentages.
8. Double-click the y-axis of the chart to open the Y Axis section of the chart designer.

9. The scale is set automatically. Clear the Automatic check box.
10. Set the Maximum value to the respondent base for your survey (205 for snCrocodile).
11. Click [Apply] to update the chart.

The percentage values displayed on the chart are now correct.

12. The y axis uses the base figure as a maximum. If you wish to hide the y axis, clear the Show box on the Chart Designer dialog.

13. Click [Apply]. The percentages remain correct, but the Y axis is no longer shown.

### Step 3: Creating your own version using a single colour

1. Click  on the Snap toolbar to create a chart.
2. Set the style to Bar 2D and set the analysis to q2.
3. Check Counts and Transpose.
4. Click [Apply] to display your chart.

5. Double click on one of the bars to open the Chart Designer dialog for the Series.
6. In this type of chart, each of the bar heights is a datapoint in a series. In the left hand pane, work through the Series and select the Datapoint Labels defaults.

7. Select the Base 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.

9. Click [Apply] to display the new version of the chart.
10. As before, the percentage values will not be correct. Select Y Axis in the left hand pane of the Chart Designer dialog.
11. Clear the Automatic check box and set the Maximum to 205.
12. Click [Apply].
13. The chart appears with an unnecessarily precise Y-axis labelling.

You can stop displaying the y-axis by clearing the Show box change the number of grid divisions to a factor of 205 (e.g. 5), so that no decimal places are needed. You do this by setting the value in the Major box under Divisions.

Change the display of the labels so they do not show decimal places.

### To change the way the labels on the y-axis are displayed

1. Select Axis Labels under Y Axis in the left hand pane.
2. Select the Format tab in the right hand pane.
3. Select 0 as the Format Code.

4. Click [OK].

You can save the chart style that you have just created by right-clicking the chart and selecting Save Style… from the context menu.

### Conclusion

This worksheet has explained why you cannot use a generic style to display both counts and correct percentages on a bar chart. It has also explained some of the conventions used in the Snap bar chart styles.

To find out more about how the Chart Designer works, see the section Charts in Detail in the user manual or the online help. It is available on the web at https://www.snapsurveys.com/help/#22815

There is a description of the functions of the Chart Designer dialogs in the topic Options and Tabs in Chart Designer in the reference manual and online help. It is available on the web at https://www.snapsurveys.com/help/index.htm#17713.

There is a worksheet on creating your own chart styles: Giving a consistent look and feel to all your charts.

If there is a topic you would like a worksheet on, email to snapideas@snapsurveys.com