Nevron Open Vision Documentation
Cartesian Chart

The cartesian chart displays data in a cartesian coordinate sytem. In it two or more X and Y axes form a plot where data is plotted using the data point X and Y values. You create a cartesian chart by creating an instance of the NCartesianChart class. The following example shows how to create a simple bar chart:

 

C#
Copy Code

// create a dock panel with label and chart

NDockPanel dockPanel = new NDockPanel();

chartView.Surface.Content = dockPanel;

// create a docked label

NLabel label = new NLabel();

label.Text = "My First Cartesian Chart";

label.Margins = new NMargins(10);

label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 12);

label.TextFill = new NColorFill(NColor.Black);

label.TextAlignment = ENContentAlignment.MiddleCenter;

NDockLayout.SetDockArea(label, ENDockArea.Top);

dockPanel.AddChild(label);

// create a new cartesian chart

NCartesianChart cartesianChart = new NCartesianChart();

cartesianChart.Margins = new NMargins(10);

NDockLayout.SetDockArea(cartesianChart, ENDockArea.Center);

dockPanel.AddChild(cartesianChart);

cartesianChart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

// create a bar series

NBarSeries bar = new NBarSeries();

bar.DataPoints.Add(new NBarDataPoint(10));

bar.DataPoints.Add(new NBarDataPoint(20));

bar.DataPoints.Add(new NBarDataPoint(30));

cartesianChart.Series.Add(bar);

Note that in the above example we used SetPredefinedCartesianAxes method to quickly setup the axes of the chart. The following table shows the available options of this method:

ENPredefinedCartesianAxis Description
XOrdinalYLinear Represents a cartesian chart with two axes where the horizontal axis is ordinal and the vertical one is numeric (linear).
XDateTimeYLinear Represents a cartesian chart with two axes where the horizontal axis is date time and the vertical one is numeric (linear).
XValueTimelineYLinear Represents a cartesian chart with two axes where the horizontal axis is a date time value timeline axis and the vertical one is numeric (linear).
XRangeTimelineYLinear Represents a cartesian chart with two axes where the horizontal axis is a date time range timeline axis and the vertical one is numeric (linear).
XYLinear Represents a cartesian chart with two xy numeric axes.
PrimaryAndSecondaryLinear Represents a cartesian chart with four axes - two horizontal and two vertical docked at the sides of the chart plot. All axes are numeric.

See Also
Send Feedback