Font: IGxFont;
Font: Prognoz.Platform.Interop.Drawing.IGxFont;
The Font property determines a label font.
To set a font color, use the IChartAxisLevelLineLabel.FontColor property.
Executing the example requires that the repository contains a regular report with the REG_REPORT_LABEL identifier. The report contains only a chart.
Add links to the Chart, Drawing, Metabase, Report, Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Chart: IChart;
LevelLs: IChartAxisLevelLines;
LevelLine: IChartAxisLevelLine;
LineLabel: IChartAxisLevelLineLabel;
Pen: IGxPen;
Begin
// Get access to repository
MB := MetabaseClass.Active;
// Get access to regular report
Report := MB.ItemById("REG_REPORT_LABEL").Edit As IPrxReport;
// Get table of regular report
Tab := (Report.Sheets.Item(0) As IPrxTable).TabSheet;
// Get chart
Chart := Tab.Objects.Item(0).Extension As IChart;
// Add a level line
Pen := New GxPen.CreateSolid(GxColor.FromKnownColor(GxKnownColor.Red), 0.40);
LevelLs := Chart.AxisY.LevelLines;
LevelLs.Add(0, Pen);
LevelLine := LevelLs.Item(0);
// Determine function that is used to build level line
LevelLine.ValueFunction := ChartAxisLevelLineFunctionType.Median;
// Display function value in the console window
Debug.WriteLine(LevelLine.CalculatedValue);
// Add a level line label
LineLabel := LevelLine.Label;
// Determine visibility of level line label
LineLabel.Visible := True;
//Set new parameters of level line label
LineLabel.Font := New GxFont.Create("Arial", 14, GxFontStyle.BoldItalic, GxUnit.Point);
LineLabel.FontColor := New GxColor.CreateRGB(255, 0, 0);
LineLabel.MaskText := "Function type - %Computation; " + "Value - %Value";
// Save changes in report
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a level line is added in the regular report. Color and width are set for the line, visibility, font, color and mask are set for the label. The console window displays function value.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
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;
LevelLs: IChartAxisLevelLines;
LevelLine: IChartAxisLevelLine;
LineLabel: IChartAxisLevelLineLabel;
Pen: GxPen = New GxPenClass();
GxColorCls: GxColorClass = New GxColorClassClass();
Font: GxFont = New GxFontClass();
Color: GxColor;
Begin
// Get access to repository
MB := Params.Metabase;
// Get access to regular report
Report := MB.ItemById["REG_REPORT_LABEL"].Edit() As IPrxReport;
// Get regular report table
Tab := (Report.Sheets.Item[0] As IPrxTable).TabSheet;
// Get chart
Chart := Tab.Objects.Item[0].Extension As IChart;
// Add a level line
Pen.CreateSolid(GxColorCls.FromName("Red"), 0.40);
LevelLs := Chart.AxisY.LevelLines;
LevelLs.Add(0, Pen);
LevelLine := LevelLs.Item(0);
// Determine function that is used to build level line
LevelLine.ValueFunction := ChartAxisLevelLineFunctionType.callftMedian;
// Display function value in the console window
System.Diagnostics.Debug.WriteLine(LevelLine.CalculatedValue);
// Add a level line label
LineLabel := LevelLine.Label;
// Determine visibility of level line label
LineLabel.Visible := True;
//Determine new parameters of level line label
Font := LineLabel.Font;
Font.Create("Arial", 12, GxFontStyle.gfsBold, GxUnit.guPoint);
Color := LineLabel.FontColor;
Color.CreateRGB(250, 0, 0);
LineLabel.MaskText := "Function type - %Computation; " + "Value - %Value";
// Save changes to report
(Report As IMetabaseObject).Save();
End Sub;
See also: