diff --git a/Source/OxyPlot.Avalonia/PlotBase.cs b/Source/OxyPlot.Avalonia/PlotBase.cs index 1241b6e..2e79650 100644 --- a/Source/OxyPlot.Avalonia/PlotBase.cs +++ b/Source/OxyPlot.Avalonia/PlotBase.cs @@ -237,7 +237,6 @@ public void InvalidatePlot(bool updateData = true) { if (Interlocked.CompareExchange(ref isUpdateRequired, updateState, currentState) == currentState) { - isUpdateRequired = updateState; BeginInvoke(() => UpdateModel(updateData)); break; } @@ -394,6 +393,7 @@ protected void UpdateModel(bool updateData = true) { if (Width <= 0 || Height <= 0 || ActualModel == null) { + isUpdateRequired = 0; return; } @@ -403,7 +403,7 @@ protected void UpdateModel(bool updateData = true) if (updateState > 0) { - ((IPlotModel)ActualModel).Update(updateState == 2); + ((IPlotModel)ActualModel).Update(updateState == 2 || updateData); } } @@ -413,7 +413,6 @@ protected void UpdateModel(bool updateData = true) // After the invalidation, the element will have its layout updated, // which will occur asynchronously unless subsequently forced by UpdateLayout. BeginInvoke(InvalidateArrange); - BeginInvoke(InvalidateVisual); } }