IChartExternLegendItems.Swap

Fore Syntax

Swap(FromIndex: Integer; ToIndex: Integer);

Fore.NET Syntax

Swap(System.Int32,System.Int32);

Parameters

 FromIndex. Index of the legend element to be replaced.

 ToIndex. Index of the legend element, with which the element is to be replaced.

Description

The Swap method enables the user to swap specified elements of external legend.

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;
    items: IChartExternLegendItems;
Begin
    mb := MetabaseClass.Active;
    rep := mb.ItemById("OBJ12399").Open(NullAs IPrxReport;
    legend := (rep.ActiveSheet As IprxTable).TabSheet.Objects.Item(1).Extension As IPrxChartLegend;
    chartlegend := legend As IChartExternLegend;
    items := chartlegend.InternalItems;
    items.Swap(0,3);
End Sub Main;

After executing the example the first and the fourth legend elements are swapped.

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;
    items: IChartExternLegendItems;
Begin
    mb := Params.Metabase;
    rep := mb.ItemById["OBJ42859"].Edit() As IPrxReport;
    legend := (rep.ActiveSheet As IprxTable).TabSheet.Objects.Item[1].Extension As IPrxChartLegend;
    chartlegend := legend As IChartExternLegend;
    chartlegend.AxisIcon := ChartLegendAxisIcon.claiAxis;
    items := chartlegend.InternalItems;
    items.Swap(0,3);
    (rep As IMetabaseObject).Save();
End Sub;

After executing the example the first and the fourth legend elements are swapped.

See also:

IChartExternLegendItems