Printing a Graph


Products: Statit e-QC, Statit e-Server, Statit Custom QC

Interactive

To print a Statit graph, you have three options. First, bring the Graph window in focus; that is, click on the graph window or select it so that it is in the foreground and highlighted. Then use one of the following:

  • The menu selection File|Print;
  • The command key shortcut Shift-Ctrl-p; or
  • The Printer icon in the Toolbar window.

Any of these selections will present you with the standard print dialog from which you can control the printing of the graph.

From A Macro

To print the current graph from a macro, use the command:

printgraph

This command will only print the most recent graph, and it will print it only to the default printer.

Controlling Graph Appearance

Page Setup
Under the menu tree File|Page Setup you have several controls over the appearance of the graph on the printer page:

Paper
Depending upon the default printer installed on your system, you may have control of the paper size and source. These are the same options you may control from the print dialog.
Orientation
Control the orientation of the graph. (Even though the example displayed shows text, the graph will be printed.)
Margins
When you disable the Option, "Use full page," you may control the margins between the graph and the edge of the page.
Note: The values are displayed with quotation marks to indicate inches are the units which are used. You do not need to type in the quotation marks when you change values, that will be done automatically for you.
Options
Maintain Aspect Ratio: When checked, the aspect ratio of the Graph window will be maintained in printing. When not checked, the aspect ratio is controlled by the Margins or the Use Full Page option.
Use Full Page: When checked, the graph will be printed to fill the page on the printer. When not checked, the Margins and Maintain Aspect Ratio option will be used to determine the size and shape of the printed graph.
Center On Page: When checked, the graph will be centered on the page, both horizontally and vertically. When not checked, the graph will be placed in the upper left on the page, as determined by the Margins and the Use Full Page option.

Graphics Options
Under the menu tree Options|Graphics, note the selection for Minimum Font Size. This setting is for the minimum font size you will see on your display. However, it does not control the minimum font size on the printer.

The command

setgraph /fontsize=n

may be used to set the minimum text font size to n.

If you are doing custom graphics, you may control the minimum font size with the command

textmin [on|off] /size=n

This command will turn text clamping (the enforcement of a minimum font size) on or off, and when turned on, what the minimum font size is. These settings only affect the current graph. You should also be aware that text clamping is enforced on many standard Statit charts.

Page Setup And Your Registry
If you are developing a macro or proc which prints a graph, you may require specific settings for the Page Setup options in order to get a consistent look to the printed graphics. If you do not control these settings, different users with differing settings will print graphs which look different. At this time there is no direct way to do this, except by controlling the Windows registry settings for these attributes.

Prior to doing any registry modification, please note the implications this has on the operation of your computer system. An incorrect modification of your registry could result in the failure of software to function correctly, and may require the re-installation of software, including your operating system. You should have a good understanding of the Windows registry before proceeding.

In good programming style, you should design your code in four steps:

1. Get and save current settings.
2. Set the values you want.
3. Print the graph.
4. Restore the original settings.

Statit maintains the Page Setup settings under the HKEY_CURRENT_USER key. You can get the current values of these settings with the getprofileint() function. Here is an example for a macro which gets the settings and stores them into three Statit temporary variables:

call getprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Aspect Ratio",$aspectratio)
call getprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Full Page",$fullpage)
call getprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Center",$center)

Note: The semi-colon (;) is for line continuation in a macro. The Microsoft registry is case insensitive, but you may prefer to follow the case displayed in regedit or regedt32. The four parameters to the getprofileint() function are the registry key, the path, the name of the value, and a temporary variable into which the value is written. The path in this example is typical, but is dependent upon the Statit installation.

You can change the values of these settings by using the writeprofileint() function. Here are examples of writeprofileint() functions which turn off the Option for Maintain Aspect Ratio, and turn on the Options for Use Full Page, and Center On Page. The option is turned off if the fourth parameter is 0, or turned on if the fourth parameter is 1.

call writeprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Aspect Ratio",0)
call writeprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Full Page",1)
call writeprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Center",1)

Step 3 is to print the graph:

printgraph

In the fourth and final step, restore the registry settings to their original values. Do this by using the temporary variables which contain the original values:

call writeprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Aspect Ratio",$aspectratio)
call writeprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Full Page",$fullpage)
call writeprofileint ("hkey_current_user",;
"software\statware\statit 5.2\graphics printing",;
"Center",$center)

If you are interested in setting other registry values, use the MS Windows commands regedit or regedt32 to investigate what these values might be.

If you would like additional information, please contact our Support staff at statit.support@acs-inc.com.