I have the following example data points.
X = 3.7% Y = 2.7% Label = Fixed Income
X = 4.9% Y = 3.7% Label = Income
X = 6.5% Y = 4.2% Label = Yield
X = 9.9% Y = 5.3% Label = Balanced
X = 12.6% Y = 6.1% Label = Growth
X = 15.0% Y = 6.6% Label = Equity
I'd like to plot them so that
a) The labels show on the chart
b) The X and Y axis to be uniform as the points are not equally spaced
c) Plot the chart with and without lines connected them.
d) If lines are connecting the points, is it possible to smooth them.
Ploting the points is straightforward but I don't know how to place the lables on the chart or find any way of assigning the labels so they appear as Marks on the chart. Is there a way of attaching the labels to the series or the point itself so that I can query the values also by clicking on them.
Can anyone help with a code snippet in VB6?
Thanks in advance.
Nav
How do I label points on a 2D chart?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nav,
To populate series adding a label for each point you can use the Add's method ALabel parameter as shown in the snippet below.
Here it is, hope it helps :
To populate series adding a label for each point you can use the Add's method ALabel parameter as shown in the snippet below.
- a) Setting series marks visible you can display the labels.
b) I don't know what are you trying to achieve here. You can try using axes SetMinMax and Increment properties. If that's not what are you looking for please let us know and describe exactly your desired behaviour.
c) You can make them visible or not using the Check1_Click code below.
d) You can smooth the lines using Anti-alias features as shown in the snippet. You could also use TeeChart OpenGL features or smoothing function.
To achieve that you can use series marks as I told in a) or, to display the marks when clicking the series you can use a MarksTip tool. You'll find examples and information in the tutorials (Tutorial 19 - The TeeChart Tool Collection) and the features demo.Ploting the points is straightforward but I don't know how to place the lables on the chart or find any way of assigning the labels so they appear as Marks on the chart. Is there a way of attaching the labels to the series or the point itself so that I can query the values also by clicking on them.
Can anyone help with a code snippet in VB6?
Here it is, hope it helps :
Code: Select all
Private Sub Check1_Click()
TChart1.Series(0).asLine.LinePen.Visible = Check1.Value
TChart1.Canvas.UseAntiAlias = Check1.Value
If Check1.Value Then
TChart1.Series(0).asLine.LineBrush = bsSolid
Else
TChart1.Series(0).asLine.LineBrush = bsClear
End If
End Sub
Private Sub Form_Load()
Me.TeeCommander1.Chart = Me.TChart1
With TChart1.Series(0)
.AddXY 3.7, 2.7, "Fixed Income", clTeeColor
.AddXY 4.9, 3.7, "Income", clTeeColor
.AddXY 6.5, 4.2, "Yield", clTeeColor
.AddXY 9.9, 5.3, "Balanced", clTeeColor
.AddXY 12.6, 6.1, "Growth", clTeeColor
.AddXY 15, 6.6, "Equity", clTeeColor
.Marks.Visible = True
.asLine.Pointer.Visible = True
End With
With TChart1.Axis
.Bottom.Labels.Style = talValue
.Bottom.Labels.ValueFormat = "0.###%"
.Left.Labels.ValueFormat = "0.###%"
.Left.SetMinMax 0, 20
.Left.Increment = 5
.Bottom.SetMinMax 0, 20
.Bottom.Increment = 5
End With
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
You're welcome Nav.
Excellent! I'm glad to hear this.
Excellent! I'm glad to hear this.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |