XAxis Property

Use this property to return/set values that determines the grid and scale characteristics for a specific x-axis.   XAxis is an array from 0 to (NumXScales - 1) and it uses the Line Class set of properties for its Grid characteristics and the Scale Class set of properties for its Scale characteristics.

[Visual Basic]
Structure XSCALEPROP
   Grid As C_Line
   Scale As C_Scale
End Structure

Property XAxis(XAxisNumber As Integer) As XSCALEPROP
[C#]
XYChartNet.XYChartNETCtl.XSCALEPROP XYChartNETCtl.get_XAxis(int XAxisNumber)
[C++]
XYChartNet::XYChartNETCtl::XSCALEPROP XYChartNet::XYChartNETCtl::get_XAxis(int)

Parameters

XAxisNumber
The index of the x-axis to set/get.  Valid values are 0..(NumXScales - 1).

Remarks

Label default for XAxis Scale property is "Time (s)".

Examples

XYChartNETCtl1 is the name of the XY Chart NET control instance placed on the form.

[Visual Basic]
Dim tmpColor as Color
Dim sLabel as String

XYChartNETCtl1.NumProfiles = 4
XYChartNETCtl1.NumXScales = 2

If XYChartNETCtl1.XAxis(0).Scale.Visible Then
   sLabel = XYChartNETCtl1.XAxis(0).Scale.Label         'Return the scale label for x-axis 0
   tmpColor = XYChartNETCtl1.XAxis(0).Scale.LabelColor  'Return the scale color for x-axis 0
End If

XYChartNETCtl1.XAxis(1).Scale.Visible = False           'Do not display x-axis 1 scale

With XYChartNETCtl1
   With .XAxis(0).Grid
      .LineOption = loCustom    'Display axis' horizontal grid lines
      .LineStyle = soDash       'Set line style to use Dashes
      .LineWidth = woOnePoint   'Set line width
      .LineColor = Color.Red    'Set line color to Blue
   End With

   With .XAxis(0).Scale
      .Visible = True           'Display scale
      .Label = "Distance"       'Set the scale's label
      .LabelColor = Color.Red   'Set the color for the scale's label
      .ScaleMode = smManual     'Set the scale mode to Manual
      .ScaleManualMin = -5      'Set the scale's min value
      .ScaleManualMax = 5       'Set the scale's max value
      .TicksColor = Color.Red   'Set the color for the scale's ticks and tick labels
   End With

   With .XAxis(1).Grid
      .LineOption = loNone      'Do not display axis' horizontal grid lines
   End With

   With .XAxis(1).Scale
      .Visible = True           'Display scale
      .Label = "Speed"          'Set the scale's vertical label
      .LabelColor = Color.Blue  'Set the color for the scale's vertical label
      .TicksColor = Color.Blue  'Set the color for the scale's ticks and tick labels
      .TickLabelSpacing = 2     'Set the tick label spacing
   End With

   .Refresh                     'Refresh required to update chart with changes made
End With

[C#]
Font my14Font = new Font("Arial", 14, FontStyle.Bold);
Font my10Font = new Font("Arial", 10, FontStyle.Bold);

XYChartNETCtl1.NumProfiles = 2;
XYChartNETCtl1.NumXScales = 2;

// X Axis 0 Grid & Scale properties
XYChartNETCtl1.get_XAxis(0).Grid.LineOption = XYChartNet.XYChartNETCtl.LineOptions.loCustom;
XYChartNETCtl1.get_XAxis(0).Grid.LineColor = Color.Maroon;
XYChartNETCtl1.get_XAxis(0).Scale.Label = "Distance";
XYChartNETCtl1.get_XAxis(0).Scale.LabelColor = Color.Maroon;
XYChartNETCtl1.get_XAxis(0).Scale.TicksColor = Color.Maroon;
XYChartNETCtl1.get_XAxis(0).Scale.TicksFont = my14Font;

// X Axis 1 Grid & Scale properties
XYChartNETCtl1.get_XAxis(1).Grid.LineOption = XYChartNet.XYChartNETCtl.LineOptions.loNone;
XYChartNETCtl1.get_XAxis(1).Scale.Label = "Speed";
XYChartNETCtl1.get_XAxis(1).Scale.LabelColor = Color.MidnightBlue;
XYChartNETCtl1.get_XAxis(1).Scale.TicksColor = Color.MidnightBlue;
XYChartNETCtl1.get_XAxis(1).Scale.TicksFont = my10Font;

XYChartNETCtl1.Refresh();  //Refresh required to update chart with changes made
		
[C++]
System::Drawing::Font* my14Font = new Drawing::Font("Arial", 14, Drawing::FontStyle::Bold);
System::Drawing::Font* my10Font = new Drawing::Font("Arial", 10, Drawing::FontStyle::Bold);

XYChartNETCtl1->NumProfiles = 2;
XYChartNETCtl1->NumXScales = 2;

// X Axis 0 Grid & Scale properties
XYChartNETCtl1->get_XAxis(0).Grid->LineOption = XYChartNETCtl::LineOptions::loCustom;
XYChartNETCtl1->get_XAxis(0).Grid->LineColor = Color::Maroon;
XYChartNETCtl1->get_XAxis(0).Scale->Label = "Distance";
XYChartNETCtl1->get_XAxis(0).Scale->LabelColor = Color::Maroon;
XYChartNETCtl1->get_XAxis(0).Scale->TicksColor = Color::Maroon;
XYChartNETCtl1->get_XAxis(0).Scale->TicksFont = my14Font;

// X Axis 1 Grid & Scale properties
XYChartNETCtl1->get_XAxis(1).Grid->LineOption = XYChartNETCtl::LineOptions::loNone;
XYChartNETCtl1->get_XAxis(1).Scale->Label = "Speed";
XYChartNETCtl1->get_XAxis(1).Scale->LabelColor = Color::MidnightBlue;
XYChartNETCtl1->get_XAxis(1).Scale->TicksColor = Color::MidnightBlue;
XYChartNETCtl1->get_XAxis(1).Scale->TicksFont = my10Font;

XYChartNETCtl1->Refresh();  //Refresh required to update chart with changes made

See Also

Properties | YAxis