Rectangle: IGxRectF;
Rectangle: Prognoz.Platform.Interop.Drawing.GxRectF;
The Rectangle property returns the chart label coordinates and size.
To execute this example, create a regular report with the Rep_1 identifier with a chart on the report sheet. The inspector of unit assemblies should contain references to the Chart, Report, Tab and Metabase system assemblies.
Sub macro;
Var
mb:Imetabase;
report:IPrxReport;
chart: IChart;
series: IChartSeries;
label: IChartLabel;
Rect: IGxRectF;
Begin
mb:= MetabaseClass.Active;
report:= mb.ItemById("Rep_1").Open(Null) As IPrxReport;
chart := (report.ActiveSheet As IPrxTable).TabSheet.Objects.Item(0).Extension As IChart;
series := Chart.Series;
label := series.Item(0).Label(0);
Rect := label.Rectangle;
Debug.WriteLine("Height:" + Rect.Height.ToString);
Debug.WriteLine("Width:" + Rect.Width.ToString);
Debug.WriteLine("Left border:" + Rect.Left.ToString);
Debug.WriteLine("Top border:" + Rect.Top.ToString);
End Sub macro;
After executing the example, the console window displays the coordinates and size of the first label of the first series:
Height:4.3054685592651367
Width:7.0443191528320313
Left border:21.17462158203125
Top border:28.872674942016602
To execute this example, create a regular report with the Rep_1 identifier with a chart on the report sheet. The inspector of unit assemblies should contain references to the Chart, Report, Tab and Drawing system assemblies.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
...
Public Shared Sub Macro(Params: StartParams);
Var
mb:IMetabase;
chart: IChart;
series: IChartSeries;
label: IChartLabel;
Rect: IGxRectF;
report:IPrxReport;
Begin
mb:= Params.Metabase;
report:= mb.ItemById["Rep_1"].Open(Null) As IPrxReport;
chart := (report.ActiveSheet As IPrxTable).TabSheet.Objects.Item[0].Extension As IChart;
series := Chart.Series;
label := series.Item[0].Label[0];
Rect := label.Rectangle;
System.Diagnostics.Debug.WriteLine("Height:" + Rect.Height.ToString());
System.Diagnostics.Debug.WriteLine("Width:" + Rect.Width.ToString());
System.Diagnostics.Debug.WriteLine("Left border:" + Rect.Left.ToString());
System.Diagnostics.Debug.WriteLine("Top border:" + Rect.Top.ToString());
End Sub;
After executing the example, the console window displays the coordinates and size of the first label of the first series:
Height:4.3054685592651367
Width:7.0443191528320313
Left border:21.17462158203125
Top border:28.872674942016602
See also: