PRINT-CHART

Syntax

PRINT-CHART[chart_name]position DATA-ARRAY-ROW-COUNT={x_num_lit|_var|_col} DATA-ARRAY-COLUMN-COUNT={x_num_lit|_var|_col} DATA-ARRAY=array_name [DATA-LABELS=data_labels_lit | _var | _col] [COLOR-PALETTE=color_palette_lit | _var | _col]] [ITEM-COLOR=(Chart_item_keyword, txt_lit |var | (r,g,b))] [DATA-ARRAY-COLUMN-LABELS={NONE|array_name| {({txt_lit|_var}[,{txt_lit|_var}]...)}}] [CHART-SIZE=(chart_width_num_lit|_var, chart_depth_num_lit|_var)] [TITLE={title_txt_lit|_var|_col}] [SUB-TITLE={subtitle_txt_lit|_var|_col}] [FILL={fill_lit|txt_var|_col}] [3D-EFFECTS={3d_effects_lit|txt_var|_col}] [BORDER={border_lit|txt_var|_col}] [POINT-MARKERS={point_markers_lit|txt_var|_col}] [TYPE={chart_type_lit|txt_var|_col}] [LEGEND={legend_lit|txt_var|_col}] [LEGEND-TITLE={legend_title_txt_lit|_var|_col}] [LEGEND-PLACEMENT={legend_placement_lit|txt_var|_col}] [LEGEND- PRESENTATION={legend_presentation_lit|txt_var|_col}] [PIE-SEGMENT-QUANTITY-DISPLAY=    {pie_segment_quantity_display_lit|txt_var|_col}] [PIE-SEGMENT-PERCENT- DISPLAY={pie_segment_percent_display_lit |txt_var|_col}] [PIE-SEGMENT-EXPLODE={pie_segment_explode_lit |txt_var|_col}] [X-AXIS-LABEL={x_axis_label_txt_lit|_var|_col}] [X-AXIS-MIN-VALUE={x_axis_min_value_lit|_num_lit|_var |_col}] [X-AXIS-MAX-VALUE={x_axis_max_value_lit|_num_lit|_var  |_col}] [X-AXIS-SCALE={x_axis_scale_lit|txt_var|_col}] [X-AXIS-MAJOR-TICK-MARKS={x_axis_major_tick_marks_lit |txt_var|_col}] [X-AXIS-MINOR-TICK-MARKS={x_axis_minor_tick_marks_lit |txt_var|_col}] [X-AXIS-MAJOR-INCREMENT={x_axis_major_increment_lit |_num_lit|_var|_col}] [X-AXIS-MINOR-INCREMENT={x_axis_minor_increment_lit |_num_lit|_var|_col}] X-AXIS-TICK-MARK-PLACEMENT= {x_axis_tick_mark_placement_lit|txt_var|_col}] [X-AXIS-GRID={x_axis_grid_lit|txt_var|_col}] [Y-AXIS-LABEL={y_axis_label_lit|txt_var|_col}] [Y-AXIS-MIN-VALUE={y_axis_min_value_lit|_num_lit |_var|_col}] [Y-AXIS-MAX-VALUE={y_axis_max_value_lit|_num_lit |_var|_col}] [Y-AXIS-SCALE={y_axis_scale_lit|txt_var|_col}] [Y-AXIS-MAJOR-TICK-MARKS={y_axis_major_tick_marks_lit |txt_var|_col}] [Y-AXIS-MINOR-TICK-MARKS={y_axis_minor_tick_marks_lit |txt_var|_col}] [Y-AXIS-MAJOR-INCREMENT={y_axis_major_increment_lit |_num_lit|_var|_col}] [Y-AXIS-MINOR-INCREMENT={y_axis_minor_increment_lit |_num_lit|_var|_col}] [Y-AXIS-TICK-MARK-PLACEMENT=    {y_axis_tick_mark_placement_lit|txt_var|_col}] [Y-AXIS-GRID={y_axis_grid_lit|txt_var|_col}]

Note:

If you do not define CHART-SIZE with this command, you must define it with DECLARE-CHART.

Description

Prints a chart. Only PostScript printers or HP printers that support HPGL (generally, this is HPLaserJet 3 and higher) render chart output.

The PRINT-CHART command directs SQR to generate a chart according to the named chart, if any, and the overridden attributes, if any.

Note:

PRINT-CHART can be used without referencing a named chart if all required attributes for the DECLARE-CHART are supplied in addition to all its required parameters. The PRINT-CHART command directs SQR to display the chart on the current page using the attribute values at the moment the command is executed. Manipulation of chart attribute values has no effect on the appearance of the chart after the PRINT-CHART command has been executed. For example, if you execute a PRINT-CHART with TITLE=$ttl and $ttl='Encouraging Results', and then change the value of $ttl to 'Discouraging Results' immediately afterward, then the chart is printed with first value, 'Encouraging Results'. PRINT-CHART expects the DATA-ARRAY to be organized in a particular way. See the Chart Array Field Types (fewer than four fields) table for details. PRINT-CHART fills the area defined by CHART-SIZE as much as possible while maintaining an aesthetically pleasing ratio of height to width. In cases in which the display area is not well suited to the chart display, the chart is centered within the specified region, and the dimensions are scaled to accommodate the region. Do not be alarmed if the chart does not fit exactly inside the box that you have specified. It means that SQR has accommodated the shape of the region to provide the best looking chart possible. Chart commands used to send output to a line printer are ignored. Only PostScript printers or HP printers that support Hewlett Packard's HPGL (generally, this is HP LaserJet model 3 and higher) render chart output. If you attempt to print a chart to a LaserJet printer that does not support HPGL, the HPGL command output might become part of your output, leaving one or more lines of meaningless data across your report.

All the attributes defined for DECLARE-CHART are valid for the PRINT-CHART command. PRINT-CHART has five additional parameters. The position of the chart is described with the first parameter. The data that supports the chart is defined in the additional attributes: DATA-ARRAY, DATA-ARRAY-ROW-COUNT, DATA-ARRAY-COLUMN-COUNT, and DATA-ARRAY-COLUMN-LABELS.

As mentioned, each chart type meets a specific organizational requirement. The Chart Array Field Types (fewer than four fields) table describes these requirements.

Note:

If the first field in the array designated by DATA-ARRAY is of type CHAR, then the value on the x-axis is the contents of that column. If the first field is not of type CHAR, then the value of the x-axis is the row number of the array designated by DATA-ARRAY, beginning with 1. Pie charts show the character value in the legend area. Histograms show the character value on the y-axis. XY-Scatter charts do not use the character value and none is needed in the array.

Note:

If a PIE chart contains many small slices, the user must set the PIE-SEGMENT-QUANTITY-DISPLAY argument, the PIE-SEGMENT-PERCENT-DISPLAY argument, or both to NO to prevent the values from one slice overwriting the values of another slice.

Chart Type Field 0 Field 1 Field 2 Field 3

PIE

Type=char Pie segment labels, the names associated with each segment

Type=num The value associated with each pie segment

(Optional) Type=char Pie segment explode flag setting, 'Y' or 'N'

 

LINE BAR STACKED-BAR 100%-BAR OVERLAPPED-BAR HISTOGRAM AREA STACKED-AREA 100%-AREA

Type=char X-Axis values

Type=num Series 1 Y-Axis values

(Optional) Type=num Series 2 Y-Axis values

(Optional) Type=num Series 3… Y-Axis values

XY-SCATTER-PLOT

Type=num Series 1 X-Axis values

Type=num Series 1 Y-Axis values

(Optional) Type=num Series 2 X-Axis values

(Optional) Type=num Series 2 ... Y-Axis values

FLOATING-BAR

Type=char X-Axis values

Type=num Series 1 Y-Axis offset

Type=num Series 1 Y-Axis duration

(Optional) Type=Num Series 2 ... Y-Axis offset

Chart Type Field 0 Field 1 Field 2 Field 3 Field 4

HIGH-LOW-CLOSE

Type=char X-Axis values

Type=num High value

Type=num Low value

Type=num Closing value

(Optional) Type=num Opening value

Parameters

Parameter Description

chart_name

Specifies the name of the chart from the DECLARE-CHART command. This name is not necessary if you specify the CHART-SIZE and all other pertinent attributes in the PRINT-CHART command.

Position

(row, column) Specifies the position of the upper left corner. Position parameters can be relative. See the POSITION command for examples of relative positioning. Document markers are not allowed. After execution, the current position is returned to this location; however, the next listing line is the next line below the bottom of the chart area. (This is different from the way the PRINT command works.)

DATA-ARRAY

Specifies the name of the array containing the data to be plotted. This must be the name of an array defined with CREATE-ARRAY.

DATA-ARRAY- ROW-COUNT

Specifies the number of rows or sets of data to be used from the DATA-ARRAY. If the DATA-ARRAY has a greater number of rows, only DATA-ARRAY-ROW- COUNT is included in the chart.

DATA-ARRAY- COLUMN-COUNT

Specifies the number of columns to be used from the DATA-ARRAY. If the DATA-ARRAY has a greater number of columns, only DATA-ARRAY- COLUMN-COUNT is included in the chart.

DATA-ARRAY- COLUMN-LABELS

Specifies labels for each Y-Axis value of the data set (fields) in DATA-ARRAY. These labels are displayed in the legend box. Column labels are ignored for pie charts. See the Chart Array Field Types (fewer than four fields) table for applicable fields for each type of chart.

For definitions of the other arguments, see the DECLARE-CHART Command Arguments table.

Example

In this example, a pie chart is printed without explicit reference to a chart declared with DECLARE-CHART. All necessary arguments must be supplied in PRINT-CHART.

.
.
create-array
      name=unit_sales
      size=12
      field=product:char
      field=units:number
      field=explode:char
.
.
print-chart (15, 20)
   title                    = 'Green City Store Sales'
   sub-title                = '(Second Quarter)'
   chart-size               = (50, 28)
   type                     = pie
   data-array               = unit_sales
   data-array-column-count  = 3
   data-array-row-count     = 7
   3d-effects               = yes
   fill                     = color

See DECLARE-CHART