다음을 통해 공유


StripLine.IntervalType 속성

정의

StripLine 개체의 간격 유형을 가져오거나 설정합니다.

public:
 property System::Web::UI::DataVisualization::Charting::DateTimeIntervalType IntervalType { System::Web::UI::DataVisualization::Charting::DateTimeIntervalType get(); void set(System::Web::UI::DataVisualization::Charting::DateTimeIntervalType value); };
[System.ComponentModel.Bindable(true)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.Attribute)]
public System.Web.UI.DataVisualization.Charting.DateTimeIntervalType IntervalType { get; set; }
[<System.ComponentModel.Bindable(true)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.Attribute)>]
member this.IntervalType : System.Web.UI.DataVisualization.Charting.DateTimeIntervalType with get, set
Public Property IntervalType As DateTimeIntervalType

속성 값

DateTimeIntervalType

간격 유형을 나타내는 DateTimeIntervalType 열거형 값입니다. 기본값은 Auto입니다.

특성

예제

다음 코드 예제에서는 줄무늬 선의 세 개의 애플리케이션을 보여 줍니다. 첫 번째, 가로 줄무늬 선은 일정 한 간격으로 추가 됩니다. 둘째, 세로 줄무늬 선의 지점을 주말 데이터 강조 표시 하려면 추가 됩니다. 마지막으로, 되풀이 되지 않는 줄무늬를 차트의 첫 번째 계열에서 데이터 요소의 평균을 나타내는 추가 됩니다.

Imports System.Web.UI.DataVisualization.Charting  

Public Partial Class StripLines   
    Inherits System.Web.UI.Page   
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)  

        ' Add chart data before adding strip lines.   
        AddChartData()   

        ' Adds repeating horizontal strip lines.   
        AddHorizRepeatingStripLines()   

        ' Highlights weekend points using strip lines.   
        HighlightWeekendsWithStripLines()   

        ' Adds a threshold line using strip lines.   
        AddThresholdStripLine()   
    End Sub   

    ''' <summary>   
    ''' Adds a week of data with values between 20 and 35.   
    ''' </summary>   
    Private Sub AddChartData()   
        ' Declare new random variable   
        Dim rand As New Random()   
        For i As Integer = 0 To 6   

            ' Add a week of data   
            chart1.Series(0).Points.AddXY(DateTime.Now.AddDays(i), rand.[Next](20, 35))   
        Next   
    End Sub   

    ''' <summary>   
    ''' Adds repeating horizontal strip lines at intervals of 5.   
    ''' </summary>   
    Private Sub AddHorizRepeatingStripLines()   
        ' Instantiate new strip line   
        Dim stripLine1 As New StripLine()   
        stripLine1.StripWidth = 2.5   
        stripLine1.Interval = 5   

        ' Consider adding transparency so that the strip lines are lighter   
        stripLine1.BackColor = Color.FromArgb(120, Color.Red)   

        ' Add the strip line to the chart   
        chart1.ChartAreas(0).AxisY.StripLines.Add(stripLine1)   
    End Sub   

    ''' <summary>   
    ''' Adds strip lines to highlight weekend values.   
    ''' </summary>   
    Private Sub HighlightWeekendsWithStripLines()   
        ' Set strip line to highlight weekends   
        Dim stripLine2 As New StripLine()   
        stripLine2.BackColor = Color.FromArgb(120, Color.Gold)   
        stripLine2.IntervalOffset = -1.5   
        stripLine2.IntervalOffsetType = DateTimeIntervalType.Days   
        stripLine2.Interval = 1   
        stripLine2.IntervalType = DateTimeIntervalType.Weeks   
        stripLine2.StripWidth = 2   
        stripLine2.StripWidthType = DateTimeIntervalType.Days   

        ' Add strip line to the chart   
        chart1.ChartAreas(0).AxisX.StripLines.Add(stripLine2)   

        ' Set the axis label to show the name of the day   
        ' This is done in order to demonstrate that weekends are highlighted   
        chart1.ChartAreas(0).AxisX.LabelStyle.Format = "ddd"   
    End Sub   

    ''' <summary>   
    ''' Adds a horizontal threshold strip line at the calculated mean   
    ''' value of all data points in the first series of the chart.   
    ''' </summary>   
    Private Sub AddThresholdStripLine()   
        Dim stripLine3 As New StripLine()   

        ' Set threshold line so that it is only shown once   
        stripLine3.Interval = 0   

        ' Set the threshold line to be drawn at the calculated mean of the first series   
        stripLine3.IntervalOffset = chart1.DataManipulator.Statistics.Mean(chart1.Series(0).Name)   

        stripLine3.BackColor = Color.DarkGreen   
        stripLine3.StripWidth = 0.25   

        ' Set text properties for the threshold line   
        stripLine3.Text = "Mean"   
        stripLine3.ForeColor = Color.Black   

        ' Add strip line to the chart   
        chart1.ChartAreas(0).AxisY.StripLines.Add(stripLine3)   
    End Sub   
End Class  
public partial class StripLines : System.Web.UI.Page   
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {              
            // Add chart data  
            AddChartData();  

            // Adds repeating horizontal strip lines.  
            AddHorizRepeatingStripLines();  

            // Highlights weekend points using strip lines.  
            HighlightWeekendsWithStripLines();  

            // Adds a threshold line using strip lines.  
            AddThresholdStripLine();  
        }  

        /// <summary>  
        /// Adds a week of data with values between 20 and 35.  
        /// </summary>  
        private void AddChartData()  
        {  
            // Declare new random variable  
            Random rand = new Random();  

            // Add a week of data  
            for (int i = 0; i < 7; i++)   
            {  
                chart1.Series[0].Points.AddXY(DateTime.Now.AddDays(i), rand.Next(20,35));  
            }  
        }  

        /// <summary>  
        /// Adds repeating horizontal strip lines at intervals of 5.  
        /// </summary>  
        private void AddHorizRepeatingStripLines()  
        {  
            // Instantiate new strip line  
            StripLine stripLine1 = new StripLine();  
            stripLine1.StripWidth = 0;  
            stripLine1.BorderColor = Color.Black;  
            stripLine1.BorderWidth = 3;  
            stripLine1.Interval = 5;  

            // Consider adding transparency so that the strip lines are lighter  
            stripLine1.BackColor = Color.FromArgb(120, Color.Red);  

            stripLine1.BackSecondaryColor = Color.Black;  
            stripLine1.BackGradientStyle = GradientStyle.LeftRight;  

            // Add the strip line to the chart  
            chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine1);  
        }  

        /// <summary>  
        /// Adds strip lines to highlight weekend values.  
        /// </summary>  
        private void HighlightWeekendsWithStripLines()  
        {  
            // Set strip line to highlight weekends  
            StripLine stripLine2 = new StripLine();  
            stripLine2.BackColor = Color.FromArgb(120, Color.Gold);              
            stripLine2.IntervalOffset = -1.5;  
            stripLine2.IntervalOffsetType = DateTimeIntervalType.Days;  
            stripLine2.Interval = 1;  
            stripLine2.IntervalType = DateTimeIntervalType.Weeks;  
            stripLine2.StripWidth = 2;  
            stripLine2.StripWidthType = DateTimeIntervalType.Days;  

            // Add strip line to the chart  
            chart1.ChartAreas[0].AxisX.StripLines.Add(stripLine2);  

            // Set the axis label to show the name of the day  
            // This is done in order to demonstrate that weekends are highlighted  
            chart1.ChartAreas[0].AxisX.LabelStyle.Format = "ddd";  
        }  

        /// <summary>  
        /// Adds a horizontal threshold strip line at the calculated mean   
        /// value of all data points in the first series of the chart.  
        /// </summary>  
        private void AddThresholdStripLine()  
        {  
            StripLine stripLine3 = new StripLine();  

            // Set threshold line so that it is only shown once  
            stripLine3.Interval = 0;  

            // Set the threshold line to be drawn at the calculated mean of the first series  
            stripLine3.IntervalOffset = chart1.DataManipulator.Statistics.Mean(chart1.Series[0].Name);  

            stripLine3.BackColor = Color.DarkGreen;  
            stripLine3.StripWidth = 0.25;  

            // Set text properties for the threshold line  
            stripLine3.Text = "Mean";  
            stripLine3.ForeColor = Color.Black;  

            // Add strip line to the chart  
            chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine3);  
        }  
    }  

설명

간격 유형은 로 설정할 수 Auto 있습니다. 이 경우 형식은 개체가 속한 축 및 축 눈금에 따라 그려진 개체의 X 값 또는 Y 값 DataPoint 형식에 따라 StripLine 달라집니다.

Interval 속성 줄무늬 또는 선 그려지는 빈도 결정 합니다.

적용 대상