Chart / Charts / Chart Types / Cartesian / Cartesian Chart
In This Topic
    Cartesian Chart
    In This Topic

    The Cartesian chart displays data in a Cartesian coordinate system. NOV Chart for .NET supports 2D and 3D Cartesian charts. In a 2D Cartesian coordinate system, two X and Y axes form a plot where data is plotted using the data point's X and Y values. Similarly in a 3D Cartesian Coordinate System, a set of X, Y, and Depth axes form a 3D plot. You create a Cartesian chart by creating an instance of the NCartesianChart class. The following example shows how to create a simple 2D 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 the SetPredefinedCartesianAxes method to quickly set up the axes of the chart. The following table shows the available options for this method:

    ENPredefinedCartesianAxis Description
    Standard Standard configuration using a pair of two Y axes in numeric mode, two X axes in ordinal, and one depth ordinal axis.
    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.
    XYZLinear Represents a Cartesian chart with three numeric (linear) axes of a standard 3D Cartesian coordinate system.
    XYZLinear Represents a Cartesian chart with three numeric (linear) axes of a standard 3D Cartesian coordinate system.
    YLinearXZOrdinal Represents a Cartesian chart with three axes of a standard 3D cartesian coordinate system with Y numeric (linear) axis and XZ ordinal axes.

    By default, the chart is configured to use a standard set of five axes - two Y axes in linear mode (Primary Y and Secondary Y), two X axes in ordinal mode (Primary X and Secondary X) and one Depth axis in ordinal mode.

     

     

    See Also