Creating a Column Plot

From Q
Jump to navigation Jump to search

Charts are created in the same way as tables, except that appendPlot replaces appendTable, and the required chart-type needs to be specified:

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 ="Bar/column/line plot");
p.primary = project.dataFiles[0].getQuestionByName('Age');
p.secondary = project.dataFiles[0].getQuestionByName('Gender');

See also