This page is part of the ScottPlot 5.0 Cookbook
⚠️ ScottPlot 5.0.8-beta is a preview package
This page describes a beta release of ScottPlot. It is available on NuGet as a preview package, but its API is not stable and it is not recommended for production use. See the ScottPlot Versions page for more information.
DateTime Axis Quickstart
.
ScottPlot.Plot myPlot = new();
// begin with an array of DateTime values
DateTime[] dates = Generate.DateTime.Days(100);
// convert DateTime to OLE Automation (OADate) format
double[] xs = dates.Select(x => x.ToOADate()).ToArray();
double[] ys = Generate.RandomWalk(xs.Length);
myPlot.Add.Scatter(xs, ys);
// tell the plot to display dates on the bottom axis
myPlot.AxisStyler.DateTimeTicks(Edge.Bottom);
myPlot.SavePng("datetime-axis-quickstart.png");