samedi 2 décembre 2017

c# wpf checkbox unchecked clear dataseries

I'm plotting data that is held as various lists within a Dictionary, I'm passing these lists into a format the external library can handle when a Checkbox is checked;

private void chkbx_Checked(object sender, RoutedEventArgs e)
{
    var list = dict["ListName"];
    var xyseries = new XyDataSeries<double, double>();
    foreach (var i in list)
    {
        var d = Convert.ToDouble(i);
        xyseries.Append(one++, d);
    }
    series.DataSeries = xyseries;
}

private void chkbx_Unchecked(object sender, RoutedEventArgs e)
{
    series.DataSeries = null;
}

So when i check the Checkbox the data loads without a problem and when i uncheck the data disapears.. great.

However when i go to check the box again, the data doesn't load. I essentially just want to show and hide each list using a Checkbox.

I should note i'm using SciChart, also new to C# & WPF.




Aucun commentaire:

Enregistrer un commentaire