Introduction
This article describes how to show data from two different table types: SUMMARY tables and crosstabs...
...as a column chart.
Method
One column table
- From the toolbar select Create > Charts > Visualization > Column > Column
- In the object inspector, under Inputs > DATA SOURCE > Output select the table that you wish to chart.
- Click Calculate and/or ensure that Automatic is checked.
Multi-column table
- From the toolbar select Create > Charts > Visualization > Column > Column.
- In the object inspector, under Inputs > DATA SOURCE > Output select the table that you wish to chart.
- Underr Inputs > COLUMN MANIPULATIONS > Columns to show enter the label or index of the column. In this example, "Diet Coke" was entered. Alternatively, the number 2 could have been entered (the index of the second column on the table).
- Click Calculate and/or ensure that Automatic is checked.
Column Chart from a Variable
As an alternative to bullet 2, above, you can drag a variable from the Data Sets tree on the left into the DATA SOURCE > Variables box.
Creating a Column Plot from code
This example uses C:\Program Files\Q\Examples\Phone.sav (this may be located on a different place on your computer depending upon how Q was installed).
// Working on Phone.sav, this creates a new column plot of Age broken down by Gender.
var p = project.report.appendPlot("Bar/column/line plot");
p.primary = project.dataFiles[0].getQuestionByName('Age');
p.secondary = project.dataFiles[0].getQuestionByName('Gender');
NEXT
How to Create PowerPoint Chart Templates
How to Create a Chart via QScript
How to Create Several Column Charts Using Small Multiples
How to Create a Stacked Column Chart in Q