Font: 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.
See also: