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

WPF: Updating a cartesian chart with empty data not possible #1365

Open
network-interface-controller opened this issue Nov 18, 2023 · 0 comments

Comments

@network-interface-controller
Copy link

network-interface-controller commented Nov 18, 2023

Describe the bug
In my scenario I have a dropdown in the UI that allows a user to select different data sets which are then visualized by a cartesian chart. However, if a data set is empty and does not possess the considered information the cartesian chart is not updated with the provided empty list of series and shows simply nothing (as other chart types do) but it persists the latest data set that was selected before.

To Reproduce
Steps to reproduce the behavior:

  1. Create a cartesian chart and bind the series property in your XAML view to a public property of type List in your view model
  2. Create a series with data and add it to this list --> data is displayed correctly in UI
  3. Replace the previous series in List by an empty one during runtime --> The previous series is still displayed although the data is obsolete
public List<ISeries> MySeries
{
    get
    {
        if (data == null)
            return new List<ISeries>();

        var dataSeries = new ColumnSeries<double>
        {
            Values = ...,
            Fill = ...,
            DataLabelsPaint = ...,
            DataLabelsPosition = ...,
            DataLabelsFormatter = (chartPoint) => $"...",
            XToolTipLabelFormatter = (chartPoint) => $"...",
            IsVisibleAtLegend = false
        };

        return new List<ISeries> { dataSeries };
    }
}

Expected behavior
Charts behave consistently and cartesian chart (like others) does not display anything if an empty set of data is provided

Desktop (please complete the following information):
OS: Windows 10, Version 22H2
Browser --> Not applicable; WPF app
Version: LiveChartsCore 2.0.0-rc2, LiveChartsCore.SkiaSharpView.WPF 2.0.0-rc2
Framework: .NET 7.0

Smartphone (please complete the following information):
--> NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant