skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class 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.

Inheritance
System.Object
DataRange
Namespace: Telerik.Windows.Controls.Charting
Assembly: Telerik.Windows.Controls.Charting.dll

Syntax

public sealed class DataRange : ValueType, 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
From
Length

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 true if this instance is valid; otherwise, false.

Length

Gets the length of the DataRange.

Declaration
public double Length { get; }
Property Value
System.Double

The actual length.

See Also
From
To

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
To
Length

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 obj and this instance are the same type and represent the same value; otherwise, false.

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

A DataRange to compare with this DataRange.

Returns
System.Boolean

Returns true if the current DataRange is equal to the other parameter; otherwise, false.

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 x to compare.

DataRange y

The second object of type y to compare.

Returns
System.Boolean

Returns true if the specified objects are equal; otherwise, false.

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.

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.

Intersect(DataRange)

Calculates the intersection of two DataRanges.

Declaration
public DataRange Intersect(DataRange range)
Parameters
DataRange range

Returns
DataRange

Invalidate()

Invalidates the range, setting System.Double.NaN to both From and To.

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

Value in the range [From; To].

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.

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.

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.