Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeAxis crash with very early DateTimes #2026

Open
jmorgan-habs opened this issue Aug 9, 2023 · 3 comments
Open

DateTimeAxis crash with very early DateTimes #2026

jmorgan-habs opened this issue Aug 9, 2023 · 3 comments
Labels

Comments

@jmorgan-habs
Copy link
Contributor

jmorgan-habs commented Aug 9, 2023

Steps to reproduce

  1. Add a data point to a DateTimeAxis with a value equal to or slightly above DateTime.MinValue
  2. When the PlotView has been rendered, pan left (such that you're looking at data earlier than the above point)

Platform:
.NET version: Framework 4.8
OxyPlot version: 2.1.2
I'm using the WPF version of OxyPlot, but this seems to be a core issue

Behavior

The PlotView will crash with an exception related to creating an invalid DateTime.

1a35011a984949c0a95fe1355f983517.mp4
@VisualMelon
Copy link
Contributor

There are issues with excessively large numbers as well. This will need a bit of thought I expect.

Is there a specific reason you need DateTimeAxis rather than TimeSpanAxis? From your picture, I'd expect the latter would be a better choice for your scenario, and should avoid a whole class of issues like this, but keen to know if there's an issue that makes that difficult for you.

@jmorgan-habs
Copy link
Contributor Author

To be honest, I haven't tried to use TimeSpanAxis. The objective here is to provide a user with a quasi-Gantt chart showing absolute start and stop times for pumping fluids to and from various storage tanks. Having the capability to show exact dates on the chart above is critical for my design specification for this project, and if TimeSpanAxis supports that, I'm happy to give it a go. The case I show above, wherein I don't have a good start time, also needs to be handled (unfortunately).

For now, I'm getting around this by setting AbsoluteMinimum and AbsoluteMaximum bounds on the DateTimeAxis, as it seems that the error only occurs when trying to render ticks that don't resolve from doubles to DateTimes.

@VisualMelon
Copy link
Contributor

VisualMelon commented Aug 16, 2023

If you need dates, then you will indeed need DateTimeAxis: just seemed odd that you'd have a series start at the epoch so I thought maybe you just wanted only the time component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants