Chart / Charts / Axes / Scales / Scale Types / Logarithmic Scale
In This Topic

    Logarithmic Scale

    In This Topic

    A logarithmic scale is a type of scale where equal distances on the scale represent nonlinear differences in the quantity being plotted. The linear scale is commonly used in chart types that require displaying numeric values that vary significantly in magnitude. Those scales are widely used when you have to plot data where relative changes are more meaningful than absolute differences. The following image shows a logarithmic scale:

     Creating a Logarithmic Scale

    You create a logarithmic scale by creating an instance of the NLogarithmicScale class. The following code shows how to create a logarithmic numeric scale and assign it to the primary Y axis of a Cartesian chart:

    C#
    Copy Code

    NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];
    NLogarithmicScale logarithmicScale = new NLogarithmicScale();

    chart.Axes[ENCartesianAxis.PrimaryY].Scale = logarithmicScale;

     Logarithm Base

    The NLogarithmicScale has a property called LogarithmBase that allows you to control the logarithm base. The following code shows how to change this property to 2 so that the scale uses a binary logarithm instead of the common one (by default, the value of this property is 10):

    C#
    Copy Code

    NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];
    NLogarithmicScale logarithmicScale = new NLogarithmicScale();

    logarithmicScale.LogarithmBase = 2;

    chart.Axes[ENCartesianAxis.PrimaryY].Scale = logarithmicScale;