How Chart supports multiple axes in MVC?
ASP.NET MVC Chart supports using multiple axes in Chart. By default, the primary X axis and primary Y axis are used as horizontal and vertical axes for a series. You can add additional axes to chart by using the Axes collection in chart.
To bind series to an axis, assign axis name for XAxisName or YAxisName property of series. The default value for Name property of axis is not defined, hence it is mandatory to provide a name for axis before binding it with series.
Use the XAxisName property for binding a horizontal axis and YAxisName property for binding a vertical axis. When these properties are not assigned any value, primary X axis is considered as the horizontal axis for series and primary Y axis is considered as the vertical axis for series.
CSHTML
@(Html.EJ().Chart("container") .Axes(axis => { axis.Name("Secondary Axis") .Orientation("vertical") .OpposedPosition(true) .Add(); . . . . . . . . . . . . . . . . . . . . }) .Series(ser => { . . . . . . . . ser.YAxisName("Secondary Axis").Add(); . . . . . . . . }) . . . . . . . . . . . . . . . . . . )
The output of the above code example is similar to the following screenshot.
Figure 1: Output