# Visualization - Column - Column

A column chart presents categorical data with vertical rectangular bars representing the values or proportions

A Column Chart presents categorical data with vertical rectangular bars representing the values or proportions. They are useful for visualizing discrete categories of data.

## Examples

The examples below use data from a soft drink tracking study. The following visualizations show the cola preferences of respondents, using the following tables.

Gender distribution table Gender-Cola crosstab

The first example uses the first table, and the remaining examples use the second table.

## Basic Column Chart

The simplest form of a column chart is one that visualizes a single variable. The example below shows the proportion of males and females in a study.

### Create a Simple Column Chart in Displayr

1. Go to Insert > Visualization > Column Chart
2. Under Inputs > DATA SOURCE > Output in ‘Pages’, select your table from the dropdown menu
Note: If you don’t have a table, you can instead select variables from Inputs > DATA SOURCE > Variables in "Data"

## Clustered Column Chart

The clustered column chart compares the values of different categories of two or more groups, displaying the grouped columns alongside each other. The example below shows the soft drink preferences of both males and females.

### Create a Clustered Column Chart in Displayr

1. Go to Insert > Visualization > Column Chart
2. Under Inputs > DATA SOURCE > Output in ‘Pages’, select your table from the dropdown menu

## Stacked Column Chart

The stacked column chart is similar to the clustered column chart, except the columns are stacked on top of each other rather than grouped side-by-side. The example below presents the same information as the clustered column chart above, but it stacks and color-codes the values for males and females.

### Create a Stacked Column Chart in Displayr

1. Go to Insert > Visualization > Column Chart
2. Under Inputs > DATA SOURCE > Output in ‘Pages’, select your table from the dropdown menu
3. Under Inputs > OUTPUT, check Stack series

## 100% Stacked Column Chart

A 100% stacked column chart rescales the values of each stacked column so that they all add up to 100%, presenting the values as a proportion of the whole. The example below turns the stacked column chart from above into a part-of-whole comparison.

Note that in the example below, the table the visualization is based on has the cell calculations set to Row %, rather than Column %. This lets us look at the proportions within each row, rather than each column. This can be found in the Inputs > STATISTICS > Cells dropdown.

### Create a 100% Stacked Column Chart in Displayr

1. Go to Insert > Visualization > Column Chart
2. Under Inputs > DATA SOURCE > Output in ‘Pages’, select your table from the dropdown menu
3. Under Inputs > OUTPUT, check Stack series
4. Under Inputs > DATA MANIPULATION, check Convert to percentages/proportions

## Object Inspector Options

The following is an explanation of the options available in the Object Inspector for this specific visualization. Refer to Visualization Options for general chart formatting options.

### Inputs

DATA SOURCE - SECOND Y AXIS
Second Y Axis This supports all of the usual data input types. The columns in the input data will be shown as lines on the column chart (see Example 3). Once data is provided, controls for further other data manipulations will be shown. In particular, COLUMN MANIPULATIONS - SECOND Y AXIS > Column labels can be used to modify the names of the data series in the chart. Controls to customize the appearance of the lines and to data labels are shown in Chart > DATA SERIES.
DATA SERIES
Opacity Controls the opacity of the bars
Line shape of secondary data Controls the shape of the lines. When the line shape is set to Curved, spline interpolation is used to smooth the lines between data points.
Line type of secondary data can be one of "Solid", "Dot" and "Dash".
Line thickness of secondary data Thickness of the lines in pixels. When there are multiple data series in the chart, a comma-separated list of values can be used instead of a single numeric value. Values will be recycled if there are fewer values than the number of data series.
Show markers on line If selected, markers will be placed at the specific data points. The colors of the markers are set to be same as the as the data series, but the marker symbol and marker size can be adjusted.
Show data labels for secondary data If shown, data label will be added to the lines showing the secondary data. By default, the data labels are colored the same as the data series.

### Chart

APPEARANCE
Gap between bars Specify the amount of space between bars on adjacent positions in the x-axis, as proportion of the available space. Values can range from 0 (no gaps) to 0.99 (bars are shown as lines).
Gap between grouped bars Specify the amount of space between bars located on the same x-axis position, as a proportion of the available space. Note that this parameter has no effect if there is only one series, or if the chart is a Stacked Column Chart or Small Multiple.
Vertically center data labels If selected, data labels in stacked column charts are placed in the middle of the column; the alternative is to have the data labels placed at the top of the column.
SECOND VALUES (Y) AXIS
These controls in the Chart tab allow customization of the Y axis on the right for the second data set.

What is a column chart?
How to make a column chart
How to add a line to a column chart
Customizing colors within a series on a column chart
Using sparklines to augment column charts

## Code

{
"formChartType": "Column",
"formStackSeries": false,
"formSmallMultiples": false,
"formAsPercentages": false,
"formScatterLabelType": "As hover text"
}