Chart for .NET / User's Guide / Axes / Scale / Manually Programming the Scale / Getting Started

In This Topic
    Getting Started
    In This Topic

    The first thing you should do when you start to create your own scale definitions is to disable the automatic scale configuration update. This will ensure that when you modify the scale your modifications will not be overridden by the scale configurator. This is done by setting the SynchronizeScaleWithConfigurator property of the axis to false (by default it is set to true):

    C#
    Copy Code
    NChart chart = chartControl.Charts[0];
    NAxis primaryX = chart.Axis(StandardAxis.PrimaryX);
    primaryX.SynchronizeScaleWithConfigurator = false;
    
    Visual Basic
    Copy Code
    Dim chart As NChart = chartControl.Charts(0)
    Dim primaryX As NAxis = chart.Axis(StandardAxis.PrimaryX)
    primaryX.SynchronizeScaleWithConfigurator = False
    

    You can also enable scale synchronization with the configurator at any time and enforce the scale configurator to update the scale definition by setting the SynchronizeScaleWithConfigurator to true and then updating the scale:

    C#
    Copy Code
    NChart chart = chartControl.Charts[0];
    NAxis primaryX = chart.Axis(StandardAxis.PrimaryX);
    primaryX.SynchronizeScaleWithConfigurator = true;
    primaryX.InvalidateScale();
    primaryX.UpdateScale();
    
    Visual Basic
    Copy Code
    Dim chart As NChart = chartControl.Charts(0)
    Dim primaryX As NAxis = chart.Axis(StandardAxis.PrimaryX)
    primaryX.SynchronizeScaleWithConfigurator = True
    primaryX.InvalidateScale()
    primaryX.UpdateScale()
    
    If scale synchronization with the configurator is not disabled when you change a property in the configurator it will reset the scale definition and you’ll loose all changes.
     Obtaining a Reference to the Scale

    You obtain a reference to the scale from the Scale property of the NAxis object:

    C#
    Copy Code
    NChart chart = chartControl.Charts[0];
    NAxis primaryX = chart.Axis(StandardAxis.PrimaryX);
    NScale scale = primaryX.Scale;
    
    Visual Basic
    Copy Code
    Dim chart As NChart = chartControl.Charts(0)
    Dim primaryX As NAxis = chart.Axis(StandardAxis.PrimaryX)
    Dim scale As NScale = primaryX.Scale
    
     Related Examples
    Windows Forms: Axes \ Scaling \ Custom Scale Decorations
    See Also