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

Fixes IsVisible and stuck geometries in canvas #1654

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/LiveChartsCore/CartesianSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ public override void SoftDeleteOrDispose(IChartView chart)
}

foreach (var item in deleted) _ = everFetched.Remove(item);

OnVisibilityChanged();
}

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/LiveChartsCore/CorePieSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/LiveChartsCore/CorePolarLineSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/// <inheritdoc cref="ChartElement{TDrawingContext}.GetPaintTasks"/>
Expand Down
5 changes: 0 additions & 5 deletions src/LiveChartsCore/ISeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ public interface ISeries
/// </value>
Func<float, float>? EasingFunction { get; set; }

/// <summary>
/// Occurs when the series <see cref="IsVisible"/> property changes.
/// </summary>
event Action<ISeries>? VisibilityChanged;

/// <summary>
/// Gets the tool tip text for a give chart point.
/// </summary>
Expand Down
14 changes: 1 addition & 13 deletions src/LiveChartsCore/Series.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ public Func<ChartPoint<TModel, TVisual, TLabel>, string> DataLabelsFormatter
public bool IsVisible
{
get => _isVisible;
set
=> SetProperty(ref _isVisible, value);
set => SetProperty(ref _isVisible, value);
}

/// <inheritdoc cref="ISeries.IsHoverable" />
Expand Down Expand Up @@ -304,9 +303,6 @@ public Sketch<TDrawingContext> CanvasSchedule
protected set => SetProperty(ref _miniatureSketch, value);
}

/// <inheritdoc cref="ISeries.VisibilityChanged"/>
public event Action<ISeries>? VisibilityChanged;

/// <inheritdoc cref="IChartSeries{TDrawingContext}.GetStackGroup"/>
public virtual int GetStackGroup()
{
Expand Down Expand Up @@ -462,14 +458,6 @@ protected internal virtual void OnPointCreated(ChartPoint chartPoint)
/// <returns></returns>
protected abstract void SetDefaultPointTransitions(ChartPoint chartPoint);

/// <summary>
/// Called when the visibility changes.
/// </summary>
protected virtual void OnVisibilityChanged()
{
VisibilityChanged?.Invoke(this);
}

/// <summary>
/// Called when the pointer enters a point.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
var changes = 0;

values.CollectionChanged +=
(object? sender, NotifyCollectionChangedEventArgs e) =>

Check warning on line 32 in tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp, x86)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 32 in tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp, x86)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 32 in tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp, x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 32 in tests/LiveChartsCore.UnitTesting/SeriesTests/_SharedPropertiesTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp, x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
changes++;

values.Add(new(1));
Expand All @@ -52,8 +52,11 @@
[TestMethod]
public void VisbilityAndPaintsTasks()
{
var values = new ObservableCollection<DateTimePoint>() { new() };
var lineSeries = new ColumnSeries<DateTimePoint>(values);
// based on:
// https://github.com/beto-rodriguez/LiveCharts2/issues/1164

var values = new ObservableCollection<ObservableValue>() { new(1) };
var lineSeries = new ColumnSeries<ObservableValue>(values);
var chart = new SKCartesianChart
{
Series = [lineSeries],
Expand All @@ -76,5 +79,11 @@
Assert.IsTrue(
drawables == canvas.DrawablesCount &&
geometries == canvas.CountGeometries());

values.Clear();

Assert.IsTrue(
drawables == canvas.DrawablesCount &&
geometries < canvas.CountGeometries());
}
}
Loading