StripLine.TextOrientation Property

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the text orientation.

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

public TextOrientation TextOrientation { get; set; }

Property Value

Type: System.Web.UI.DataVisualization.Charting.TextOrientation

A TextOrientation value that represents the alignment of the text orientation.

When this property is set to a value of Auto, the text is oriented based on the chart type. For all X-Y chart types other than Bar, X-axis strip line text is oriented horizontally from left to right on the bottom of the strip line. For Bar charts, X-axis strip line text is oriented vertically from top to bottom to the right of the 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

            // Adds a threshold line using strip lines.

        /// <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;
            stripLine3.TextAlignment = StringAlignment.Near;
            stripLine3.TextLineAlignment = StringAlignment.Near;
            stripLine3.TextOrientation = TextOrientation.Auto;

            // Add strip line to the chart

.NET Framework
Available since 4.0
Return to top