Xceed Chart for WinForms v4.4 Documentation
Logarithmic Scale

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Axes > Scaling > Logarithmic Scale

Logarithmic scale mode is often used as an alternative to the default scale mode (numeric) for the PrimaryY and SecondaryY chart axes (for details, see StandardAxis Enumeration). When operating in this mode, the axes scale the data contained in the data series logarithmically. 

The properties of the logarithmic scale are controlled through an instance of the AxisScaleLogarithmic class, which is accessible through the LogarithmicScale property of the Axis class. The AxisScaleLogarithmic class is a direct descendant of the AxisScaleValue class and inherits all its functionality. It also implements control over the following aspects of a logarithmic scale.

Controlling the Logarithmic Base

The user can control the base of the logarithm with the LogarithmBase property. It is by default set to 10 (Base10 logarithm). The following code changes the logarithm base of the PrimaryY axis to 2:

VB.NET  
Chart.Axis(StandardAxis.PrimaryY).LogarithmScale.LogarithmBase = 2
C#  
Chart.Axis(StandardAxis.PrimaryY).LogarithmScale.LogarithmBase = 2;

Controlling Major Tick Generation in Logarithmic Scale Mode

The user can control the mode in which the major ticks are generated with the MajorTickMode property, which is of type MajorTickModeLogarithmic and can accept the following values (for details, see MajorTickModeLogarithmic Enumeration): 

Manual
PowAutoStep

PowCustomStep

AbsAutoStep

AbsCustomStep
 

The following is a description of these modes:

VB.NET  

Dim axis As Axis = Chart.Axis(StandardAxis.PrimaryY)

axis.ScaleMode = AxisScaleMode.Logarithmic

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.Manual

axis.MajorTicks.Clear()

axis.MajorTicks.Add(10)

axis.MajorTicks.Add(100)

axis.MajorTicks.Add(1000)

C#  

Axis axis = Chart.Axis(StandardAxis.PrimaryY);
axis.ScaleMode = AxisScaleMode.Logarithmic;
axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.Manual;
axis.MajorTicks.Clear();
axis.MajorTicks.Add(10);
axis.MajorTicks.Add(100);
axis.MajorTicks.Add(1000);

VB.NET  

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.PowAutoStep

axis.LogarithmicScale.MaxTickCount = 10

C#  

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.PowAutoStep;
axis.LogarithmicScale.MaxTickCount = 10;

VB.NET  

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.PowCustomStep

axis.LogarithmicScale.CustomStep = 2

C#  
axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.PowCustomStep;
axis.LogarithmicScale.CustomStep = 2;
VB.NET  

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.AbsAutoStep

axis.LogarithmicScale.MaxTickCount = 10

C#  
axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.AbsAutoStep;
axis.LogarithmicScale.MaxTickCount = 10;
 
VB.NET  

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.AbsCustomStep

axis.LogarithmicScale.CustomStep = 1000

C#  

axis.LogarithmicScale.MajorTickMode = MajorTickModeLogarithmic.AbsCustomStep;
axis.LogarithmicScale.CustomStep = 1000;

 

Demonstration of the Logarithmic Major Tick modes
Manual (from Series Values) Power with Auto Step
Power with Custom Step
(in this case 1)
Absolute with Auto Step
(in this case 5000)
Absolute with Custom Step
(in this case 4600)

 

 

Controlling Minor Ticks in Logarithmic Scale Mode

If minor ticks are automatically generated by the logarithmic scale ( AutoMinorTicks is set to true), the user can control the density of the minor ticks with the help of the MinorTickCount property (inherited from AxisScaleValue ). This property specifies the number of minor ticks between two major ticks. By default the minor ticks are displayed at equal absolute value intervals. The user can override this behavior and display them on equal power intervals by setting the ExponentMinorTicks to true:

VB.NET  
Chart.Axis(StandardAxis.PrimaryY).ExponentMinorTicks = True
C#  
Chart.Axis(StandardAxis.PrimaryY).ExponentMinorTicks = true;

Related Examples

Windows Forms: Axes\Scaling\Logarithmic Scale

See Also

Axis Scales | Axis | AxisScale | AxisScaleValue | AxisScaleLogarithmic