Contents page 
  Previous | Next 
 

Tutorial 14 - Printing Charts


Contents

Standard Printing

Simple Print command
Print Orientation
Print Preview
Print Resolution
Greyscale printing

Extended Printing methods

PrintPartial
Printing multiple page Charts
Printing several Charts on one page


Standard Printing

TeeChart Pro offers standard print methods to print the Onscreen Chart 'as is' to the Printer.

Simple Print command

To print a Chart use the Print method. This will print the chart as it appears onscreen.

Example

Chart1.Print;

Print Orientation

The PrintPortrait and PrintLandscape methods allow you to print those orientations even if they are not defined as the default. The default orientation will take effect again after the print is complete. Default Orientation can be changed using the PrintOrientation method. The Orientation method will not print for you. You must run Print after changing the PrintOrientation.

Example

With Chart1 do
begin
  PrintOrientation(poLandscape);
  Print;
end;

Print Preview

The PrintPreview window will show you how the Chart will appear when printed. You may modify print parameters in the Print Preview window before sending the job to the Printer. To call PrintPreview run:

// Add the teeprevi unit to the Uses part of your project
ChartPreview(Self,Chart1);

Print Resolution

Print Resolution refers to the level of Chart detail to be printed and is not to be confused with printer resolution which is defined with your Printer setup in Windows' Print management. TeeChart Print Resolution defines the amount of TeeChart detail to be included in the printed Chart, its Axis scale detail, Gridline frequency, etc. The value range is a percentage from 0-100%.

Example

//this will use screen resolution
Chart1.PrintResolution := 0;
//this will use more printer resolution 
Chart1.PrintResolution := 100; 

Greyscale printing

When printing to Greyscale printers you should take care that the colours of the Chart are easily distinguishable when translated to shades of grey. To help, you could add Brush styles to the Chart Series to more easily distinguish Series when printed.


Extended Printing methods

PrintPartial

Use the PrintPartial method to Print a Chart to a Printer with Control over the dimensions and location on the printed page. PrintPartial doesn't expel the page thus allowing you to print multiple Charts per page. You need to call Delphi's BeginDoc and EndDoc methods to open and close the Printer.

Example
 //Add the Printer unit to the Uses section of your project
 Printer.BeginDoc;
 Chart1.PrintPartial(Rect(0,0,500,300));
 Chart2.PrintPartial(Rect(0,400,900,700));
 Printer.EndDoc;

Printing multiple page Charts

For information about printing multipage Charts (where MaxPointsPerPage is less than the total point quntity) please see the Chart paging tutorial.


Print previewing several Charts on one page

The Print Preview panel now accepts more than one Chart (or TeePanel). Chart positions are controlled setting the PrintMargins property. Use the TeePreviewPanel1.Panels collection to manage the Charts on the Preview page.

  { change margins }
  Chart1.PrintProportional:=False;
  Chart2.PrintProportional:=False;

  Chart1.PrintMargins:=Rect(2,2,60,60);
  Chart2.PrintMargins:=Rect(60,60,2,2);

  { add to preview }
  TeePreviewPanel1.Panels.Add(Chart1);
  TeePreviewPanel1.Panels.Add(Chart2);

Only one Chart may be mousedrag moved on the Previewer at one viewing so you must disable the 1st Chart from view to enable drag repositioning of the 2nd Chart. The TeeChart demo project includes a page with the following code:

  With TeePreviewPanel1 do
  begin
    Panels.Clear;
    if CheckBox1.Checked then Panels.Add(Chart1);
    if CheckBox2.Checked then Panels.Add(Chart2);
    Repaint;
  end;

By selecting one or another of the 2 Checkboxes (when both are showing only the first Chart is moveable) you may reposition both the Charts on the page via mousedrag.





© 1996- Steema Software SL. All rights reserved.