Skip to content

Commit c4a3501

Browse files
committed
Fix DateTimeAutomatic to support inverted axis using range.Length instead of range.Span
1 parent 461efbd commit c4a3501

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/ScottPlot5/ScottPlot5/TickGenerators/DateTimeAutomatic.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ private ITimeUnit GetLargerTimeUnit(ITimeUnit timeUnit)
6565

6666
public void Regenerate(CoordinateRange range, Edge edge, PixelLength size, SKPaint paint, LabelStyle labelStyle)
6767
{
68-
if (range.Span >= TimeSpan.MaxValue.Days || double.IsNaN(range.Span) || double.IsInfinity(range.Span))
68+
if (range.Length >= TimeSpan.MaxValue.Days || double.IsNaN(range.Length) || double.IsInfinity(range.Length))
6969
{
7070
// cases of extreme zoom (10,000 years)
7171
Ticks = [];
7272
return;
7373
}
7474

75-
TimeSpan span = TimeSpan.FromDays(range.Span);
75+
TimeSpan span = TimeSpan.FromDays(range.Length);
7676
ITimeUnit? timeUnit = GetAppropriateTimeUnit(span);
7777

7878
// estimate the size of the largest tick label for this unit this unit
7979
int maxExpectedTickLabelWidth = (int)Math.Max(16, span.TotalDays / MaxTickCount);
8080
int tickLabelHeight = 12;
8181
PixelSize tickLabelBounds = new(maxExpectedTickLabelWidth, tickLabelHeight);
82-
double coordinatesPerPixel = range.Span / size.Length;
82+
double coordinatesPerPixel = range.Length / size.Length;
8383

8484
while (true)
8585
{

0 commit comments

Comments
 (0)