- 4 minutes to read
This document describes how an axis (as well as the diagram to which it belongs) can be broken into multiple scale ranges, separated by the so-called scale breaks. Before you proceed with this document, you may wish to review the basics of using axes.
This document consists of the following sections.
- Scale Breaks Overview
- Auto Scale Breaks
- Insert a Scale Break Manually
- Customize Scale Breaks’ Appearance
Scale Breaks Overview
A scale break is an area across an axis which is shown in place of a section of the axis’ range. It appears across the original axis as a ragged (or wavy or straight, depending on the desired appearance) line.
The most common reason for using scale breaks is when a chart has useless space. This happens when the chart’s series represent data with great leaps in range. For example, when a series represents a continuous flow of values in both decimals and thousands, by default. This data does not provide any useful information, since neither series point has any value within this range, and the leap has no points. So, it is natural to replace these empty ranges with ragged lines - scale breaks.
You can add multiple scale breaks to an axis of any scale type, whether or not this axis uses a logarithmic scale.
When you add scale breaks, it does not matter whether their ranges intersect, or exceed the visible axis range. The ASP.NET Chart Control will automatically merge intersecting scale breaks, and adjust the axis range. Scale breaks depend on the settings of axis scale elements, for example, axis’ grid lines, tickmarks, as well as the axis labels.
Auto Scale Breaks
You can force the WebChartControl to automatically insert scale breaks into an axis via the Axis.AutoScaleBreaks property. To do this at design time, locate an axis in the Properties window, expand the Axis.AutoScaleBreaks property, and set the AutoScaleBreaks.Enabled property to true.
Then, if your chart’s data suggests using scale breaks, they will be created automatically.
You can limit the maximum number of automatic scale breaks, via the AutoScaleBreaks.MaxCount property, whose minimum value is 1.
Note that auto-calculated scale breaks and manually added scale breaks can co-exist in the ScaleBreakCollection.
For more inforation, refer to How to: Enable Automatic Scale Breaks for an Axis.
Insert a Scale Break Manually
Apart from automatic scale breaks, you have the capability to manually assign scale breaks to an axis.
To access this collection at design time, locate an axis in the Properties window, and click the ellipsis button of the Axis.ScaleBreaks property.
This invokes the Scale Break Collection Editor.
After a scale break is added to the collection, define the range which a scale break represents. The limits of that range are determined by two properties: the ScaleBreak.Edge1 and ScaleBreak.Edge2 properties.
The values of these properties should be defined in measurement units appropriate for the axis scale type.
It does not matter whether the value of the ScaleBreak.Edge1 property is less or greater than the value of the ScaleBreak.Edge2 property. It is only important that their values are different, because if the values of these properties are equal, a scale break is considered invisible.
To define a custom name for a scale break, use its ChartElementNamed.Name property.
For more information, refer to How to: Manually Insert a Scale Break into an Axis or How to: Manually Insert a Scale Break into an Axis (Runtime Sample).
Customize Scale Breaks’ Appearance
To define the overall appearance for both automatic and manual scale breaks, use the Axis.ScaleBreakOptions property.
This property provides access to the following options:
- The ScaleBreakOptions.Color property determines the color of the scale breaks’ edges;
- The ScaleBreakOptions.SizeInPixels property determines the width of scale breaks, in pixels;
- The ScaleBreakOptions.Style property allows you to choose whether scale breaks should have their edges straight, wavy or ragged.