Skip to main content
All docs
V24.1

DataMember.ScaleType Property

Gets or sets the type of data member values.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

[XtraSerializableProperty]
public ScaleType ScaleType { get; set; }

Property Value

Type Description
ScaleType

The data member scale type.

Available values:

Name Description
Qualitative

Identifies the Qualitative data scale. This means that data provided for the Series.Points will be treated as qualitative values and will be shown on the axis as textual representations (e.g., A, B, and C).

Numerical

Identifies the Numerical data scale. This means that data provided for the Series.Points will be treated as numerical values and will be shown on the axis as numbers (e.g., 100, 200, and 300). Note that in this case the AxisBase.NumericOptions property is used to define the output format of numerical values shown on the axis.

DateTime

Identifies the DateTime data scale. This means that data provided for the Series.Points will be treated as DateTime values and will be shown on the axis as DateTime values (e.g., January, 2003, January, 2004, and January, 2005). Note that in this case the AxisBase.DateTimeOptions property is used to define the output format of DateTime values shown on the axis.

TimeSpan

Identifies the TimeSpan data scale. The data that you provide for the Series.Points will be treated and shown on the axis as TimeSpan values (for example, 00:00:00, 00:00:01, 00:00:02). Note that in this case, the axis’s TimeSpanScaleOptions property allows you to specify the scale-related settings. To define the output format of TimeSpan values shown on the axis, use the AxisBase.Label‘s TextPattern property.

Auto

The scale type is automatically determined according to the real type of underlying data.

Example

This example shows how to create a series that requires one value per argument and populate it with data.

using DevExpress.Utils;
using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace ChartDataAdapters {
    public partial class Form1 : Form {
        readonly TemperatureData temperatureData = new TemperatureData(new Random(9));
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e) {
            // Create a series.
            Series series = new Series("Temperature", ViewType.Spline);

            // Create a data adapter.
            DataSourceAdapter dataAdapter = new DataSourceAdapter();

            // Specify the data source.
            dataAdapter.DataSource = temperatureData.Points;

            // Create a data member that defines arguments.
            dataAdapter.DataMembers.Add(new DataMember {
                DataMemberType = ChartDataMemberType.Argument,
                ColumnName = "TimeStamp",
                ScaleType = ScaleType.TimeSpan
            });
            // Create a data member that defines values.
            dataAdapter.DataMembers.Add(new DataMember {
                DataMemberType = ChartDataMemberType.Value,
                ColumnName = "Temperature",
                ScaleType = ScaleType.Numerical
            });

            // Assign the data adapter to the series.
            series.DataAdapter = dataAdapter;
        }
    }
    class TemperatureData {
        const int PointsCount = 250;
        readonly TemperaturePoint maxTemperaturePoint = new TemperaturePoint(TimeSpan.Zero, double.MinValue);
        readonly TemperaturePoint minTemperaturePoint = new TemperaturePoint(TimeSpan.MaxValue, double.MaxValue);
        readonly List<TemperaturePoint> points = new List<TemperaturePoint>(PointsCount);
        internal TemperaturePoint MaxTemperaturePoint {
            get { return maxTemperaturePoint; }
        }
        internal TemperaturePoint MinTemperaturePoint {
            get { return minTemperaturePoint; }
        }
        internal double OptimalTemperature {
            get { return 53; }
        }
        internal List<TemperaturePoint> Points {
            get { return points; }
        }
        internal TemperatureData(Random random) {
            double preTemperature = 50;
            for (int i = 0; i < PointsCount; i++) {
                TimeSpan time = TimeSpan.FromSeconds(i);
                double temperature = preTemperature + (random.NextDouble() - 0.5) * 10;
                if (temperature > 90)
                    temperature -= 20;
                if (temperature < 20)
                    temperature += 10;
                TemperaturePoint temperaturePoint = new TemperaturePoint(time, temperature);
                if (temperature < minTemperaturePoint.Temperature)
                    minTemperaturePoint = temperaturePoint;
                if (temperature > maxTemperaturePoint.Temperature)
                    maxTemperaturePoint = temperaturePoint;
                points.Add(temperaturePoint);
                preTemperature = temperature;
            }
        }
    }
    public class TemperaturePoint {
        public TimeSpan TimeStamp { get; private set; }
        public double Temperature { get; private set; }

        internal TemperaturePoint(TimeSpan time, double temperature) {
            this.TimeStamp = time;
            this.Temperature = temperature;
        }
    }
}
See Also