IChartExternLegend.Chart

Fore Syntax

Chart (Index: Integer): IChart;

Fore.NET Syntax

Chart[System.Int32]: Prognoz.Platform.Interop.Chart.DxChart: IChart;

Parameters

Index. Chart index.

Description

The Chart property returns an object of the IChart type with the specified index, to which the legend element belongs.

Fore Example

Executing the example requires a regular report with the Report identifier.The report includes the following objects: a chart and an external legend.

Sub Main;
Var
    mb: IMetabase;
    rep: IPrxReport;
    legend: IPrxChartLegend;
    chartlegend: IChartExternLegend;
    objects: ITabObjects;
    C: IChart;
Begin
    mb := MetabaseClass.Active;
    rep := mb.ItemById("OBJ42859").Edit As IPrxReport;
    objects := (rep.ActiveSheet As IprxTable).TabSheet.Objects;
    legend := objects.Item(1).Extension As IPrxChartLegend;
    chartlegend := legend As IChartExternLegend;
    chartlegend.AddChart(objects.Item(2).Extension As IChart);
    C:= chartlegend.Chart(0);
    debug.WriteLine(chartlegend.isDirty);
    If chartlegend.ChartCount > 0 Then
        chartlegend.RemoveChart(chartlegend.Chart(0));
    End If;
    chartlegend.ItemSeparator:= "||"
    (rep As IMetabaseObject).Save;
End Sub Main;

After executing the example the C variable contains an object of the IChart type with the specified index, to which the legend element belongs.

Fore.NET Example

Executing the example requires a regular report with the Report identifier.The report includes the following objects: a chart and an external legend.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

...

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    rep: IPrxReport;
    legend: IPrxChartLegend;
    chartlegend: IChartExternLegend;
    objects: ITabObjects;
    C: IChart;
Begin
    mb := Params.Metabase;
    rep := mb.ItemById["OBJ42859"].Edit() As IPrxReport;
    objects := (rep.ActiveSheet As IprxTable).TabSheet.Objects;
    legend := objects.Item[1].Extension As IPrxChartLegend;
    chartlegend := legend As IChartExternLegend;
    chartlegend.AddChart(objects.Item[2].Extension As DxChart);
    chartlegend.UseSerieIcon := False;
    C:= chartlegend.Chart[0];
    System.Diagnostics.Debug.WriteLine(chartlegend.isDirty);
    If chartlegend.ChartCount > 0 Then
        chartlegend.RemoveChart(chartlegend.Chart[0]);
    End If;
    (rep As IMetabaseObject).Save();
    End Sub;

After executing the example the C variable contains an object of the IChart type with the specified index, to which the legend element belongs.

See also:

IChartExternLegend