4

I have a 'line' of values where some information might be missing.

e.g.:

Jan - 10, Feb - 20, Mar - 15, Apr - null, Jun - 45 ... etc

I would expect that in the chart the NULL value will simply appear 'empty' (missing) from the line.

e.g.

enter image description here

I have tried using ChartValues<decimal?> but the chart complains in the XAML that it does not know how to plot Nullable1`.

Help?

hyankov
  • 4,049
  • 1
  • 29
  • 46

1 Answers1

4

LiveCharts uses double.NaN instead of null this is the example in the web site:

https://lvcharts.net/App/examples/v1/wpf/Missing%20Points

Series = new SeriesCollection
        {
            new LineSeries
            {
                Values = new ChartValues<double>
                {
                    4,
                    5,
                    7,
                    8,
                    double.NaN,
                    5,
                    2,
                    8,
                    double.NaN,
                    6,
                    2
                }
            }
        };

XAML

<lvc:CartesianChart Series="{Binding Series}"></lvc:CartesianChart> 
bto.rdz
  • 6,636
  • 4
  • 35
  • 52