diff --git a/src/LiveChartsCore/CartesianSeries.cs b/src/LiveChartsCore/CartesianSeries.cs index 5a0c30373..1cf4c4420 100644 --- a/src/LiveChartsCore/CartesianSeries.cs +++ b/src/LiveChartsCore/CartesianSeries.cs @@ -289,8 +289,6 @@ public override void SoftDeleteOrDispose(IChartView chart) } foreach (var item in deleted) _ = everFetched.Remove(item); - - OnVisibilityChanged(); } /// diff --git a/src/LiveChartsCore/CorePieSeries.cs b/src/LiveChartsCore/CorePieSeries.cs index ce324070b..f66c227c1 100644 --- a/src/LiveChartsCore/CorePieSeries.cs +++ b/src/LiveChartsCore/CorePieSeries.cs @@ -646,8 +646,6 @@ public override void SoftDeleteOrDispose(IChartView chart) } foreach (var item in toDelete) _ = everFetched.Remove(item); - - OnVisibilityChanged(); } private void AlignLabel(TLabel label, double start, double initialRotation, double sweep) diff --git a/src/LiveChartsCore/CorePolarLineSeries.cs b/src/LiveChartsCore/CorePolarLineSeries.cs index d4dcb1d6d..6b8d42aaa 100644 --- a/src/LiveChartsCore/CorePolarLineSeries.cs +++ b/src/LiveChartsCore/CorePolarLineSeries.cs @@ -770,8 +770,6 @@ public override void SoftDeleteOrDispose(IChartView chart) if (GeometryFill is not null) canvas.RemovePaintTask(GeometryFill); if (GeometryStroke is not null) canvas.RemovePaintTask(GeometryStroke); - - OnVisibilityChanged(); } /// diff --git a/src/LiveChartsCore/ISeries.cs b/src/LiveChartsCore/ISeries.cs index fb122a45e..60876379c 100644 --- a/src/LiveChartsCore/ISeries.cs +++ b/src/LiveChartsCore/ISeries.cs @@ -144,11 +144,6 @@ public interface ISeries /// Func? EasingFunction { get; set; } - /// - /// Occurs when the series property changes. - /// - event Action? VisibilityChanged; - /// /// Gets the tool tip text for a give chart point. /// diff --git a/src/LiveChartsCore/Series.cs b/src/LiveChartsCore/Series.cs index 552127d5f..1db07ecfb 100644 --- a/src/LiveChartsCore/Series.cs +++ b/src/LiveChartsCore/Series.cs @@ -239,8 +239,7 @@ public Func, string> DataLabelsFormatter public bool IsVisible { get => _isVisible; - set - => SetProperty(ref _isVisible, value); + set => SetProperty(ref _isVisible, value); } /// @@ -304,9 +303,6 @@ public Sketch CanvasSchedule protected set => SetProperty(ref _miniatureSketch, value); } - /// - public event Action? VisibilityChanged; - /// public virtual int GetStackGroup() { @@ -462,14 +458,6 @@ protected internal virtual void OnPointCreated(ChartPoint chartPoint) /// protected abstract void SetDefaultPointTransitions(ChartPoint chartPoint); - /// - /// Called when the visibility changes. - /// - protected virtual void OnVisibilityChanged() - { - VisibilityChanged?.Invoke(this); - } - /// /// Called when the pointer enters a point. /// diff --git a/tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs b/tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs index 4dc8e370a..4b478ac0a 100644 --- a/tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs +++ b/tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs @@ -52,8 +52,11 @@ public void Visibility() [TestMethod] public void VisbilityAndPaintsTasks() { - var values = new ObservableCollection() { new() }; - var lineSeries = new ColumnSeries(values); + // based on: + // https://github.com/beto-rodriguez/LiveCharts2/issues/1164 + + var values = new ObservableCollection() { new(1) }; + var lineSeries = new ColumnSeries(values); var chart = new SKCartesianChart { Series = [lineSeries], @@ -76,5 +79,11 @@ public void VisbilityAndPaintsTasks() Assert.IsTrue( drawables == canvas.DrawablesCount && geometries == canvas.CountGeometries()); + + values.Clear(); + + Assert.IsTrue( + drawables == canvas.DrawablesCount && + geometries < canvas.CountGeometries()); } }