.netCHARTING v10.5 Documentation
Axis Scales

Axis Scales

This section will describe the following:

  • Scale Types
    What the different axis scales offer.
  • Intervals
    Controlling numeric and time tick intervals.
  • Scale Range
    Controlling the axis scale start, end, and range.
  • Scale Breaks
    Using scale breaks.
  • Scale Influentials
    Allow axis markers and custom axis tick to influence axis scale ranges.

Scale Types

Axis scales dictate more than just the values on an axis. They also specify element behavior such as stacked, or FullStacked. The options for the Scale enumeration include:

  • Normal
  • Range
  • Logarithmic
  • Time
  • Stacked
  • FullStacked
  • LogarithmicStacked

Between numeric and time scales, .netCHARTING will automatically set the appropriate scale so it does not always need to be specified explicitly. Scales such as Stacked or FullStacked only apply to axes on which the element y values are plotted because these are the values that are stacked. For example with a combo chart, the Chart.YAxis would be the one to specify a stacked scale.

Other properties that control the scale include:

  • LogarithmicBase
    specifies the logarithmic base of intervals.
  • Percent
    A '%' sign will be added to the end of tick labels and the axis maximum will snap to 100% if the plotted data's range falls between 50 and 100.
  • InvertScale
    reverses the sequence of a scale.


Intervals come in two flavors, numeric, and time. The latter is more complicated so we’ll tackle numeric first.

Controlling the interval is a simple concept. You can specify a numeric interval using code such as:


Chart.YAxis.Interval = 5;
[Visual Basic]

Chart.YAxis.Interval = 5


This will force an interval at every five numeric units. Other interval related properties include:

  • MinimumInterval
    Specifies the minimum numeric interval.
    TIP: This allows you to prevent the axis scale from using intervals that are smaller than a single unit of your data. For example a chart showing votes and the maximum number being 3 may show intervals at .5 which are not desired.
  • TickNumberMaximum
    Specifies the maximum number of ticks to generate.

Time interval

The basic time interval is controlled with the Axis.TimeInterval property


Axis.TimeInterval = TimeInterval.Week;
[Visual Basic]

Axis.TimeInterval = TimeInterval.Week


Advanced time interval

A more complex time interval is also available and can be specified through the Axis.TimeIntervalAdvanced property.


Using the advanced time interval version allows you to specify an interval multiplier. For example we can have an interval every 4 days or 2 weeks etc.


Axis.TimeIntervalAdvanced.Multiplier = 2;
[Visual Basic]

Axis.TimeIntervalAdvanced.Multiplier = 2

Custom time span

A completely custom time span can be used as a time interval.


Axis.TimeIntervalAdvanced.TimeSpan = new TimeSpan(10,5,3);
[Visual Basic]

Axis.TimeIntervalAdvanced.TimeSpan = New TimeSpan(10,5,3)


Custom start time

An interval can also start at any given time. These times can be specified through the following properties:

  • StartMonth
    The month of year at which this interval initially occurs. Value ranges from zero indicating January, to eleven, indicating December.
  • StartDayOfWeek
    The day of the week at which this interval initially occurs. Value ranges from zero indicating Sunday, to six, indicating Saturday.
  • Start
    A DateTime object representing the time instant at which this interval initially occurs. The value of this DateTime structure can be specific down to the millisecond.


The scale’s numeric, time, and category axis boundaries can be specified using the Axis.ScaleRange property. New in version 5.0, the scale range can also represent a range on a category axis.


Chart.YAxis.ScaleRange.ValueHigh = 100;
Chart.YAxis.ScaleRange.ValueLow = 2;
Chart.YAxis.ScaleRange.ValueHigh = new DateTime(2000,12,1);
Chart.YAxis.ScaleRange.ValueLow = new DateTime(2000,1,1);
[Visual Basic]

Chart.YAxis.ScaleRange.ValueHigh = 100
Chart.YAxis.ScaleRange.ValueLow = 2
Chart.YAxis.ScaleRange.ValueHigh = New DateTime(2000,12,1)
Chart.YAxis.ScaleRange.ValueLow = New DateTime(2000,1,1)

Providing a single high or low value without its counterpart is also permitted.


YAxis.ScaleRange.ValueLow = 2;
[Visual Basic]

YAxis.ScaleRange.ValueLow = 2;
Note: Numeric intervals start at zero, therefore, if the minimum value doesn’t land on an interval there may be a gap between the scale’s edge and the first axis tick.

Category Axis Scale Ranges

New in version 5.0, the scale range can also represent a category axis range. It can achieved in two ways. The axis tick label text can be used to specify the range. The other way is to use a zero-based indexes to reference the axis ticks. For example, if there are 10 axis ticks they can be referenced using a numeric index of [0-9]. This code demonstrates the two methods.


// Using names. Chart.XAxis.ExtraTicks.Add(new AxisTick("Element 1", "Element 3", "Range")); // Using indexes. Chart.XAxis.ExtraTicks.Add(new AxisTick(0, 2, "Range"));
[Visual Basic]

' Using names. Chart.XAxis.ExtraTicks.Add(New AxisTick("Element 1", "Element 3", "Range")) ' Using indexes. Chart.XAxis.ExtraTicks.Add(New AxisTick(0, 2, "Range"))

Time Scale Padding

Time scale ranges can be padded with an equal amount of time on either side of the plotted data to produce the final range. This is achieved using Axis.TimePadding.


Chart.XAxis.TimePadding = TimeSpan.FromDays(10);
[Visual Basic]

Chart.XAxis.TimePadding = TimeSpan.FromDays(10)


Scale Breaks

Scale breaks are discontinuities in an axis' scale. They are useful in the following scenarios:

  • When there is a large difference between low and high element values.
  • When element value variations are much smaller than the scale range.
  • When specific days of a week should be excluded in the scale, for example, weekends are not needed in financial charts. Scale breaks can work with a calendar pattern in this case.
    Sample: AxisScaleBreakCalendarPattern.aspx

For the first two cases, the chart engine can automatically generate a scale break by setting Axis.SmartScaleBreak to true.

Sample: AxisScaleBreaks.aspx

Scale breaks are added manually like so:


Axis.ScaleBreaks.Add( new ScaleRange(0,50) );
//Or for time:
Axis.ScaleBreaks.Add( new ScaleRange(new DateTime(2000,1,1), new DateTime(2000,12,1) ) );
[Visual Basic]

Axis.ScaleBreaks.Add( New ScaleRange(0,50) )
'Or for time:
Axis.ScaleBreaks.Add( New ScaleRange(New DateTime(2000,1,1), New DateTime(2000,12,1) ) )


Sample: AxisScaleBreaksManual.aspx


Scale Break Styles

A number of options are available to achieve the scale break style your charts require. The style can be set with the ScaleBreakStyle enumeration at the axis level as shown below.


Chart.YAxis.ScaleBreakStyle = ScaleBreakStyle.ZigZag;
[Visual Basic]

Chart.YAxis.ScaleBreakStyle = ScaleBreakStyle.ZigZag
Sample: AxisScaleBreakStyling.aspx

Scale Influentials
Objects that inherit from ScaleRange, such as AxisMarker and AxisTicks are able to influence the axis’ scale range. For instance, a chart showing bandwidth usage over a period of time with an axis marker representing the bandwidth limit may have elements that will never reach or even come close to the limit marker’s value. Because of this, the limit marker will not be visible on the chart; however, if AxisMarker.IncludeInAxisScale is true, the marker will tell the axis scale range to encompass its value.

Objects that can influence axis scales are:

  • AxisMarker
  • AxisTick
Sample: AxisAffectScale.aspx