HorizontalOffset: Double;
HorizontalOffset: double;
The HorizontalOffset property determines an offset of caption from the level line.
Header format is set up for the level line, from which interval fill is directed between level lines.
To determine a horizontal alignment of caption between level lines, use the IChartAxisInterlineCaption.HorizontalAlignment property.
Executing the example requires a form containing the Button component with the Button1 identifier, the UiErAnalyzer component with the UiErAnalyzer1 identifier and the ChartBox component with the ChartBox1 identifier. Specify UiErAnalyzer1 as a data source for ChartBox1.
The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
AxisX, AxisY: IChartAxis;
APen: IGxPen;
ChartLevel: IChartAxisLevelLine;
LevelLines : IChartAxisLevelLines;
Caption: IChartAxisInterlineCaption;
Begin
AxisX := ChartBox1.Chart.AxisX;
// Add a level line:
LevelLines := AxisX.LevelLines;
LevelLines.Add(0.625000, APen);
LevelLines.Add(0.875000, APen);
// Fill interval between level lines:
ChartLevel := LevelLines.Item(0);
ChartLevel.InterlineColor := GxColor.FromName("Yellow");
// Set up the caption of interval between level lines:
ChartLevel.EnableInterlineCaption:=True;
Caption := ChartLevel.InterlineCaption;
Caption.Text:="Level = 2007";
Caption.Font:= New GxFont.Create("Arial",10);
Caption.FontColor:= GxColor.FromName("Blue");
Caption.HorizontalOffset:= 20;
End Sub Button1OnClick;
After executing the example the chart displays level lines on the X axis according to the specified parameters:
Fill color is set for the interval between level lines.
Caption is set up for the interval between level lines:
Caption text is set.
Caption font is set.
Caption font color is set.
Caption offset from the level line is set.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Add links to the Chart and Drawing system assemblies.
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Drawing;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
AxisX, AxisY: IChartAxis;
APen: GxPenClass;
color: GxColorClass_2;
ChartLevel: IChartAxisLevelLine;
LevelLines : IChartAxisLevelLines;
Caption: IChartAxisInterlineCaption;
Font: GxFont = New GxFontClass();
GxColor: GxColorClassClass = New GxColorClassClass();
Begin
color := New GxColorClass_2();
color.CreateRGB(0, 0, 0);
APen := New GxPenClass();
APen.CreateSolid(Color, 0.1);
AxisX := ChartBoxNet1.CtrlBox.Chart.AxisX;
// Add a level line:
LevelLines := AxisX.LevelLines;
LevelLines.Add(0.625000, APen);
LevelLines.Add(0.875000, APen);
// Fill interval between level lines:
ChartLevel := LevelLines.Item(0);
ChartLevel.InterlineColor := GxColor.FromName("Yellow");
// Set up caption interval between level lines:
ChartLevel.EnableInterlineCaption:=True;
Caption := ChartLevel.InterlineCaption;
Caption.Text:="Level = 2007";
Caption.Font := Font;
Font.Create("Arial",10, GxFontStyle.gfsRegular, GxUnit.guPoint);
Caption.FontColor:= GxColor.FromName("Blue");
Caption.HorizontalOffset:= 20;
End Sub;
See also: