Skip to content

Commit 9ec82aa

Browse files
authored
Add Example for Issue #1716 (#1717)
1 parent 6b2dd32 commit 9ec82aa

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
## Unreleased
55

66
### Added
7+
- Example for Issue #1716 showing poor tick spacing on DateTimeAxis with interval types of Weeks or Years
78

89
### Changed
910

Source/Examples/ExampleLibrary/Issues/Issues.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,50 @@ public static PlotModel ContourSeriesProduceFakeConnections()
24662466
return plot;
24672467
}
24682468

2469+
[Example("#1716: DateTimeAxis sometimes ignores IntervalLength")]
2470+
public static PlotModel DateTimeAxisSometimesIgnoresIntervalLength()
2471+
{
2472+
var plot = new PlotModel();
2473+
2474+
plot.Title = "IntervalLength is ignored for large ranges with IntervalType of Years or Weeks";
2475+
2476+
var days = new DateTimeAxis
2477+
{
2478+
IntervalType = DateTimeIntervalType.Days,
2479+
Position = AxisPosition.Bottom,
2480+
PositionTier = 1,
2481+
Minimum = DateTimeAxis.ToDouble(new DateTime(2000, 1, 1)),
2482+
Maximum = DateTimeAxis.ToDouble(new DateTime(2001, 1, 1)),
2483+
Title = "Days (mostly fine)",
2484+
};
2485+
2486+
var weeks = new DateTimeAxis
2487+
{
2488+
IntervalType = DateTimeIntervalType.Weeks,
2489+
Position = AxisPosition.Bottom,
2490+
PositionTier = 2,
2491+
Minimum = DateTimeAxis.ToDouble(new DateTime(2000, 1, 1)),
2492+
Maximum = DateTimeAxis.ToDouble(new DateTime(2001, 1, 1)),
2493+
Title = "Weeks (nothing is fine)",
2494+
};
2495+
2496+
var years = new DateTimeAxis
2497+
{
2498+
IntervalType = DateTimeIntervalType.Years,
2499+
Position = AxisPosition.Bottom,
2500+
PositionTier = 3,
2501+
Minimum = DateTimeAxis.ToDouble(new DateTime(2000, 1, 1)),
2502+
Maximum = DateTimeAxis.ToDouble(new DateTime(2100, 1, 1)),
2503+
Title = "Years (minor ticks not fine)",
2504+
};
2505+
2506+
plot.Axes.Add(days);
2507+
plot.Axes.Add(weeks);
2508+
plot.Axes.Add(years);
2509+
2510+
return plot;
2511+
}
2512+
24692513
private class TimeSpanPoint
24702514
{
24712515
public TimeSpan X { get; set; }

0 commit comments

Comments
 (0)