Creating a Column Plot
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 = project.report.appendPlot("Bar/column/line plot"); p.primary = project.dataFiles.getQuestionByName('Age'); p.secondary = project.dataFiles.getQuestionByName('Gender');
- Next worked example.
- Preliminary Project Setup - Summary Plots for a script that generates summary charts for each question in your project.
- QScript for an explanation of how to run this code.
- QScript Examples Library for other examples.
- QScript Reference for technical information.