Add(Value: Double; [Pen: IGxPen = Null]): Integer;
Value. Value of added level.
Pen. Optional parameter that determines parameters of the added level line. The default value is Null.
The Add method adds a new level line to the chart and returns the index of this level.
Executing the example requires a regular report with the REGULAR_REPORT identifier, which sheet contains a chart with the source data and at least three level lines. Add links to the Metabase, Report, Tab, Chart, Drawing system assemblies in the unit.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Chart: IChart;
LevelLine: IChartAxisLevelLine;
Pen: IGxPen;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REGULAR_REPORT").Edit As IPrxReport;
Tab := (Report.Sheets.Item(0) As IPrxTable).TabSheet;
Chart := Tab.Objects.Item(0).Extension As IChart;
Chart.AxisY.LevelLines.Remove(0);
Pen := New GxPen.CreateSolid(GxColor.FromKnownColor(GxKnownColor.Blue), 0.40);
Chart.AxisY.LevelLines.Add(12.2, Pen);
LevelLine := Chart.AxisY.LevelLines.Item(1);
LevelLine.Value := 15.4;
(Report As IMetabaseObject).Save;
End Sub UserProc;
The level lines are changed on the regular report chart: the first line is removed, the third line's value is changed, a line with the specified thickness and color is added.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Chart: IChart;
LevelLine: IChartAxisLevelLine;
GxColorCls: GxColorClass = New GxColorClassClass();
Pen: GxPen = New GxPenClass();
Begin
MB := Params.Metabase;
Report := MB.ItemById["REGULAR_REPORT"].Edit() As IPrxReport;
Tab := (Report.Sheets.Item[0] As IPrxTable).TabSheet;
Chart := Tab.Objects.Item[0].Extension As IChart;
Chart.AxisY.LevelLines.Remove(0);
Pen.CreateSolid(GxColorCls.FromKnownColor(GxKnownColor.clBlue), 0.40);
Chart.AxisY.LevelLines.Add(12.2, Pen);
LevelLine := Chart.AxisY.LevelLines.Item(1);
LevelLine.Value := 15.4;
(Report As IMetabaseObject).Save();
End Sub;
See also: