Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/LiveChartsCore/CoreAxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -807,16 +807,22 @@ private IEnumerable<double> EnumerateSeparators(double start, double end, double
{
if (CustomSeparators is not null)
{
foreach (var s in CustomSeparators) yield return s;
foreach (var s in CustomSeparators)
yield return s;

yield break;
}

var relativeEnd = end - start;

if (relativeEnd / step > 10000)
{
ThrowInfiniteSeparators();
}
for (var i = 0d; i <= relativeEnd; i += step) yield return start + i;

// start from -step to include the first separator/sub-separator
// and end at relativeEnd + step to include the last separator/sub-separator

for (var i = -step; i <= relativeEnd + step; i += step)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a safe alternative, start from -step and finish on end + step, there might be cases where 1 or 2 extra separators are rendered, but that should not impact performance.

yield return start + i;
}

private static ChartPoint? FindClosestPoint(
Expand Down