AxisScaleBreakStyle Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a scale break on the Y-axis of the chart.
public ref class AxisScaleBreakStyle
public class AxisScaleBreakStyle
type AxisScaleBreakStyle = class
Public Class AxisScaleBreakStyle
- Inheritance
-
AxisScaleBreakStyle
Examples
The following code example demonstrates how to enable and customize a scale break after the Chart control has been added to the design surface.
Imports System.Web.UI.DataVisualization.Charting
Private Function AddChartData()
chart1.Series("Default").Points.Add(New DataPoint(1, 2))
chart1.Series("Default").Points.Add(New DataPoint(2, 4))
chart1.Series("Default").Points.Add(New DataPoint(3, 400000))
chart1.Series("Default").Points.Add(New DataPoint(4, 3))
End Sub
Private Function AddScaleBreaks()
' Enable scale breaks.
chart1.ChartAreas("Default").AxisY.ScaleBreakStyle.Enabled = True
' Show scale break if more than 25% of the chart is empty space.
chart1.ChartAreas("Default").AxisY.ScaleBreakStyle.CollapsibleSpaceThreshold = 25
' Set the line width of the scale break.
chart1.ChartAreas("Default").AxisY.ScaleBreakStyle.LineWidth = 2
' Set the color of the scale break.
chart1.ChartAreas("Default").AxisY.ScaleBreakStyle.LineColor = Color.Red
' If all data points are significantly far from zero, the chart will calculate the scale minimum value.
chart1.ChartAreas("Default").AxisY.ScaleBreakStyle.StartFromZero = StartFromZero.Auto
' Set the spacing gap between the lines of the scale break (as a percentage of the Y-axis).
chart1.ChartAreas["Default"].AxisY.ScaleBreakStyle.Spacing = 2;
End Function
using System.Web.UI.DataVisualization.Charting
private void AddChartData()
{
chart1.Series["Series1"].Points.Add(new DataPoint(1, 2));
chart1.Series["Series1"].Points.Add(new DataPoint(2, 4));
chart1.Series["Series1"].Points.Add(new DataPoint(3, 400000));
chart1.Series["Series1"].Points.Add(new DataPoint(4, 3));
}
private void AddScaleBreaks()
{
// Enable scale breaks.
chart1.ChartAreas["ChartArea1"].AxisY.ScaleBreakStyle.Enabled = true;
// Show scale break if more than 25% of the chart is empty space.
chart1.ChartAreas["ChartArea1"].AxisY.ScaleBreakStyle.CollapsibleSpaceThreshold = 25;
// Set the line width of the scale break.
chart1.ChartAreas["ChartArea1"].AxisY.ScaleBreakStyle.LineWidth = 2;
// Set the color of the scale break.
chart1.ChartAreas["ChartArea1"].AxisY.ScaleBreakStyle.LineColor = Color.Red;
// If all data points are significantly far from zero, the chart will calculate the scale minimum value.
chart1.ChartAreas["ChartArea1"].AxisY.ScaleBreakStyle.StartFromZero = StartFromZero.Auto;
// Set the spacing gap between the lines of the scale break (as a percentage of the Y-axis).
chart1.ChartAreas["ChartArea1"].AxisY.ScaleBreakStyle.Spacing = 2;
}
Remarks
Scale breaks are intentional discontinuities on the Y-axis that are most often used to redistribute the data points in a series on a chart. This feature improves readability when there are large differences between the high and low values of the data in one series being plotted. Scale breaks are not drawn for differences between data in multiple series.
By default, scale breaks are disabled. You can enable scale breaks on the Y-axis by setting the Enabled property to true
. To change the amount of vertical space of the scale break, you can specify a Spacing value. This is calculated as a percentage of the Y-axis scale.
You must have sufficient separation between ranges of data points in a single series to draw a scale break. By default, a scale break can be added only if there is a separation between the data ranges of at least 25% of the chart. If you enable a scale break but it does not appear, even though there is sufficient distance between the data ranges, you can set the CollapsibleSpaceThreshold property to a value less than 25.
Charts support up to five scale breaks per chart; however, the chart can become unreadable if you display more than one scale break. If you have more than two data ranges, consider using a different method for displaying this data. Use the MaxNumberOfBreaks property to reduce the number of scale breaks that can be displayed on the chart.
When a scale break is used, the Y-axis labels may become offset. To disable the label offset, set the IsStaggered property to false
.
Scale breaks are not supported under any of the following conditions:
Pie, doughnut, funnel, pyramid, radial or any stacked chart types are used.
Custom intervals for labels, tick marks or grid lines are enabled.
The minimum or maximum value for the axis is set.
Custom labels are used.
A logarithmic Y-axis is specified.
Axis views on the Y-axis, which include scrolling and zooming, are used.
3-D charts are used.
Constructors
AxisScaleBreakStyle() |
Initializes a new instance of the AxisScaleBreakStyle class. |
Properties
BreakLineStyle |
Gets or sets the style of the break line that will be used to draw the scale break. |
CollapsibleSpaceThreshold |
Gets or sets the threshold of space on the chart at which scale breaks are drawn. |
Enabled |
Gets or sets a flag that indicates whether scale breaks are enabled. |
LineColor |
Gets or sets the color of the scale break line. |
LineDashStyle |
Gets or sets the style of the scale break line. |
LineWidth |
Gets or sets the width of the scale break line. |
MaxNumberOfBreaks |
Gets or sets the maximum number of scale breaks to be displayed on the chart. |
Spacing |
Gets or sets the spacing gap between the lines of the scale break. The spacing gap is represented as a percentage of the Y-axis. |
StartFromZero |
Gets or sets a StartFromZero enumeration value that indicates whether to start the scale break from zero. |
Methods
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |