Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Chart Assembly / FarPoint.Win.Chart Namespace / ValueAxis Class / Title Property
Example


In This Topic
    Title Property (ValueAxis)
    In This Topic
    Gets or sets the title.
    Syntax
    'Declaration
     
    Public Property Title As String
    'Usage
     
    Dim instance As ValueAxis
    Dim value As String
     
    instance.Title = value
     
    value = instance.Title
    public string Title {get; set;}
    Exceptions
    ExceptionDescription
    value is a null reference (Nothing in VB).
    Example
    This example creates a chart and sets titles for the axis.
    fpSpread1.Sheets[0].Cells[0, 0].Text = "Name";
    fpSpread1.Sheets[0].Cells[0, 1].Text = "Math";
    fpSpread1.Sheets[0].Cells[0, 2].Text = "LA";
    fpSpread1.Sheets[0].Cells[0, 3].Text = "Science";
    fpSpread1.Sheets[0].Cells[1, 0].Text = "Steve";
    fpSpread1.Sheets[0].Cells[1, 1].Text = "85";
    fpSpread1.Sheets[0].Cells[1, 2].Text = "91";
    fpSpread1.Sheets[0].Cells[1, 3].Text = "94";
    fpSpread1.Sheets[0].Cells[2, 0].Text = "Lisa";
    fpSpread1.Sheets[0].Cells[2, 1].Text = "95";
    fpSpread1.Sheets[0].Cells[2, 2].Text = "76";
    fpSpread1.Sheets[0].Cells[2, 3].Text = "73";
    fpSpread1.Sheets[0].Cells[3, 0].Text = "Mark";
    fpSpread1.Sheets[0].Cells[3, 1].Text = "79";
    fpSpread1.Sheets[0].Cells[3, 2].Text = "83";
    fpSpread1.Sheets[0].Cells[3, 3].Text = "77";
    fpSpread1.Sheets[0].Cells[4, 0].Text = "Tony";
    fpSpread1.Sheets[0].Cells[4, 1].Text = "91";
    fpSpread1.Sheets[0].Cells[4, 2].Text = "76";
    fpSpread1.Sheets[0].Cells[4, 3].Text = "73";
    fpSpread1.Sheets[0].Cells[5, 0].Text = "Julie";
    fpSpread1.Sheets[0].Cells[5, 1].Text = "75";
    fpSpread1.Sheets[0].Cells[5, 2].Text = "86";
    fpSpread1.Sheets[0].Cells[5, 3].Text = "83";
    
    FarPoint.Win.Chart.BarSeries s1 = new FarPoint.Win.Chart.BarSeries();
    s1.SeriesName = fpSpread1.Sheets[0].Cells[0, 1].Value.ToString();
    s1.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "c1", "Sheet1!$B$2:$B$6");
    FarPoint.Win.Chart.BarSeries s2 = new FarPoint.Win.Chart.BarSeries();
    s2.SeriesName = fpSpread1.Sheets[0].Cells[0, 2].Value.ToString();
    s2.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "c2", "Sheet1!$C$2:$C$6");
    FarPoint.Win.Chart.BarSeries s3 = new FarPoint.Win.Chart.BarSeries();
    s3.SeriesName = fpSpread1.Sheets[0].Cells[0, 3].Value.ToString();
    s3.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "c3", "Sheet1!$D$2:$D$6");
    
    s1.CategoryNames.Add(fpSpread1.ActiveSheet.Cells[1, 0].Text);
    s1.CategoryNames.Add(fpSpread1.ActiveSheet.Cells[2, 0].Text);
    s1.CategoryNames.Add(fpSpread1.ActiveSheet.Cells[3, 0].Text);
    s1.CategoryNames.Add(fpSpread1.ActiveSheet.Cells[4, 0].Text);
    s1.CategoryNames.Add(fpSpread1.ActiveSheet.Cells[5, 0].Text);
    
    FarPoint.Win.Chart.ClusteredBarSeries ss1 = new FarPoint.Win.Chart.ClusteredBarSeries();
    ss1.Series.Add(s1);
    ss1.Series.Add(s2);
    ss1.Series.Add(s3);
    FarPoint.Win.Chart.YPlotArea yplotarea1 = new FarPoint.Win.Chart.YPlotArea();
    yplotarea1.Series.Add(ss1);
    yplotarea1.Vertical = false;
    yplotarea1.XAxis.Title = "Name";
    yplotarea1.YAxes[0].Title = "Score";
    
    FarPoint.Win.Chart.LabelArea label1 = new FarPoint.Win.Chart.LabelArea();
    label1.Text = "Test Score";
    label1.Location = new PointF(0.5f, 0.02f);
    label1.AlignmentX = 0.5f;
    label1.AlignmentY = 0.0f;
    FarPoint.Win.Chart.LegendArea legend1 = new FarPoint.Win.Chart.LegendArea();
    legend1.Location = new PointF(0.98f, 0.5f);
    legend1.AlignmentX = 1.0f;
    legend1.AlignmentY = 0.5f;
    
    FarPoint.Win.Spread.Chart.SpreadChart chart1 = new FarPoint.Win.Spread.Chart.SpreadChart();
    chart1.Model.PlotAreas.Add(yplotarea1);
    chart1.Model.LabelAreas.Add(label1);
    chart1.Model.LegendAreas.Add(legend1);
    chart1.Rectangle = new System.Drawing.Rectangle(150, 150, 150, 150);
    chart1.Size = new System.Drawing.Size(700, 350);
    fpSpread1.Sheets[0].Charts.Add(chart1);
    fpSpread1.Sheets(0).Cells(0, 0).Text = "Name"
    fpSpread1.Sheets(0).Cells(0, 1).Text = "Math"
    fpSpread1.Sheets(0).Cells(0, 2).Text = "LA"
    fpSpread1.Sheets(0).Cells(0, 3).Text = "Science"
    fpSpread1.Sheets(0).Cells(1, 0).Text = "Steve"
    fpSpread1.Sheets(0).Cells(1, 1).Text = "85"
    fpSpread1.Sheets(0).Cells(1, 2).Text = "91"
    fpSpread1.Sheets(0).Cells(1, 3).Text = "94"
    fpSpread1.Sheets(0).Cells(2, 0).Text = "Lisa"
    fpSpread1.Sheets(0).Cells(2, 1).Text = "95"
    fpSpread1.Sheets(0).Cells(2, 2).Text = "76"
    fpSpread1.Sheets(0).Cells(2, 3).Text = "73"
    fpSpread1.Sheets(0).Cells(3, 0).Text = "Mark"
    fpSpread1.Sheets(0).Cells(3, 1).Text = "79"
    fpSpread1.Sheets(0).Cells(3, 2).Text = "83"
    fpSpread1.Sheets(0).Cells(3, 3).Text = "77"
    fpSpread1.Sheets(0).Cells(4, 0).Text = "Tony"
    fpSpread1.Sheets(0).Cells(4, 1).Text = "91"
    fpSpread1.Sheets(0).Cells(4, 2).Text = "76"
    fpSpread1.Sheets(0).Cells(4, 3).Text = "73"
    fpSpread1.Sheets(0).Cells(5, 0).Text = "Julie"
    fpSpread1.Sheets(0).Cells(5, 1).Text = "75"
    fpSpread1.Sheets(0).Cells(5, 2).Text = "86"
    fpSpread1.Sheets(0).Cells(5, 3).Text = "83"
    Dim s1 As New FarPoint.Win.Chart.BarSeries()
    s1.SeriesName = FpSpread1.Sheets(0).Cells(0, 1).Value.ToString()
    s1.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "c1", "Sheet1!$B$2:$B$6")
    Dim s2 As New FarPoint.Win.Chart.BarSeries()
    s2.SeriesName = FpSpread1.Sheets(0).Cells(0, 2).Value.ToString()
    s2.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "c2", "Sheet1!$C$2:$C$6")
    Dim s3 As New FarPoint.Win.Chart.BarSeries()
    s3.SeriesName = FpSpread1.Sheets(0).Cells(0, 3).Value.ToString()
    s3.Values.DataSource = New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "c3", "Sheet1!$D$2:$D$6")
    
    s1.CategoryNames.Add(FpSpread1.ActiveSheet.Cells(1, 0).Text)
    s1.CategoryNames.Add(FpSpread1.ActiveSheet.Cells(2, 0).Text)
    s1.CategoryNames.Add(FpSpread1.ActiveSheet.Cells(3, 0).Text)
    s1.CategoryNames.Add(FpSpread1.ActiveSheet.Cells(4, 0).Text)
    s1.CategoryNames.Add(FpSpread1.ActiveSheet.Cells(5, 0).Text)
    
    Dim ss1 As New FarPoint.Win.Chart.ClusteredBarSeries()
    ss1.Series.Add(s1)
    ss1.Series.Add(s2)
    ss1.Series.Add(s3)
    Dim yplotarea1 As New FarPoint.Win.Chart.YPlotArea()
    yplotarea1.Series.Add(ss1)
    yplotarea1.Vertical = False
    yplotarea1.XAxis.Title = "Name"
    yplotarea1.YAxes(0).Title = "Score"
    
    Dim label1 As New FarPoint.Win.Chart.LabelArea()
    label1.Text = "Test Score"
    label1.Location = New PointF(0.5F, 0.02F)
    label1.AlignmentX = 0.5F
    label1.AlignmentY = 0.0F
    Dim legend1 As New FarPoint.Win.Chart.LegendArea()
    legend1.Location = New PointF(0.98F, 0.5F)
    legend1.AlignmentX = 1.0F
    legend1.AlignmentY = 0.5F
    
    Dim chart1 As New FarPoint.Win.Spread.Chart.SpreadChart()
    chart1.Model.PlotAreas.Add(yplotarea1)
    chart1.Model.LabelAreas.Add(label1)
    chart1.Model.LegendAreas.Add(legend1)
    chart1.Rectangle = New System.Drawing.Rectangle(150, 150, 150, 150)
    chart1.Size = New System.Drawing.Size(700, 350)
    FpSpread1.Sheets(0).Charts.Add(chart1)
    See Also