Range
Abstract base implementation of IRange, used throughout Ultrachart for visible, data and index range calculations
Inherits: BindableObject
Implements: IRange<T>, IRange, ICloneable, INotifyPropertyChanged
Constructors
protected Range(T min, T max)
range = Range(min, max)
Initializes a new instance of the Range class.
- min
- The min value.
- max
- The max value.
Properties
public virtual bool IsDefined { get; }
value = range.IsDefined
Gets whether this Range is defined
public abstract bool IsZero { get; }
value = range.IsZero
Gets whether the range is Zero, where Max equals Min
public T Max { get; set; }
value = range.Max
range.Max = value
Gets or sets the Max value of this range
public T Min { get; set; }
value = range.Min
range.Min = value
Gets or sets the Min value of this range
StockSharp#Xaml#Charting#IRange#Diff
Gets the difference (Max - Min) of this range
StockSharp#Xaml#Charting#IRange#Max
Gets or sets the Max value of this range
StockSharp#Xaml#Charting#IRange#Min
Gets or sets the Min value of this range
Methods
public abstract DoubleRange AsDoubleRange()
result = range.AsDoubleRange()
Converts this range to a DoubleRange, which are used internally for calculations
public IRange ClipTo(IRange maximumRange, RangeClipMode clipMode)
result = range.ClipTo(maximumRange, clipMode)
Clips the current IRange to a maximum according to clip mode
- maximumRange
- The maximum range
- clipMode
- clip mode which defines how to clip range
Returns: This instance, after the operation
public IRange ClipTo(IRange maximumRange)
result = range.ClipTo(maximumRange)
Clips the current IRange to a maxmimum range with MinMax mode
- maximumRange
- The Maximum Range
Returns: This instance, after the operation
public abstract IRange<T> ClipTo(IRange<T> maximumRange)
result = range.ClipTo(maximumRange)
Clips the current IRange to a maxmimum range
- maximumRange
- The Maximum Range
Returns: This instance, after the operation
public abstract object Clone()
result = range.Clone()
Creates a new object that is a copy of the current instance.
Returns: A new object that is a copy of this instance.
public bool Equals(IRange<T> other)
result = range.Equals(other)
Compares Min and Max values to determine whether the specified IRange is equal to this instance.
- other
- The IRange to compare with the current IRange.
Returns: true if the specified IRange is equal to this instance; otherwise, false.
public override bool Equals(object obj)
result = range.Equals(obj)
Compares Min and Max values to determine whether the specified Object is equal to this instance.
- obj
- The Object to compare with the current Object.
Returns: true if the specified Object is equal to this instance; otherwise, false.
public override int GetHashCode()
result = range.GetHashCode()
Returns a hash code for this instance.
Returns: A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
public abstract IRange<T> GrowBy(double minFraction, double maxFraction)
result = range.GrowBy(minFraction, maxFraction)
Grows the current IRange by the min and max fraction, returning this instance after modification
- minFraction
- The Min fraction to grow by. For example, Min = -10 and minFraction = 0.1 will result in the new Min = -11
- maxFraction
- The Max fraction to grow by. For example, Max = 10 and minFraction = 0.2 will result in the new Max = 12
Returns: This instance, after the operation
public bool IsValueWithinRange(IComparable value)
result = range.IsValueWithinRange(value)
Returns True if the value is within the Min and Max of the Range
- value
- The value to test
Returns: True if the value is within the Min and Max of the Range
public abstract IRange<T> SetMinMax(double min, double max, IRange<T> maxRange)
result = range.SetMinMax(min, max, maxRange)
Sets the Min, Max values on the IRange with a maximum range limit, returning this instance after modification
- min
- The new Min value.
- max
- The new Max value.
- maxRange
- The max range.
Returns: This instance, after the operation
public abstract IRange<T> SetMinMax(double min, double max)
result = range.SetMinMax(min, max)
Sets the Min, Max values on the IRange, returning this instance after modification
- min
- The new Min value.
- max
- The new Max value.
Returns: This instance, after the operation
protected void SetMinMaxInternal(T min, T max)
range.SetMinMaxInternal(min, max)
Internal implementation: Sets the Min, Max values of the Range
- min
- The new Min value
- max
- The new Max value
StockSharp#Xaml#Charting#IRange#GrowBy(double, double)
Grows the current IRange by the min and max fraction, returning this instance after modification
- minFraction
- The Min fraction to grow by. For example, Min = -10 and minFraction = 0.1 will result in the new Min = -11
- maxFraction
- The max fraction.
Returns: This instance, after the operation
StockSharp#Xaml#Charting#IRange#SetMinMax(double, double)
Sets the Min, Max values on the IRange, returning this instance after modification
- min
- The new Min value.
- max
- The new Max value.
Returns: This instance, after the operation
StockSharp#Xaml#Charting#IRange#SetMinMaxWithLimit(double, double, IRange)
Sets the Min, Max values on the IRange with a max range to clip values to, returning this instance after modification
- min
- The new Min value.
- max
- The new Max value.
- maxRange
- The max range, which is used to clip values.
Returns: This instance, after the operation
public override string ToString()
result = range.ToString()
Returns the String that represents current IRange.
Returns: A String that represents this instance.
public IRange Union(IRange range)
result = range.Union(range)
Performs the Union of two IRange instances, returning a new IRange
public IRange<T> Union(IRange<T> range)
result = range.Union(range)
Performs a Union logical operation between two ranges. The returned IRange has Min = Math.Min(range1.min, range2.min) and Max = Math.Max(range1.Max, range2.Max)
- range
- The input range to union with this range
Returns: The range result