AxisScaleBreakStyle 類別

定義

表示圖表 Y 軸上的刻度分欄。

public ref class AxisScaleBreakStyle
public class AxisScaleBreakStyle
type AxisScaleBreakStyle = class
Public Class AxisScaleBreakStyle
繼承
AxisScaleBreakStyle

範例

下列程式碼範例示範如何在 Chart 控制項新增至設計介面之後,啟用和自訂刻度中斷。

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;  
}  

備註

刻度中斷是在 Y 軸上刻意不連續的,最常用來將數列中的資料點重新發佈至圖表上。 當一個數列中的資料的最高值與最小值之間有很大的差異時,這項功能會提高可讀性。 在多個數列中的資料差異時,不會繪製刻度中斷。

依預設,會停用刻度中斷。 您可以藉由將屬性設定為,來啟用 Y 軸的刻度中斷 Enabled true 。 若要變更刻度中斷的垂直空間量,您可以指定一個 Spacing 值。 這是以 Y 軸尺規的百分比計算。

您必須在單一數列中的資料點範圍之間進行足夠的分隔,以繪製刻度中斷。 根據預設,只有當至少圖表百分之 25 的資料範圍之間有分隔時,才可以加入刻度斷層。 如果您啟用刻度中斷但未出現,即使資料範圍之間有足夠的距離,您也可以將 CollapsibleSpaceThreshold 屬性設定為小於25的值。

圖表支援每個圖表最多五個刻度;但是,如果您顯示一個以上的刻度,則圖表可能會變成無法讀取。 如果您的資料範圍超過兩個以上,請考慮使用另一個方法來顯示這些資料。 您 MaxNumberOfBreaks 可以使用屬性來減少可在圖表上顯示的刻度數目。

使用刻度中斷時,Y 軸標籤可能會變成位移。 若要停用標籤位移,請將 IsStaggered 屬性設定為 false

在下列任何情況下,都不支援縮放中斷:

  • 使用圓形圖、環圈圖、漏斗圖、金字塔圖、放射圖或任何堆疊圖表類型。

  • 啟用標籤、刻度標記或格線的自訂間隔。

  • 軸的最小值或最大值已設定。

  • 使用自訂標籤。

  • 指定了對數 Y 軸。

  • 使用 Y 軸上的軸視圖(包含滾動和縮放)。

  • 使用3d 圖表。

建構函式

AxisScaleBreakStyle()

初始化 AxisScaleBreakStyle 類別的新執行個體。

屬性

BreakLineStyle

取得或設定會用於繪製刻度分欄的中斷線樣式。

CollapsibleSpaceThreshold

取得或設定要在其中繪製刻度分欄的圖表空間臨界值。

Enabled

取得或設定旗標,表示是否啟用刻度分欄。

LineColor

取得或設定刻度中斷線的色彩。

LineDashStyle

取得或設定刻度中斷線的樣式。

LineWidth

取得或設定刻度中斷線的寬度。

MaxNumberOfBreaks

取得或設定可以在圖表上顯示的刻度分欄數量上限。

Spacing

取得或設定刻度中斷線之間的間距。 間距會以 Y 軸的百分比表示。

StartFromZero

取得或設定 StartFromZero 列舉值,指出是否從零開始刻度分欄。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於