Skip to main content
All docs
V23.2

TdxChartControlReportLink Class

A report link that associates a Chart control with a TdxComponentPrinter component.

Declaration

TdxChartControlReportLink = class(
    TdxCustomChartControlReportLink
)

Remarks

The TdxChartControlReportLink class implements the functionality required to print diagrams displayed in a Chart control.

VCL Printing System: A Chart Control Print Preview Example

To be able to print a Chart control or export its content to a PDF document, you need to create a report link to associate the control with a TdxComponentPrinter component in your application.

Main API Members

The list below outlines key members of the TdxChartControlReportLink class that allow you to define how the Chart control is printed and exported to PDF.

Caption | Description
Specify caption and description for the report link.
IsCurrentLink
Allows you to identify if the report link is active.
ShowPageHeader | ShowPageFooter
Specify if page headers and footers are visible.
DesignReport | ShowDesigner
Invoke the Report Designer dialog.
ReportTitle | ReportTitleMode | ReportTitleText
Allow you to add a custom title to printed pages.
PrinterPage
Provides access to printer page settings.
PreviewExists
Identifies whether the Print Preview dialog is visible.
Preview
Invokes the Print Preview dialog.
PDFExportOptions | ExportToPDF
Allow you to configure PDF export settings and export Chart content to a PDF document.
PageSetup | PageSetupEx
Invoke the Page Setup dialog.
Print | PrintEx | PrintPages | PrintPagesEx
Print the associated Chart control.

To create a report link for a Chart control at design time, add a TdxComponentPrinter component to a form. Double-click the component to invoke the Report Links editor dialog.

VCL Printing System: An Empty Report Links Editor

This dialog allows you to manage all report links in your application. Click the Add… button to invoke the Add Link dialog.

VCL Printing System: The Add Link Dialog

The Available Source(s) box lists all controls for which you can create a report link. Select the target Chart control and click the OK button to create a report link (a TdxChartControlReportLink class instance) for the control in the TdxComponentPrinter component.

VCL Printing System: The Report Links Editor with a Chart Control Report Link

Close the Report Links dialog. Now you can use report link and component printer APIs to print Chart control content and invoke the Print Preview dialog for the control.

To delete an existing report link at design time, double-click the TdxComponentPrinter component to invoke the Report Links editor dialog.

VCL Printing System: Delete an Existing Report Link

Select the required report link in the Available Source(s) box and click the Delete button.

You can manage report links in a component printer, configure print settings, and execute any print and export operations in code.

The following code example creates a report link for an existing Chart control, customizes report link settings, exports control content to a PDF document file, and deletes the created report link:

var
  AReportLink: TBasedxReportLink;
begin
  // Creates a Chart control report link
  AReportLink := dxComponentPrinter1.AddEmptyLinkEx(TdxChartControlReportLink, dxChartControl1);
  try
    AReportLink.PDFExportOptions.JPEGQuality := 80;  // Adjusts the JPEG compression rate for export
    AReportLink.PDFExportOptions.OpenDocumentAfterExport := True; // Opens the resulting document after export
    AReportLink.ExportToPDF;  // Invokes "PDF Export Options" and "Save As" dialogs
  finally
    dxComponentPrinter1.DeleteLink(dxComponentPrinter1.LinkCount - 1); // Deletes the report link after export
  end;
end;

VCL Printing System: A PDF Document with Exported Chart Content

To see the Chart print functionality in action, run the Chart Control demo in the VCL Demo Center installed with compiled VCL DevExpress demos. Click the Print or Print Preview bar button to invoke the corresponding dialog.

Download: Compiled VCL Demos

Tip

You can find full source code for the installed compiled Chart control demo in the following folder:

%PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressChart

See Also