When plotting some data with NaNs I was having some display issues. This is the code I used to draw only values that are not double.NaN. The NaNs appear as a break in the linegraph.
I put this code in the LineGraph class:
protected override void OnRenderCore(DrawingContext dc, RenderState state)
if (DataSource == null) return;
dc.PushTransform(new TranslateTransform(Offset.X, Offset.Y));
using (StreamGeometryContext context = streamGeometry.Open())
Point lastPoint = new Point(0, double.NaN);
foreach (var point in filteredPoints)
if(!double.IsNaN(point.Y) && double.IsNaN(lastPoint.Y))
context.BeginFigure(point, false, false);
context.LineTo(point, true, true);
lastPoint = point;
dc.DrawGeometry(null, LinePen, streamGeometry);
Just thought I would post incase anyone else wanted something like this.