Skip to content

Why is so hard for me to work with dates on X axis beside it probably being one of the fundamentals of plotting? #4861

@bukowa

Description

@bukowa

Question:
Why is it so hard for me to figure out how to work with dates on the X axis? While reading the docs, it's unclear why different plots have different methods for handling the X axis as dates. I don't understand why, despite converting datetime, placing dates on the axis with a custom format can't be done as a one-liner. Why ScottPlott does not understand that it is being passed a datetime values as X axis?

I want to plot bars like at https://scottplot.net/cookbook/5.0/Bar/
But X axis should be dates, for ex:

var dates = Generate.Consecutive(100, DateTime.UtcNow.AddDays(-1).Date, TimeSpan.FromMinutes(5));

Yet I can't find a way to pass dates as X axis to the bars hmmm (there's no overload method for this).

ScottPlot Version:
5.0.54 WinForms

Code Sample:

var dates = Generate.Consecutive(100, DateTime.UtcNow.AddDays(-1).Date, TimeSpan.FromMinutes(5));
var bars = Generate.RandomNumbers(dates.Count(), -100, 100);
var barPlot = FormsPlot1.Plot.Add.Bars(dates, bars);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions