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

Fix Issue with _stepCount Not Resetting, Causing Infinite Separator Exceptions #1535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions src/LiveChartsCore/CoreAxis.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// The MIT License(MIT)
// The MIT License(MIT)
//
// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors
//
Expand Down Expand Up @@ -307,8 +307,6 @@ public abstract class CoreAxis<TDrawingContext, TTextGeometry, TLineGeometry>
/// <inheritdoc cref="ChartElement{TDrawingContext}.Invalidate(Chart{TDrawingContext})"/>
public override void Invalidate(Chart<TDrawingContext> chart)
{
_stepCount = 0;

var cartesianChart = (CartesianChart<TDrawingContext>)chart;

var controlSize = cartesianChart.ControlSize;
Expand Down Expand Up @@ -496,6 +494,7 @@ public override void Invalidate(Chart<TDrawingContext> chart)

var start = Math.Truncate(min / s) * s;

_stepCount = 0;
foreach (var i in EnumerateSeparators(start, max, s))
{
var separatorKey = Labelers.SixRepresentativeDigits(i - 1d + 1d);
Expand Down Expand Up @@ -879,6 +878,7 @@ public virtual LvcSize GetPossibleSize(Chart<TDrawingContext> chart)
var h = 0f;
var r = (float)LabelsRotation;

_stepCount = 0;
foreach (var i in EnumerateSeparators(start, max, s))
{
var textGeometry = new TTextGeometry
Expand Down Expand Up @@ -1031,6 +1031,7 @@ private LvcSize GetPossibleMaxLabelSize()

if (max - min == 0) return maxLabelSize;

_stepCount = 0;
foreach (var i in EnumerateSeparators(min, max, s))
{
var textGeometry = new TTextGeometry
Expand Down