Struct DataRange
Represents a data structure containing two System.Double The first one, From defines the lower bound of the range, while second one, namely To defines the upper bound of the range.
Inherited Members
Namespace: Telerik.Windows.Controls.Charting
Assembly: Telerik.Windows.Controls.Charting.dll
Syntax
public struct DataRange : IEquatable<DataRange>, IEqualityComparer<DataRange>
Constructors
DataRange(Double, Double)
Initializes a new instance of the DataRange struct.
When initialized, the range is normalized, i.e. From value
is the minimal of the from
and to
while
To is the maximal value of those two.
Declaration
public DataRange(double from, double to)
Parameters
System.Double
from
The lower bound of the range. |
System.Double
to
The upper bound of the range. |
Fields
Empty
Defines an empty range [0; 0].
Declaration
public static readonly DataRange Empty
Field Value
DataRange
|
Invalid
Defines an invalid range [double.NaN; double.NaN].
Declaration
public static readonly DataRange Invalid
Field Value
DataRange
|
Unit
Defines a unit range [0; 1].
Declaration
public static readonly DataRange Unit
Field Value
DataRange
|
Properties
Center
Gets the center of the DataRange.
Declaration
public double Center { get; }
Property Value
System.Double
|
From
Gets or sets the lower bound of the range. If it is greater than the value of To, they are swapped.
Declaration
public double From { get; set; }
Property Value
System.Double
|
See Also
IsValid
Gets a value indicating whether this instance is valid, i.e. both From and To are not System.Double.NaN, positive System.Double.PositiveInfinity or System.Double.NegativeInfinity.
Declaration
public bool IsValid { get; }
Property Value
System.Boolean
Returns |
Length
Gets the length of the DataRange.
Declaration
public double Length { get; }
Property Value
System.Double
The actual length. |
See Also
To
Gets or sets the upper bound of the range. If it is less than the value of From, they are swapped.
Declaration
public double To { get; set; }
Property Value
System.Double
|
See Also
Methods
Create(Double, Double)
Creates a new instance of the DataRange structure.
Declaration
public static DataRange Create(double from, double to)
Parameters
System.Double
from
Lower bound of the range. |
System.Double
to
Upper bound of the range. |
Returns
DataRange
New instance of the DataRange structure. |
Equals(Object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
Another object to compare to. |
Returns
System.Boolean
Returns true if |
Overrides
Equals(DataRange)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(DataRange other)
Parameters
DataRange other |
Returns
System.Boolean
Returns true if the current DataRange is equal to the |
Implements
Equals(DataRange, DataRange)
Determines whether the specified DataRange are equal.
Declaration
public bool Equals(DataRange x, DataRange y)
Parameters
DataRange
x
The first object of type |
DataRange
y
The second object of type |
Returns
System.Boolean
Returns true if the specified objects are equal; otherwise, false. |
Implements
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32
A 32-bit signed integer that is the hash code for this instance. |
Overrides
GetHashCode(DataRange)
Returns a hash code for the specified DataRange.
Declaration
public int GetHashCode(DataRange obj)
Parameters
DataRange
obj
The DataRange for which a hash code is to be returned. |
Returns
System.Int32
A hash code for the specified object. |
Implements
Intersect(DataRange)
Calculates the intersection of two DataRanges.
Declaration
public DataRange Intersect(DataRange range)
Parameters
DataRange
range
|
Returns
DataRange
|
Invalidate()
Declaration
public void Invalidate()
Invert(DataRange)
Inverts the specified range.
Declaration
public DataRange Invert(DataRange range)
Parameters
DataRange
range
The range. |
Returns
DataRange
|
Invert(DataRange, DataRange)
Inverts the specified target range.
Declaration
public static DataRange Invert(DataRange source, DataRange target)
Parameters
DataRange
source
The source range. |
DataRange
target
The range to invert. |
Returns
DataRange
|
Log(Double, Double)
Calculates a DataRange with bounds, calculated as logarithm values of the current DataRange.
Declaration
public DataRange Log(double origin, double logarithmBase)
Parameters
System.Double
origin
|
System.Double
logarithmBase
|
Returns
DataRange
|
Multiply(Double)
Scales the range by the specified scale factor.
Declaration
public DataRange Multiply(double scaleFactor)
Parameters
System.Double
scaleFactor
The scale factor. |
Returns
DataRange
|
Normalize(Double)
Normalizes the specified value.
Declaration
public double Normalize(double value)
Parameters
System.Double
value
The value that is to be normalized. |
Returns
System.Double
Value in the range 0.0 to 1.0. |
Normalize(DataRange)
Normalizes the specified range.
Declaration
public DataRange Normalize(DataRange range)
Parameters
DataRange
range
The range. |
Returns
DataRange
|
Normalize(DataRange, Double)
Normalizes the value
to the specified range
.
Declaration
public static double Normalize(DataRange range, double value)
Parameters
DataRange
range
The range. |
System.Double
value
The value. |
Returns
System.Double
Normalized value. |
Normalize(DataRange, DataRange)
Normalizes the specified range.
Declaration
public static DataRange Normalize(DataRange range, DataRange target)
Parameters
DataRange
range
The range. |
DataRange
target
The target. |
Returns
DataRange
|
Restrict(Double)
Restricts the specified value
to be in the current range.
For values bellow the lower bound returns the lower bound,
and for values above the upper bound returns the upper bound.
Declaration
public double Restrict(double value)
Parameters
System.Double
value
The value. |
Returns
System.Double |
Restrict(DataRange, Double)
Restricts the value
to fit the specified range
.
Declaration
public static double Restrict(DataRange range, double value)
Parameters
DataRange
range
The range. |
System.Double
value
The value. |
Returns
System.Double
The restricted value. |
Round()
Rounds a double-precision floating point range value to the nearest integer value.
Declaration
public DataRange Round()
Returns
DataRange
|
Scale(DataRange, Double)
Scales the specified range
by the provided scaleFactor
.
Declaration
public static DataRange Scale(DataRange range, double scaleFactor)
Parameters
DataRange
range
The range. |
System.Double
scaleFactor
The scaleFactor. |
Returns
DataRange
|
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
System.String
A System.String containing a fully qualified type name. |
Overrides
Operators
Equality(DataRange, DataRange)
Implements the operator ==.
Declaration
public static bool operator ==(DataRange range1, DataRange range2)
Parameters
DataRange
range1
The range1. |
DataRange
range2
The range2. |
Returns
System.Boolean
The result of the operator. |
Inequality(DataRange, DataRange)
Implements the operator !=.
Declaration
public static bool operator !=(DataRange range1, DataRange range2)
Parameters
DataRange
range1
The range1. |
DataRange
range2
The range2. |
Returns
System.Boolean
The result of the operator. |
Multiply(Double, DataRange)
Implements the operator *.
Declaration
public static DataRange operator *(double scaleFactor, DataRange range)
Parameters
System.Double
scaleFactor
The scale factor. |
DataRange
range
The range. |
Returns
DataRange
The result of the operator. |
Multiply(DataRange, Double)
Implements the operator *.
Declaration
public static DataRange operator *(DataRange range, double scaleFactor)
Parameters
DataRange
range
The range. |
System.Double
scaleFactor
The scale factor. |
Returns
DataRange
The result of the operator. |