Skip to content

Commit

Permalink
fixes #56
Browse files Browse the repository at this point in the history
  • Loading branch information
beto-rodriguez committed Jun 24, 2021
1 parent a4eec71 commit 7728230
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/LiveChartsCore/ColumnSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}
}
}
34 changes: 34 additions & 0 deletions src/LiveChartsCore/FinancialSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,40 @@ protected override void SetDefaultPointTransitions(ChartPoint chartPoint)
.WithEasingFunction(EasingFunction ?? chart.EasingFunction));
}

/// <inheritdoc cref="Series{TModel, TVisual, TLabel, TDrawingContext}.SoftDeletePoint(ChartPoint, Scaler, Scaler)"/>
protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, Scaler secondaryScale)
{
var visual = (TVisual?)point.Context.Visual;
if (visual == null) return;

var chartView = (ICartesianChartView<TDrawingContext>)point.Context.Chart;
if (chartView.Core.IsZoomingOrPanning)
{
visual.CompleteAllTransitions();
visual.RemoveOnCompleted = true;
return;
}

var p = primaryScale.ToPixels(pivot);
var secondary = secondaryScale.ToPixels(point.SecondaryValue);

visual.X = secondary;
visual.Y = p;
visual.Open = p;
visual.Close = p;
visual.Low = p;
visual.RemoveOnCompleted = true;

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}

/// <summary>
/// Gets the paint tasks.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions src/LiveChartsCore/HeatSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}

/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions src/LiveChartsCore/LineSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}

/// <inheritdoc cref="Series{TModel, TVisual, TLabel, TDrawingContext}.SoftDelete(IChartView)"/>
Expand Down
6 changes: 6 additions & 0 deletions src/LiveChartsCore/PieSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}

/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions src/LiveChartsCore/ScatterSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}
}
}
2 changes: 1 addition & 1 deletion src/LiveChartsCore/Series.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public string GetDataLabelText(ChartPoint point)
/// <param name="primaryScale">The primary scale.</param>
/// <param name="secondaryScale">The secondary scale.</param>
/// <returns></returns>
protected virtual void SoftDeletePoint(ChartPoint point, Scaler primaryScale, Scaler secondaryScale) { }
protected abstract void SoftDeletePoint(ChartPoint point, Scaler primaryScale, Scaler secondaryScale);

/// <summary>
/// Called when a point was measured.
Expand Down
5 changes: 5 additions & 0 deletions src/LiveChartsCore/StackedColumnSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);
var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}
}
}
6 changes: 6 additions & 0 deletions src/LiveChartsCore/StackedRowSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}
}
}
6 changes: 6 additions & 0 deletions src/LiveChartsCore/StepLineSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,12 @@ protected override void SoftDeletePoint(ChartPoint point, Scaler primaryScale, S

if (dataProvider == null) throw new Exception("Data provider not found");
dataProvider.DisposePoint(point);

var label = (TLabel?)point.Context.Label;
if (label == null) return;

label.TextSize = 1;
label.RemoveOnCompleted = true;
}

/// <inheritdoc cref="Series{TModel, TVisual, TLabel, TDrawingContext}.SoftDelete(IChartView)"/>
Expand Down

0 comments on commit 7728230

Please sign in to comment.