StripLine Classe

Definição

Representa as faixas em um gráfico.Represents the strip lines on a chart.

public ref class StripLine : System::Web::UI::DataVisualization::Charting::ChartElement, System::Web::UI::DataVisualization::Charting::IChartMapArea
public class StripLine : System.Web.UI.DataVisualization.Charting.ChartElement, System.Web.UI.DataVisualization.Charting.IChartMapArea
type StripLine = class
    inherit ChartElement
    interface IChartMapArea
Public Class StripLine
Inherits ChartElement
Implements IChartMapArea
Herança
StripLine
Implementações

Exemplos

O exemplo de código a seguir demonstra três aplicativos de faixas de linha.The following code example demonstrates three applications of strip lines. Em primeiro lugar, as linhas de faixa horizontais são adicionadas em intervalos recorrentes.First, horizontal strip lines are added at recurring intervals. Segundo, linhas verticais são adicionadas para realçar pontos de dados de fim de semana.Second, vertical strip lines are added to highlight weekend data points. Por fim, uma linha de faixa não recorrente é adicionada para indicar a média dos pontos de dados na primeira série do gráfico.Lastly, a non-recurring strip line is added to denote the mean of the data points in the first series of the chart.

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   

    ' Adds a week of data with values between 20 and 35.   
    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   

    ' Adds repeating horizontal strip lines at intervals of 5.   
    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   

    ' Adds strip lines to highlight weekend values.   
    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   

    ' Adds a horizontal threshold strip line at the mean value of the first series.  
    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);  
        }  
    }  

Comentários

As faixas, ou as faixas, são intervalos horizontais ou verticais que sombream o plano de fundo de um gráfico em intervalos regulares ou personalizados.Strip lines, or strips, are horizontal or vertical ranges that shade the background of a chart in regular or custom intervals. É possível usar faixas para:You can use strip lines to:

  • Melhorar a legibilidade para pesquisar valores individuais no gráfico.Improve readability for looking up individual values on the chart.

  • Separe os pontos de dados ao ler o gráfico.Separate data points when reading the chart.

  • Realçar datas que ocorrem em intervalos regulares, por exemplo, para identificar pontos de dados de fim de semana.Highlight dates that occur at regular intervals, for example, to identify weekend data points.

  • Realçar um intervalo de chaves específico de dados.Highlight a specific key range of data.

  • Adicione uma linha de limite em um valor constante específico.Add a threshold line at a specific constant value.

Um único StripLine objeto pode ser desenhado uma vez, ou repetidamente, para um determinado intervalo.A single StripLine object can either be drawn once, or repeatedly, for a given interval. Essa ação é controlada pela Interval propriedade.This action is controlled by the Interval property. Quando um valor de-1 for atribuído à Interval propriedade, uma faixa será desenhada.When a value of -1 is assigned to the Interval property, one strip line will be drawn. Quando um valor diferente de zero for atribuído à Interval propriedade, uma faixa será desenhada repetidamente em cada intervalo especificado.When a non-zero value is assigned to the Interval property, a strip line will be drawn repeatedly at each given interval. O local onde uma faixa de linha é desenhada também é afetado pelas IntervalOffset IntervalOffsetType Propriedades e da faixa.The location where a strip line is drawn is also affected by the IntervalOffset and IntervalOffsetType properties of the strip line.

As faixas são sempre associadas a um Axis objeto.Strip lines are always associated with an Axis object. Eles podem ser adicionados em tempo de design e em tempo de execução.They can be added at both design time and run time.

Para adicionar uma linha horizontal ou vertical para exibir um limite, defina a StripWidth propriedade com um valor de 0,0.To add a horizontal or vertical line to display a threshold, set the StripWidth property to a value of 0.0. Isso fará com que uma linha seja desenhada.This will result in a line being drawn. Você pode usar as BorderColor BorderDashStyle Propriedades, e BorderWidth para a cor, a largura e o estilo da linha.You can use the BorderColor, BorderDashStyle and BorderWidth properties for the color, width and style of the line. Nenhuma propriedade de plano de fundo do gráfico ( Back* ) é usada quando a StripWidth Propriedades é definida como 0,0.No chart background properties (Back*) are used when the StripWidth property is set to 0.0.

Use a Text propriedade da faixa de linha para associar texto a uma faixa.Use the Text property of the strip line to associate text with a strip line. O posicionamento e a orientação desse texto podem ser controlados pela TextAlignment propriedade.The placement and orientation of this text can be controlled by the TextAlignment property.

Quando várias linhas de strip são definidas para o mesmo eixo, é possível que as faixas sejam sobrepostas.When multiple strip lines are defined for the same axis, it is possible that the strip lines will overlap. A ordem Z de StripLine objetos é determinada pela ordem de ocorrência no StripLinesCollection objeto.The Z-order of StripLine objects is determined by their order of occurrence in the StripLinesCollection object. Isso significa que a primeira ocorrência é desenhada primeiro; a segunda ocorrência é desenhada segundo, e assim por diante.This means that the first occurrence is drawn first; the second occurrence is drawn second, and so on.

As faixas não têm suporte para os seguintes tipos de gráfico: pizza, rosca, funil, pirâmide, Kagi, ThreeLineBreak, PointAndFigure, polar e radar.Strip lines are not supported for the following chart types: Pie, Doughnut, Funnel, Pyramid, Kagi, ThreeLineBreak, PointAndFigure, Polar and Radar.

Construtores

StripLine()

Inicializa uma nova instância da classe StripLine.Initializes a new instance of the StripLine class.

Propriedades

BackColor

Obtém ou define a cor da tela de fundo da faixa.Gets or sets the background color of the strip line.

BackGradientStyle

Obtém ou define o estilo de gradiente da faixa.Gets or sets the gradient style of the strip line.

BackHatchStyle

Obtém ou define o estilo de hachura da faixa.Gets or sets the hatching style of the strip line.

BackImage

Obtém ou define a imagem da tela de fundo da faixa.Gets or sets the background image of the strip line.

BackImageAlignment

Obtém ou define o alinhamento da imagem da tela de fundo.Gets or sets the background image alignment.

BackImageTransparentColor

Obtém ou define a cor de uma imagem de tela de fundo da faixa que será implementada como transparente.Gets or sets the color of a strip line background image that will be implemented as transparent.

BackImageWrapMode

Obtém ou define o modo de desenho da imagem da tela de fundo da faixa.Gets or sets the drawing mode of the background image of the strip line.

BackSecondaryColor

Obtém ou define a cor secundária da tela de fundo da faixa.Gets or sets the secondary color of the strip line background.

BorderColor

Obtém ou define a cor de borda de uma faixa.Gets or sets the border color of a strip line.

BorderDashStyle

Obtém ou define o estilo de borda da faixa.Gets or sets the border style of the strip line.

BorderWidth

Obtém ou define a largura de borda da faixa.Gets or sets the border width of the strip line.

Font

Obtém ou define a fonte usada para o texto da faixa.Gets or sets the font used for the strip line text.

ForeColor

Obtém ou define a cor do texto da faixa.Gets or sets the color of the strip line text.

Interval

Obtém ou define o intervalo para uma faixa e determina se ela é desenhada uma vez ou repetidamente.Gets or sets the interval for a strip line, and determines if the strip line is drawn once or repeatedly.

IntervalOffset

Obtém ou define o deslocamento de linhas de grade, marcas de escala, faixas e rótulos de eixo.Gets or sets the offset of grid lines, tick marks, strip lines and axis labels.

IntervalOffsetType

Obtém ou define o tipo de deslocamento de intervalo da faixa.Gets or sets the interval offset type of the strip line.

IntervalType

Obtém ou define o tipo de intervalo de um objeto StripLine.Gets or sets the interval type of a StripLine object.

MapAreaAttributes

Obtém ou define os atributos da área de mapa da faixa.Gets or sets the map area attributes of the strip line.

Name

Obtém o nome da faixa.Gets the name of the strip line.

PostBackValue

Obtém ou define o valor de postback que pode ser processado em um evento Click .Gets or sets the postback value that can be processed on a Click event.

StripWidth

Obtém ou define a largura de uma faixa.Gets or sets the width of a strip line.

StripWidthType

Obtém ou define a unidade de medida para a propriedade StripWidth.Gets or sets the unit of measurement for the StripWidth property.

Tag

Obtém ou define um objeto associado a esse elemento do gráfico.Gets or sets an object associated with this chart element.

(Herdado de ChartElement)
Text

Obtém ou define o texto da faixa.Gets or sets the text for the strip line.

TextAlignment

Obtém ou define o alinhamento de texto da faixa.Gets or sets the text alignment of the strip line.

TextLineAlignment

Obtém ou define o alinhamento da linha de texto do texto da faixa.Gets or sets the text line alignment of strip line text.

TextOrientation

Obtém ou define a orientação do texto.Gets or sets the text orientation.

ToolTip

Obtém ou define a dica de ferramenta de uma faixa.Gets or sets the tooltip of a strip line.

Url

Obtém ou define a URL de destino ou ponto de ancoragem da faixa.Gets or sets the destination URL or anchor point of the strip line.

Métodos

Dispose()

Libera os recursos usados pelo ChartElement.Releases the resources used by the ChartElement.

(Herdado de ChartElement)
Dispose(Boolean)

Libera os recursos não gerenciados usados pelo StripLine e opcionalmente libera os recursos gerenciados.Releases the unmanaged resources used by the StripLine and optionally releases the managed resources.

Equals(Object)

Determina se o Object especificado é igual ao ChartElement atual.Determines whether the specified Object is equal to the current ChartElement.

(Herdado de ChartElement)
GetHashCode()

Retorna uma função de hash para um tipo específico.Returns a hash function for a particular type.

(Herdado de ChartElement)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o Object atual.Returns a string that represents the current Object.

(Herdado de ChartElement)

Aplica-se a