Back to Devexpress

AxisBase.TimeSpanScaleOptions Property

corelibraries-devexpress-dot-xtracharts-dot-axisbase-aa238756.md

latest3.9 KB
Original Source

AxisBase.TimeSpanScaleOptions Property

Stores the settings of a scale when its type is time-span.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public TimeSpanScaleOptions TimeSpanScaleOptions { get; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
<PersistenceMode(PersistenceMode.InnerProperty)>
Public ReadOnly Property TimeSpanScaleOptions As TimeSpanScaleOptions

Property Value

TypeDescription
TimeSpanScaleOptions

The time-span axis scale options.

|

Example

The following example shows how to group minute-by-minute data into data points with a greater measurement unit (“Hour”).

To do this, you can use the following code:

csharp
private void Form1_Load(object sender, EventArgs e) {
    XYDiagram diagram = chartControl1.Diagram as XYDiagram;
    if (diagram != null) {
        diagram.AxisX.TimeSpanScaleOptions.ScaleMode = ScaleMode.Manual;
        diagram.AxisX.TimeSpanScaleOptions.MeasureUnit = TimeSpanMeasureUnit.Hour;
        diagram.AxisX.TimeSpanScaleOptions.AggregateFunction = AggregateFunction.Average;
        diagram.AxisX.TimeSpanScaleOptions.GridSpacing = 6;
        diagram.AxisX.TimeSpanScaleOptions.GridAlignment = TimeSpanGridAlignment.Hour;
    }             
}
vb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim diagram As XYDiagram = TryCast(chartControl1.Diagram, XYDiagram)
    If diagram IsNot Nothing Then
        diagram.AxisX.TimeSpanScaleOptions.ScaleMode = ScaleMode.Manual
        diagram.AxisX.TimeSpanScaleOptions.MeasureUnit = TimeSpanMeasureUnit.Hour
        diagram.AxisX.TimeSpanScaleOptions.AggregateFunction = AggregateFunction.Average
        diagram.AxisX.TimeSpanScaleOptions.GridSpacing = 6
        diagram.AxisX.TimeSpanScaleOptions.GridAlignment = TimeSpanGridAlignment.Hour
    End If
End Sub

The example uses the following API members:

MemberDescription
ScaleOptionsBase.ScaleModeGets or sets the scale mode for an axis.
TimeSpanScaleOptions.MeasureUnitGets or sets the detail level for time-span values.
ScaleGridOptionsBase.AggregateFunctionGets or sets the value indicating the aggregate function that should be used to relieve data.
ScaleGridOptionsBase.GridSpacingGets or sets the interval between grid lines and major tickmarks.

See Also

Axis Scale Types

AxisBase Class

AxisBase Members

DevExpress.XtraCharts Namespace