Missing values

Aug 21, 2011 at 1:36 PM


i've just started to use D3 in my project.

I've seen the XMissingValue and YMissingValue properties and wanted tu use them.

I've tried to add values like:
(1,4) (2,9) (3,8) (8,NaN) (13,3) (14,8) ...

But if I do so my graph gets competelly messed up!

Is it possible that this feature is not fully implemented so far?
When i search for references to MissingValueSplitter or YMissingValue I can not find a single reference to it.

If not implemented now, is there a plan to do so in near future?


Aug 21, 2011 at 4:11 PM

Couldn't wait for some solution, so I did some debuggingon my own.

I came up with the follosing solution:

I modified the BoundsHelper.GetViewportBounds() method as follows:

public static DataRect GetViewportBounds(IEnumerable<Point> viewportPoints)
			DataRect bounds = DataRect.Empty;

			double xMin = Double.PositiveInfinity;
			double xMax = Double.NegativeInfinity;

			double yMin = Double.PositiveInfinity;
			double yMax = Double.NegativeInfinity;

			foreach (Point p in viewportPoints)
            if (!Double.IsNaN(p.X))
               xMin = Math.Min(xMin, p.X);
               xMax = Math.Max(xMax, p.X);

            if (!Double.IsNaN(p.Y))
               yMin = Math.Min(yMin, p.Y);
               yMax = Math.Max(yMax, p.Y);

			// were some points in collection
			if (!Double.IsInfinity(xMin))
				bounds = DataRect.Create(xMin, yMin, xMax, yMax);

			return bounds;

Add the X or Y value to the bounds only if it sin not NaN.

Works perfectly for me