Export (0) Print
Expand All

StripLine.Text Property

Gets or sets the text for the strip line.

Namespace:  System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

[PersistenceModeAttribute(PersistenceMode.Attribute)]
[BindableAttribute(true)]
public string Text { get; set; }

Property Value

Type: System.String
A string value that represents the text of a strip line.

Use this property to add text to a strip line.

The following code example demonstrates how to add a threshold line after the chart control has been added to the design surface. The chart uses a non-recurring strip line to show a calculation of the mean of all data points in a series.

public partial class StripLines : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {            
            // Add chart data
            AddChartData();

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

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft