Example 32: Specifying text for data points
This sample shows how to
add alternate text to data points. By
default, when using ShowValues = true, chart
will draw the numeric value associated to
that data point. Using ValuesCaptions
property you can replace this behaviour and
set your own text for each data points.
ValuesCaptions must be filled with a
String for each data value. This string can
be:
-
"" (blank string): to
hide the label
-
Any text: will show
this text instead of the numeric value
-
$$: will show the
numeric value
-
Any text containing
$$: will replace $$ in text with numeric
value and display the string.
Steps:
1. Create a new Windows
application project (VB.NET)
2. Add Super 2d/3d Graph
Library to the toolbox pallete and drag it
to Form1.
3. Copy and paste de
following code:
Form Code
Imports Super2d3dGraphLibrary
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sf As New SeriesFactory
For k As Integer = 1 To 10
sf.AddValue(k * 10)
If k = 7 Then
sf.AddValueCaption("This
is value 7")
ElseIf k
= 3 Then
sf.AddValueCaption("This
point has a value of $$")
Else
sf.AddValueCaption("")
End If
Next
With Super2d3dGraph1
.Style =
STYLE2D3D.STYLE2D_LINE
.ValuesLocationStyle =STYLECAPTIONLOCATION.
STYLECAPTIONLOCATION_SMART_PLACEMENT
.SeriesColor = New Color() {Color.Blue} ' Colors for points
.SeriesLineStyle = New Pen()
{New Pen(Color.Black)} ' Line style
.ShowDataTable = False
.ShowLegend = False
End With
sf.ApplyTo(Super2d3dGraph1)
End Sub
End Class
Result:

|