The element axes have been widely used in many chart types because it can not only display data values and data series but also explain the meaning of the measurement units. And the axes element has two dimensions, X and Y axis. The functions of these two axes are not fixed. But we are used to showing data values with YAxis and displaying specific categories being compared with XAxis.
Sometimes, to better compare the values of target data series, we may create two axis in y orientation: both YAxis and YAxis2 to display the value, and the dual axis can stand by different categories with different format. And the scale of measurements for YAxis and YAxis2 can be different.
This online tutorial page will put its focus on how to customize each element of the axis at your practical needs using C# code in ASP.NET web application. Please note, both 2 y axis are allowed to modify the labels, words, lines, titles, position in the web chart.
Typically, each axis has five elements, which are Gridline, Axis line, Axis label, Axis marks and Item label. And in following text, we will illustrate how to set above mentioned axis elements using C# code one by one. Especially you can change these properties in the secondary y axis.
How to Set Gridline Using C# Code
To make the chart be better and easier viewed and understood, we will use some lines to form a grid. And those lines are called gridlines, showing in both vertical and horizontal. In general, we can change the gridline style by changing the PenStyle, Color and Width using MajorGridLine and MinorGridLine. Following C# code will show you how to set the gridline of Y Axis.
How to Set Axis Line Using C# Code
The appearance of Axis line can be fully customized by setting its color and width.
How to Set Axis Label Using C# Code
The axis label, a text string, can be used to explain the meaning of the units that each axis represents. And users can re-set the Axis Label style by using Appearance and TextBlock properties. Additional, you can modify the font style, offset, template, wrap mode of the chart axis label in your C# or Visual Basic web applications.
Following C# codes are used to add a XAix Lable, define its position and customize its rotating degree.
How to Set Axis Marks Using C# Code
The axis marks are along the axis line.
How to Set Item Label Using C# Code
Item label is a text or numeric string positioned below the axis line. The MinValue and MaxValue properties are offered to help users define the smallest and largest values that the data can be displayed. Besides, you can also customize the rotation of created item label.
ASP.NET AJAX UI Controls