Skip to main content

PointData(DateTime, Double) Constructor

Initializes a new instance of the PointData class with specified settings.

Namespace: DevExpress.WinUI.Charts

Assembly: DevExpress.WinUI.Charts.v23.2.dll

NuGet Package: DevExpress.WinUI

#Declaration

public PointData(
    DateTime argument,
    double value
)

#Parameters

Name Type Description
argument DateTime

The point’s DateTime argument.

value Double

The point’s numeric value.

#Remarks

The following code adds several points with DateTime arguments and numeric values to a Cartesian chart:

<Charts:CartesianChart x:Name="chart">
    <!--...-->
</Charts:CartesianChart>
public MainWindow() {

    this.InitializeComponent();

    // Create a series:
    Series series = new Series();

    // Specify the series view:
    series.View = new PointSeriesView();

    // Create a point collection and assign it to the series:
    PointDataCollection pointCollection = new PointDataCollection();
    pointCollection.ArgumentScaleType = ScaleType.DateTime;
    pointCollection.ValueScaleType = ScaleType.Numerical;
    series.Data = pointCollection;

    // Add points to the series:
    pointCollection.Add(new PointData(new DateTime(2022, 01, 01), 10));
    pointCollection.Add(new PointData(new DateTime(2022, 01, 02), 20));
    pointCollection.Add(new PointData(new DateTime(2022, 01, 03), 30));
    // Add other points.

    // Add the series to the chart:
    chart.Series.Add(series);

    // Specify x-axis settings:
    chart.AxisX = new AxisX {
        DateTimeMeasureUnit = DateTimeMeasureUnit.Day,
        DateTimeGridAlignment = DateTimeMeasureUnit.Day,
        SideMargins = 0.01,
        GridSpacingAuto = false,
        GridSpacing = 1
    };
}
See Also