To use a custom numeric scale in Automatic scale mode, assign an object of a class implementing the INumericMeasureUnitsCalculator interface to the AutomaticDateTimeScaleOptions.AutomaticMeasureUnitsCalculator property of an AutomaticNumericScaleOptions object assigned to AxisX2D.NumericScaleOptions.
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.NumericScaleOptions>
<dxc:AutomaticNumericScaleOptions>
<dxc:AutomaticNumericScaleOptions.AutomaticMeasureUnitsCalculator>
<local:NumericMeasureUnitsCalculator/>
</dxc:AutomaticNumericScaleOptions.AutomaticMeasureUnitsCalculator>
</dxc:AutomaticNumericScaleOptions>
</dxc:AxisX2D.NumericScaleOptions>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
using DevExpress.Xpf.Charts;
using System;
using System.Collections.Generic;
namespace CustomNumericMeasureUnitsCalculatorSample {
class NumericMeasureUnitsCalculator : INumericMeasureUnitsCalculator {
public double CalculateMeasureUnit(
IEnumerable<Series> series,
double axisLength,
int pixelsPerUnit,
double visualMin,
double visualMax,
double wholeMin,
double wholeMax) {
return Math.Max(1, Math.Ceiling((visualMax - visualMin) / 20.0));
}
}
}
Imports DevExpress.Xpf.Charts
Namespace CustomNumericMeasureUnitsCalculatorSample
Friend Class NumericMeasureUnitsCalculator
Implements INumericMeasureUnitsCalculator
Public Function CalculateMeasureUnit(
ByVal series As IEnumerable(Of Series),
ByVal axisLength As Double,
ByVal pixelsPerUnit As Integer,
ByVal visualMin As Double,
ByVal visualMax As Double,
ByVal wholeMin As Double,
ByVal wholeMax As Double) As Double Implements INumericMeasureUnitsCalculator.CalculateMeasureUnit
Return Math.Max(1, Math.Ceiling((visualMax - visualMin) / 20.0))
End Function
End Class
End Namespace