Spread for ASP.NET 12 Product Documentation
Labels
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Working with the Chart Control > Understanding and Customizing Charts > Labels

The labels contain the plot title and the axis labels. You can set the main title for the chart using the Text property in the LabelArea class.

You can set the text, alignment, and other formatting properties for the axis labels. The label text can be bound to a datasource with the TitleDataSource and TitleDataField properties. See the following for more information:

Using Code

  1. Create a plot area.
  2. To set the title in the plot area class for the x-axis, set the IndexAxis.Title property.
  3. Set TitleTextFill and TitleTextFont for additional formatting. You can also set the TitleOffset.
  4. To set the title in the plot area for the y-axis, set the ValueAxis.Title property.
  5. Set TitleTextFill and TitleTextFont for additional formatting. You can also set the TitleOffset.

Example

The following example sets a title for the axis.

C#
Copy Code
YPlotArea plotArea = new YPlotArea();
plotArea.Location = new PointF(0.2f, 0.2f);
plotArea.Size = new SizeF(0.6f, 0.6f);
plotArea.XAxis.Title = "Categories";
plotArea.XAxis.TitleTextFont = new System.Drawing.Font("Arial", 12);
plotArea.XAxis.TitleTextFill = new FarPoint.Web.Chart.SolidFill(Drawing.Color.Crimson);
plotArea.XAxis.TitleVisible = true;
plotArea.YAxis[0].Title = "Values";
plotArea.YAxes[0].TitleTextFont = new System.Drawing.Font("Comic Sans MS", 12);
plotArea.YAxes[0].TitleTextFill = new FarPoint.Web.Chart.SolidFill(Drawing.Color.Chartreuse);
VB
Copy Code
Dim plotArea As New FarPoint.Web.Chart.YPlotArea()
plotArea.Location = New PointF(0.2F, 0.2F)
plotArea.Size = New SizeF(0.6F, 0.6F)
plotArea.XAxis.Title = "Categories"
plotArea.XAxis.TitleTextFont = New System.Drawing.Font("Arial", 12)
plotArea.XAxis.TitleTextFill = New FarPoint.Web.Chart.SolidFill(Drawing.Color.Crimson)
plotArea.XAxis.TitleVisible = True
plotArea.YAxis(0).Title = "Values"
plotArea.YAxes(0).TitleTextFont = New System.Drawing.Font("Comic Sans MS", 12)
plotArea.YAxes(0).TitleTextFill = New FarPoint.Web.Chart.SolidFill(Drawing.Color.Chartreuse)

Using the Chart Designer

  1. Select the PlotArea from the Format menu.
  2. Select the XAxis and YAxis Collections
  3. Set the Title and other properties as needed.
  4. Select Apply and OK to close the Chart Designer.