ManualTimeSpanScaleOptions.MeasureUnit Property
Gets or sets the detail level for time-span values.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v24.1.dll
NuGet Package: DevExpress.Wpf.Charts
Declaration
Property Value
Type | Description |
---|---|
TimeSpanMeasureUnit | An axis measurement unit that represents the detail level of data associated with the axis. |
Available values:
Name | Description |
---|---|
Millisecond | Specifies millisecond as the measurement unit for a time-span axis. |
Second | Specifies second as the measurement unit for a time-span axis. |
Minute | Specifies minute as the measurement unit for a time-span axis. |
Hour | Specifies hour as the measurement unit for a time-span axis. |
Day | Specifies day as the measurement unit for a time-span axis. |
Remarks
The following images show how changes to the aggregate function and measure unit affect the representation of minute-by-minute chart data.
MeasureUnit = “Minute”; AggregateFunction = “None”:
MeasureUnit = “Hour”; AggregateFunction = “None”:
MeasureUnit = “Hour”; AggregateFunction = “Average”:
Example
The following example shows how to group minute-by-minute data into data points with a greater measurement unit (“Hour”).
- Use the
ManualTimeSpanScaleOptions.MeasureUnit
property to specify the measurement unit that should be greater than the initial data measurement unit. To change an arithmetic function used for computing point aggregates, use ManualTimeSpanScaleOptions.AggregateFunction.
Optionally, you can specify the ManualTimeSpanScaleOptions.GridAlignment, ManualTimeSpanScaleOptions.GridSpacing, and ManualTimeSpanScaleOptions.GridOffset properties.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TimeSpanExample"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
x:Class="TimeSpanExample.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.DataContext>
<local:ChartViewModel/>
</Window.DataContext>
<Grid>
<dxc:ChartControl>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.TimeSpanScaleOptions>
<dxc:ManualTimeSpanScaleOptions GridAlignment="Hour"
GridSpacing="4"
MeasureUnit="Hour"
AggregateFunction="Average"
GridOffset="2"
AutoGrid="False"/>
</dxc:AxisX2D.TimeSpanScaleOptions>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<!-- Other diagram settings. -->
</dxc:XYDiagram2D>
</dxc:ChartControl>
</Grid>
</Window>