IChartBox.Chart

Syntax

Chart: IChart;

Description

The Chart property determines chart displayed in the ChartBox component.

Comments

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

If the Chart property refers to a chart other than the chart defined in Source, the Source property is reset. A chart implemented by the interface IChart should be passed as the value of this property. The chart may 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 reference should be stored separately in the code. Chart source should be open.

Example

Executing this example requires a form, a button named Button1 positioned on this form, and the ChartBox component named ChartBox1. Also the repository should contain a regular report with a chart positioned 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