Nevron Open Vision Documentation
Cartesian Axes

Each Cartesian Chart can have an unlimited number of X and Y axes.

Creating a Cartesian Axis

You create a cartesian axis by creating an instance of the NCartesianAxis class and adding it to the Axes collection of a cartesian Chart:

C#
Copy Code

NCartesianAxis xAxis = new NCartesianAxis();
cartesianChart.Axes.Add(xAxis);

NCartesianAxis yAxis = new NCartesianAxis();
cartesianChart.Axes.Add(yAxis);

The cartesian axis orientation and position is controlled from its anchor. There are two types of axis anchors – dock and cross axis anchors, which are discussed in the following section.

 

Dock Axis Anchors

The cartesian dock axis is represented by the NDockCartesianAxisAnchor class. This anchor allows you to position the axis in one of the axis dock zones which are positioned on the edges of the chart bounding box. The following code shows how to anchor the x and y axes:

C#
Copy Code

xAxis.Anchor = new NDockCartesianAxisAnchor(ENCartesianAxisDockZone.Bottom);
yAxis.Anchor = new NDockCartesianAxisAnchor(ENCartesianAxisDockZone.Left);

Axis Dock Zone Levels

Axis dock zones can contain an unlimited number of axes grouped together in zone levels. The axes in one zone level cannot overlap axes in other zone levels in the same dock zone. Initially axis dock zones do not contain any levels. When the first axis arrives in the zone it will always create a new level regardless of the setting specified by the CreateNewZoneLevel property of the anchor. Subsequent axes however will have that option – e.g. whether to use the zone level created by the previous axes or create a new one. The following code snippet shows how to create a cartesian chart with three y axes where the third one is placed in a separate axis zone level:

C#
Copy Code

NCartesianAxis yAxis1 = new NCartesianAxis();

NDockCartesianAxisAnchor dockAnchor1 = new NDockCartesianAxisAnchor();
dockAnchor1.DockZone =
ENCartesianAxisDockZone.Left;
dockAnchor1.BeginPercent = 0;
dockAnchor1.EndPercent = 30;
yAxis1.Anchor = dockAnchor1;
cartesianChart.Axes.Add(yAxis1);

 

NCartesianAxis yAxis2 = new NCartesianAxis();
NDockCartesianAxisAnchor dockAnchor2 = new NDockCartesianAxisAnchor();
dockAnchor2.DockZone =
ENCartesianAxisDockZone.Left;
dockAnchor2.BeginPercent = 70;
dockAnchor2.EndPercent = 100;
yAxis2.Anchor = dockAnchor2;
cartesianChart.Axes.Add(yAxis2);

NCartesianAxis yAxis3 = new NCartesianAxis();
NDockCartesianAxisAnchor dockAnchor3 = new NDockCartesianAxisAnchor();
dockAnchor3.CreateNewZoneLevel =
true;
dockAnchor3.DockZone =
ENCartesianAxisDockZone.Left;
dockAnchor3.BeginPercent = 30;
dockAnchor3.EndPercent = 70;
yAxis3.Anchor = dockAnchor3;
cartesianChart.Axes.Add(yAxis3);

Note that the code above specifies the amount of space occupied by the axis on the left chart plot edge - this is done through the BeghinPercent and EndPercent properties of the anchor.

Axes Dock Zone Levels Spacing

Each axis dock zone level has spacing applied before all other levels in the zone and spacing that should be leaved after it when other levels are added. These spaces are controlled from the BeforeSpace and AfterSpace properties of the dock anchor.

Cross Axis Anchors

The cross axis anchor allows you to specify the axis orientation (Horizontal or Vertical) and give the axis a reference point that it must cross. This reference point can be either a value on another axis of the chart (value crossing) or a point specified as aligned offset from the chart area (model crossing).

Axis Value Crossing

To create an axis that crosses another axis on a certain value you need to assign an instance of the NValueCrossCartesianAxisAnchor class to its Anchor property.

The following code creates an XY axis chart with axes that cross at 0:

C#
Copy Code

// add the x and y axes
NCartesianAxis xAxis = new NCartesianAxis();
cartesianChart.Axes.Add(xAxis);

NCartesianAxis yAxis = new NCartesianAxis();
cartesianChart.Axes.Add(yAxis);

// cross them

yAxis.Anchor = new NValueCrossCartesianAxisAnchor(0, xAxis, ENCartesianAxisOrientation.Vertical, ENScaleOrientation.Left, 0, 100);

xAxis.Anchor = new NValueCrossCartesianAxisAnchor(0, yAxis, ENCartesianAxisOrientation.Horizontal, ENScaleOrientation.Right, 0, 100);

Axis Model Crossing

Similarly to create an axis that crosses another axis on a certain model value you need to assign an instance of the NModelCrossCartesianAxisAnchor class to its Anchor property:

C#
Copy Code

 

// add the x and y axes
NCartesianAxis xAxis = new NCartesianAxis();
cartesianChart.Axes.Add(xAxis);

NCartesianAxis yAxis = new NCartesianAxis();
cartesianChart.Axes.Add(yAxis);

// cross them
yAxis.Anchor = new NModelCrossCartesianAxisAnchor(0, ENAxisCrossAlignment.Center, xAxis, ENCartesianAxisOrientation.Vertical, ENScaleOrientation.Left, 0, 100);

xAxis.Anchor = new NModelCrossCartesianAxisAnchor(0, ENAxisCrossAlignment.Center, yAxis, ENCartesianAxisOrientation.Horizontal, ENScaleOrientation.Right, 0, 100);

 

See Also
Send Feedback