/// <summary>
        /// Returns the absolute value of the specified percentage value between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="percentage">The percentage.</param>
        /// <returns></returns>
        public override IGraphDataPoint ComputeAbsolutePosition(IGraphDataPoint min, IGraphDataPoint max, double percentage)
        {
            double minimum = ((DateTime)min.GetValue()).Ticks;
            double maximum = ((DateTime)max.GetValue()).Ticks;

            return(new DateTimeDataPoint(new DateTime((long)(minimum + (maximum - minimum) * percentage))));
        }
        /// <summary>
        /// Returns the absolute value of the specified percentage value between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="percentage">The percentage.</param>
        /// <returns></returns>
        public override IGraphDataPoint ComputeAbsolutePosition(IGraphDataPoint min, IGraphDataPoint max, double percentage)
        {
            int minimum = (int)min.GetValue();
            int maximum = (int)max.GetValue();

            return(new Int32DataPoint((int)(minimum + (maximum - minimum) * percentage)));
        }
        /// <summary>
        /// Returns the absolute value of the specified percentage value between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="percentage">The percentage.</param>
        /// <returns></returns>
        public override IGraphDataPoint ComputeAbsolutePosition(IGraphDataPoint min, IGraphDataPoint max, double percentage)
        {
            double minimum = ((TimeSpan)min.GetValue()).TotalMilliseconds;
            double maximum = ((TimeSpan)max.GetValue()).TotalMilliseconds;

            return(new TimeSpanDataPoint(TimeSpan.FromMilliseconds(minimum + (maximum - minimum) * percentage)));
        }
示例#4
0
        /// <summary>
        /// Returns the absolute value of the specified percentage value between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="percentage">The percentage.</param>
        /// <returns></returns>
        public override IGraphDataPoint ComputeAbsolutePosition(IGraphDataPoint min, IGraphDataPoint max, double percentage)
        {
            double minimum = (double)min.GetValue();
            double maximum = (double)max.GetValue();

            return(new FloatDataPoint((float)(minimum + (maximum - minimum) * percentage)));
        }
        /// <summary>
        /// Creates a range of values from the specified minimum and maximum.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        public override IEnumerable <IGraphDataPoint> CreateRange(IGraphDataPoint min, IGraphDataPoint max, int count)
        {
            double minimum = ((TimeSpan)min.GetValue()).TotalMilliseconds;
            double maximum = ((TimeSpan)max.GetValue()).TotalMilliseconds;

            return(Enumerable.Range(0, count).
                   Select(i => minimum + (maximum - minimum) * ((double)i / (count - 1))).
                   Select(x => new TimeSpanDataPoint(TimeSpan.FromMilliseconds(x))));
        }
        /// <summary>
        /// Returns the percentage value of this instance between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <returns></returns>
        public override double ComputeRelativePosition(IGraphDataPoint min, IGraphDataPoint max)
        {
            TimeSpan dMin = min as TimeSpanDataPoint;
            TimeSpan dMax = max as TimeSpanDataPoint;

            var result = ((Value.TotalMilliseconds - dMin.TotalMilliseconds) * 100) / (dMax.TotalMilliseconds - dMin.TotalMilliseconds);

            return(double.IsNaN(result) ? dMin.TotalMilliseconds : result);
        }
示例#7
0
        /// <summary>
        /// Returns the percentage value of this instance between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <returns></returns>
        public override double ComputeRelativePosition(IGraphDataPoint min, IGraphDataPoint max)
        {
            FloatDataPoint dMin = min as FloatDataPoint;
            FloatDataPoint dMax = max as FloatDataPoint;

            var result = ((Value - dMin) * 100) / (dMax - dMin);

            return(double.IsNaN(result) ? dMin.Value : result);
        }
示例#8
0
        /// <summary>
        /// Creates a range of values from the specified minimum and maximum.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        public override IEnumerable <IGraphDataPoint> CreateRange(IGraphDataPoint min, IGraphDataPoint max, int count)
        {
            double minimum = (double)min.GetValue();
            double maximum = (double)max.GetValue();

            return(Enumerable.Range(0, count).
                   Select(i => minimum + (maximum - minimum) * ((double)i / (count - 1))).
                   Select(x => new FloatDataPoint((float)x)));
        }
        /// <summary>
        /// Creates a range of values from the specified minimum and maximum.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        public override IEnumerable <IGraphDataPoint> CreateRange(IGraphDataPoint min, IGraphDataPoint max, int count)
        {
            double minimum = ((DateTime)min.GetValue()).Ticks;
            double maximum = ((DateTime)max.GetValue()).Ticks;

            return(Enumerable.Range(0, count).
                   Select(i => minimum + (maximum - minimum) * ((double)i / (count - 1))).
                   Select(x => new DateTimeDataPoint(new DateTime((long)x))));
        }
        /// <summary>
        /// Returns the percentage value of this instance between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <returns></returns>
        public override double ComputeRelativePosition(IGraphDataPoint min, IGraphDataPoint max)
        {
            Int32DataPoint dMin = min as Int32DataPoint;
            Int32DataPoint dMax = max as Int32DataPoint;

            var result = ((Value - dMin) * 100) / (dMax - dMin);

            return(result);
        }
        /// <summary>
        /// Creates a range of values from the specified minimum and maximum.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        public override IEnumerable <IGraphDataPoint> CreateRange(IGraphDataPoint min, IGraphDataPoint max, int count)
        {
            int minimum = (int)min.GetValue();
            int maximum = (int)max.GetValue();

            return(Enumerable.Range(0, count).
                   Select(i => minimum + (maximum - minimum) * ((int)i / (count - 1))).
                   Select(x => new Int32DataPoint(x)));
        }
        /// <summary>
        /// Returns the percentage value of this instance between the specified minimum and maximum values.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <returns></returns>
        public override double ComputeRelativePosition(IGraphDataPoint min, IGraphDataPoint max)
        {
            DateTime dMin = min as DateTimeDataPoint;
            DateTime dMax = max as DateTimeDataPoint;

            if (dMax.Ticks - dMin.Ticks == 0) //Prevent divide by zero
            {
                return(dMin.Ticks);
            }

            var result = ((Value.Ticks - dMin.Ticks) * 100) / (dMax.Ticks - dMin.Ticks);

            return(double.IsNaN(result) ? dMin.Ticks : result);
        }
示例#13
0
 /// <summary>
 /// Subtract the value of another instance from this instance and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Subtract(IGraphDataPoint other)
 {
     return(new FloatDataPoint(this.Value - (other as FloatDataPoint).Value));
 }
 /// <summary>
 /// Multiplies the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Multiply(IGraphDataPoint other)
 {
     return(new DateTimeDataPoint(new DateTime(this.Value.Ticks * (other as DateTimeDataPoint).Value.Ticks)));
 }
示例#15
0
 /// <summary>
 /// Sums the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Add(IGraphDataPoint other)
 {
     return(new FloatDataPoint(this.Value + (other as FloatDataPoint).Value));
 }
 /// <summary>
 /// Creates a range of values from the specified minimum and maximum.
 /// </summary>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 /// <param name="count">The count.</param>
 /// <returns></returns>
 public static IEnumerable <T> CreateRange <T>(IGraphDataPoint min, IGraphDataPoint max, int count) where T : class, IGraphDataPoint
 {
     return((Activator.CreateInstance(min.GetType()) as T).CreateRange(min, max, count) as IEnumerable <T>);
 }
 /// <summary>
 /// Divides the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Divide(IGraphDataPoint other)
 {
     return(new DateTimeDataPoint(new DateTime(this.Value.Ticks / (other as DateTimeDataPoint).Value.Ticks)));
 }
 /// <summary>
 /// Multiplies the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Multiply(IGraphDataPoint other)
 {
     return(new TimeSpanDataPoint(TimeSpan.FromMilliseconds(this.Value.TotalMilliseconds * (other as TimeSpanDataPoint).Value.TotalMilliseconds)));
 }
 /// <summary>
 /// Creates a range of values from the specified minimum and maximum.
 /// </summary>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 /// <param name="count">The count.</param>
 /// <returns></returns>
 public abstract IEnumerable <IGraphDataPoint> CreateRange(IGraphDataPoint min, IGraphDataPoint max, int count);
 /// <summary>
 /// Divides the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public abstract IGraphDataPoint Divide(IGraphDataPoint other);
 /// <summary>
 /// Returns the percentage value of this instance between the specified minimum and maximum values.
 /// </summary>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 /// <returns></returns>
 public abstract double ComputeRelativePosition(IGraphDataPoint min, IGraphDataPoint max);
 /// <summary>
 /// Subtract the value of another instance from this instance and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public abstract IGraphDataPoint Subtract(IGraphDataPoint other);
 /// <summary>
 /// Multiplies the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public abstract IGraphDataPoint Multiply(IGraphDataPoint other);
 /// <summary>
 /// Sums the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public abstract IGraphDataPoint Add(IGraphDataPoint other);
 /// <summary>
 /// Sums the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Add(IGraphDataPoint other)
 {
     return(new TimeSpanDataPoint(this.Value + (other as TimeSpanDataPoint).Value));
 }
 /// <summary>
 /// Subtract the value of another instance from this instance and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Subtract(IGraphDataPoint other)
 {
     return(new TimeSpanDataPoint(this.Value - (other as TimeSpanDataPoint).Value));
 }
示例#27
0
 /// <summary>
 /// Multiplies the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Multiply(IGraphDataPoint other)
 {
     return(new FloatDataPoint(this.Value * (other as FloatDataPoint).Value));
 }
 /// <summary>
 /// Returns the absolute value of the specified percentage value between the specified minimum and maximum values.
 /// </summary>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 /// <param name="percentage">The percentage.</param>
 /// <returns></returns>
 public abstract IGraphDataPoint ComputeAbsolutePosition(IGraphDataPoint min, IGraphDataPoint max, double percentage);
 /// <summary>
 /// Converts the given value object to the specified type, using the specified context and culture information.
 /// </summary>
 /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param>
 /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo"></see>. If null is passed, the current culture is assumed.</param>
 /// <param name="value">The <see cref="T:System.Object"></see> to convert.</param>
 /// <param name="destinationType">The <see cref="T:System.Type"></see> to convert the value parameter to.</param>
 /// <returns>
 /// An <see cref="T:System.Object"></see> that represents the converted value.
 /// </returns>
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     _instance = value as IGraphDataPoint;
     return(value != null?value.ToString() : null);
 }
 /// <summary>
 /// Divides the value of this instance with another instance value and returns the result.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns></returns>
 public override IGraphDataPoint Divide(IGraphDataPoint other)
 {
     return(new Int32DataPoint(this.Value / (other as Int32DataPoint).Value));
 }