IChartBox.Chart

Syntax

Chart: IChart;

Description

The Chart property determines the chart displayed in the ChartBox component.

Comments

If the Source property is determined for the component, the user can get parameters of the data source chart using this property.

If the Chart property refers to a chart other than the chart determined in Source, the Source property is reset. A chart implemented by the IChart interface must be passed as the value of this property. The chart can be obtained from a regular or express report or it can be dynamically created.

The ChartBox component in this property does not store the link to the displayed chart. The link must be stored separately in the code. Chart source must be open.

Example

Executing the example requires a form, a button named Button1 on the form, and the ChartBox component named ChartBox1. The repository must also contain a regular report with a chart on the first sheet of this report. Report identifier: REP_OSN.

Class TestForm: Form
    ChartBox1: ChartBox;
    Button1: Button;
    Chart: IChart;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        MB: IMetabase;
        Report: IPrxReport;
        Sheet: ITabSheet;
    Begin
        MB := MetabaseClass.Active;
        Report := MB.ItemById("REP_OSN").Open(NullAs IPrxReport;
        Sheet := (Report.Sheets.Item(0As IPrxTable).TabSheet;
        Chart := Sheet.Objects.Item(0).Extension As IChart;
        ChartBox1.Chart := Chart;
    End Sub Button1OnClick;

End Class TestForm;

Clicking the button in the ChartBox1 component displays the chart created on the first sheet of the regular report.

See also:

IChartBox