次の方法で共有


StripLine.TextLineAlignment プロパティ

定義

背景の縞模様のテキストのテキスト行の配置を取得または設定します。

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

プロパティ値

テキスト行の配置を表す StringAlignment 値。

属性

次のコード例では、グラフ コントロールがデザイン サーフェイスに追加された後にしきい値線を追加する方法を示します。 グラフでは、連続していないストリップ ラインを使用して、系列内のすべてのデータ ポイントの平均の計算が表示されます。

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

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

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

適用対象