Axis

An axis is used to display the scale for a single dimension of a plot area. There are three axis types: x-axis, y-axis, and z-axis.

An axis can have a title, ruler line, major and minor tick marks, and major and minor grid lines.

You can set the font, background, foreground, and border for the axis. You can also set the fill for major grid lines, as well as for minor grid lines. You can specify lines for the tick marks and grid lines. You can set the height for major and minor tick marks.

Use the Axis class to set styles, titles, tick marks or lines, and grid lines.

Using Code

The following example creates major tick marks and lines.

  1. Add values to the control. 
  2. Create a bar chart with the SpreadChart class. 
  3. Set the axis properties such as MajorGridlinesStroke using the Axis class.
  4. Add the chart.
CS
Copy Code
GrapeCity.Xaml.SpreadSheet.Data.SpreadChart chart = new GrapeCity.Xaml.SpreadSheet.Data.SpreadChart("Chart", GrapeCity.Xaml.SpreadSheet.Data.SpreadChartType.BarStacked, "Sheet1!$A$1:$A$7", 0, 0, 200, 200);
gcSpreadSheet1.ActiveSheet.SetArray(0, 0, new object[,] { { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 }, { 9 }, { 10 } });

chart.AxisX.MajorGridlinesStroke = new SolidColorBrush(Windows.UI.Colors.Red);
chart.AxisX.MajorGridlinesStrokeDashType = GrapeCity.Xaml.SpreadSheet.Data.StrokeDashType.Dash;
chart.AxisX.MajorGridlinesStrokeThickness = 2;
chart.AxisX.MajorTickHeight = 10;
chart.AxisX.MajorTickPosition = GrapeCity.Xaml.SpreadSheet.Data.AxisTickPosition.Cross;
chart.AxisX.MajorTickStroke = new SolidColorBrush(Windows.UI.Colors.Yellow);
chart.AxisX.MajorTickThickness = 2;
chart.AxisY.MajorGridlinesStroke = new SolidColorBrush(Windows.UI.Colors.Orange);
chart.AxisY.MajorGridlinesStrokeDashType = GrapeCity.Xaml.SpreadSheet.Data.StrokeDashType.LongDashDot;
chart.AxisY.MajorGridlinesStrokeThickness = 2;
chart.AxisY.MajorTickHeight = 10;
chart.AxisY.MajorTickPosition = GrapeCity.Xaml.SpreadSheet.Data.AxisTickPosition.Cross;
chart.AxisY.MajorTickStroke = new SolidColorBrush(Windows.UI.Colors.Magenta);
chart.AxisY.MajorTickThickness = 2;
gcSpreadSheet1.ActiveSheet.Charts.Add(chart);
VB
Copy Code
Dim chart As New GrapeCity.Xaml.SpreadSheet.Data.SpreadChart("Chart", GrapeCity.Xaml.SpreadSheet.Data.SpreadChartType.BarStacked, "Sheet1!$A$1:$A$7", 0, 0, 200, 200)
GcSpreadSheet1.ActiveSheet.SetArray(0, 0, New Object(,) {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}})

chart.AxisX.MajorGridlinesStroke = New SolidColorBrush(Windows.UI.Colors.Red)
chart.AxisX.MajorGridlinesStrokeDashType = GrapeCity.Xaml.SpreadSheet.Data.StrokeDashType.Dash
chart.AxisX.MajorGridlinesStrokeThickness = 2
chart.AxisX.MajorTickHeight = 10
chart.AxisX.MajorTickPosition = GrapeCity.Xaml.SpreadSheet.Data.AxisTickPosition.Cross
chart.AxisX.MajorTickStroke = New SolidColorBrush(Windows.UI.Colors.Yellow)
chart.AxisX.MajorTickThickness = 2
chart.AxisY.MajorGridlinesStroke = New SolidColorBrush(Windows.UI.Colors.Orange)
chart.AxisY.MajorGridlinesStrokeDashType = GrapeCity.Xaml.SpreadSheet.Data.StrokeDashType.LongDashDot
chart.AxisY.MajorGridlinesStrokeThickness = 2
chart.AxisY.MajorTickHeight = 10
chart.AxisY.MajorTickPosition = GrapeCity.Xaml.SpreadSheet.Data.AxisTickPosition.Cross
chart.AxisY.MajorTickStroke = New SolidColorBrush(Windows.UI.Colors.Magenta)
chart.AxisY.MajorTickThickness = 2
GcSpreadSheet1.ActiveSheet.Charts.Add(chart)
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.