NaN() public static method

Returns a UnitValue representing an invalid value.
public static NaN ( ) : UnitValue
return UnitValue
Example #1
0
        /// <summary>
        /// Returns the plot area coordinate of a value.
        /// </summary>
        /// <param name="value">The value to plot.</param>
        /// <param name="currentRange">The range to use determine the coordinate.</param>
        /// <param name="length">The length of the axis.</param>
        /// <returns>The plot area coordinate of a value.</returns>
        private static UnitValue GetPlotAreaCoordinate(object value, Range <DateTime> currentRange, double length)
        {
            if (currentRange.HasData)
            {
                DateTime dateTimeValue = ValueHelper.ToDateTime(value);

                double rangelength = currentRange.Maximum.Ticks - currentRange.Minimum.Ticks;
                double pixelLength = Math.Max(length - 1, 0);

                return(new UnitValue((dateTimeValue.Ticks - currentRange.Minimum.Ticks) * (pixelLength / rangelength), Unit.Pixels));
            }

            return(UnitValue.NaN());
        }
Example #2
0
        /// <summary>
        /// The plot area coordinate of a value.
        /// </summary>
        /// <param name="value">The value for which to retrieve the plot area
        /// coordinate.</param>
        /// <returns>The plot area coordinate.</returns>
        public override UnitValue GetPlotAreaCoordinate(object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Range <UnitValue> range = GetPlotAreaCoordinateRange(value);

            if (range.HasData)
            {
                double minimum = range.Minimum.Value;
                double maximum = range.Maximum.Value;
                return(new UnitValue(((maximum - minimum) / 2.0) + minimum, range.Minimum.Unit));
            }
            else
            {
                return(UnitValue.NaN());
            }
        }