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:
Return to the overview at Understanding and Customizing Charts.
Using Code
- Create a plot area.
- To set the title in the plot area class for the x-axis, set the IndexAxis.Title property.
- Set TitleTextFill and TitleTextFont for additional formatting. You can also set the TitleOffset.
- To set the title in the plot area for the y-axis, set the ValueAxis.Title property.
- 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
- Select the PlotArea from the Format menu.
- Select the XAxis and YAxis Collections
- Set the Title and other properties as needed.
- Select Apply and OK to close the Chart Designer.