rvdxchart TRVReportDxChart [VCL]

Properties

<< Click to display table of contents >>

rvdxchart TRVReportDxChart [VCL]

Properties

TRVReportDxChart is a component that allows you to use TdxChartControl components (by Developer Express) to add charts in reports.

This component contain a set of chart templates (Catalog). When a chart item is added to a report, it is linked to one of the templates in this component (by template name). During report generation, chart images are created based on the selected template.

Unit RVReportDxChart;

Syntax

TRVReportDxChart = class(TRVReportCustomChartCatalog)

hmtoggle_arrow1Hierarchy

Description

Collection of chart templates

Catalog property is a collection named chart templates. Each collection item contains an invisible TdxChartControl component, accessible via the ChartTemplate property. This TdxChartControl component is used to generate chart images that are inserted into the resulting report.

When editing each ChartTemplate, you should add series in the maximum number that may be required in the report. The report generator will use only the first data series (as many as needed for the document item representing the chart in the report); the remaining series will be hidden.

You can add multiple diagrams to a ChartTemplate. The data series are used sequentially: first the series from the first diagram, then from the second one, and so on. For example, if ChartTemplate contains two diagrams with two series each, and TRVReportChartItemInfo requires three series, the following series will be used: Diagrams[0].Series[0], Diagrams[0].Series[1], Diagrams[1].Series[0]. The remaining series (Diagrams[1].Series[1]) will be hidden.

When setting the properties of ChartTemplate, only the chart and series properties are taken into account; the data used to build the chart is not. During report generation, any data specified in ChartTemplate is ignored and replaced with data from the data query (such as a table name or an SQL SELECT statement). In addition, chart titles and series names are replaced during report generation.

How to use

To add charts to reports, perform the following steps:

Create a TRVReportDxChart component; add at least one item to its Catalog collection; add at least one diagram with at least one series to the ChartTemplate property of this item. A good starting point is the AddDefaultCharts method, which adds several catalog items with various chart templates.

Assign this TRVReportDxChart component to the TRVReportGenerator.ChartCatalog property.

Insert a TRVReportChartItemInfo item into the document, specifying:

othe name of item in Catalog (that will be used to generate chart images; must be equal to one of Name properties of catalog items);

oone or more series defined by:

a data query (such as a table name or an SQL SELECT statement);

the field name (or expression) for the data values;

(optionally) the field name (or expression) for data labels.

Visual TdxChartControl controls are not used directly. In report editing mode, the document contains TRVReportChartItemInfo item(s), which is independent of any specific chart implementation. The final report contains images of charts (PNG format by default). TRVReportDxChart uses invisible TdxChartControl components to generate these images.

To simplify working with charts, the TrvrActionInsertChart action is provided. It displays a dialog that allows you to specify everything required to insert a chart into a report template: the chart type (that is, an item from TRVReportDxChart.Catalog) and a set of data series. For each series, you must define a data query as well as the field or expression for values and labels. As a result, a TRVReportChartItemInfo item with the properties specified in the dialog is inserted into the editor.

In addition, TrvrActionInsertChart allows TrvActionItemProperties to edit the properties of an already inserted chart.

Design time support

You can edit this component at design time. A command named “Add Default Catalog Items” is added to the component’s context menu; it calls the AddDefaultCharts method to add a set of chart templates to the Catalog property.

You can also edit individual collection items. After selecting the ChartTemplate property in the Object Inspector, you can expand it (by clicking the [+] icon on the left) and edit individual TdxChartControl properties. Alternatively, you can click the […] button to open a special property editor that allows you to preview this TdxChartControl and invoke its component editor.