Skip to content

Commit fc65155

Browse files
fix bars initial animation
1 parent 501178c commit fc65155

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/LiveChartsCore/CoreColumnSeries.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public override void Invalidate(Chart chart)
7474
secondaryScale, cartesianChart, this, secondaryAxis, primaryScale.ToPixels(pivot),
7575
cartesianChart.DrawMarginLocation.Y,
7676
cartesianChart.DrawMarginLocation.Y + cartesianChart.DrawMarginSize.Height, isStacked, false);
77-
var pHelper = previousSecondaryScale == null || previousPrimaryScale == null
78-
? null
79-
: new MeasureHelper(
77+
var pHelper = new MeasureHelper(
8078
previousSecondaryScale, cartesianChart, this, secondaryAxis, previousPrimaryScale.ToPixels(pivot),
8179
cartesianChart.DrawMarginLocation.Y,
8280
cartesianChart.DrawMarginLocation.Y + cartesianChart.DrawMarginSize.Height, isStacked, false);
@@ -161,7 +159,7 @@ public override void Invalidate(Chart chart)
161159
var pi = helper.p;
162160
var uwi = helper.uw;
163161

164-
if (previousSecondaryScale is not null && previousPrimaryScale is not null && pHelper is not null)
162+
if (!isFirstDraw)
165163
{
166164
var previousPrimary = previousPrimaryScale.ToPixels(coordinate.PrimaryValue);
167165
var bp = Math.Abs(previousPrimary - pHelper.p);

src/LiveChartsCore/CoreRowSeries.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ public override void Invalidate(Chart chart)
7979
cartesianChart.DrawMarginLocation.X,
8080
cartesianChart.DrawMarginLocation.X + cartesianChart.DrawMarginSize.Width, isStacked, true);
8181

82-
var pHelper = previousSecondaryScale == null || previousPrimaryScale == null
83-
? null
84-
: new MeasureHelper(
82+
var pHelper = new MeasureHelper(
8583
previousSecondaryScale, cartesianChart, this, secondaryAxis, previousPrimaryScale.ToPixels(pivot),
8684
cartesianChart.DrawMarginLocation.X,
8785
cartesianChart.DrawMarginLocation.X + cartesianChart.DrawMarginSize.Width, isStacked, true);
@@ -165,7 +163,7 @@ public override void Invalidate(Chart chart)
165163
var pi = helper.p;
166164
var uwi = helper.uw;
167165

168-
if (previousSecondaryScale is not null && previousPrimaryScale is not null && pHelper is not null)
166+
if (!isFirstDraw)
169167
{
170168
var previousPrimary = previousPrimaryScale.ToPixels(coordinate.PrimaryValue);
171169
var bp = Math.Abs(previousPrimary - pHelper.p);

src/LiveChartsCore/Kernel/Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public static Scaler GetNextScaler(this ICartesianAxis axis, CartesianChartEngin
505505
/// <param name="axis"></param>
506506
/// <param name="chart"></param>
507507
/// <returns></returns>
508-
public static Scaler? GetActualScaler(this ICartesianAxis axis, CartesianChartEngine chart)
508+
public static Scaler GetActualScaler(this ICartesianAxis axis, CartesianChartEngine chart)
509509
{
510510
// returns an scaler with the "Motion bounds", which means the bounds but tracked by the motion canvas
511511
// clock, so this returns the bounds that are being animated at the moment this method is called.

0 commit comments

Comments
 (0)