Hi,
I am drawing the spline curve by using the following example.
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.AddSeries scLine
.Series(0).FillSampleValues (10)
.AddSeries scLine
.Series(1).SetFunction tfSmoothing
.Series(1).DataSource = "Series0"
.Series(0).asLine.LinePen.Visible = False
.Series(0).ShowInLegend = False
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psStar
End With
End Sub
While adding the points to the Series0, i am specifying the label also in the AddXY function.
When ever dragging a point in the Series0, my label is not changing correspondingly. I do not know how to set the changed X value to the bottom axis label.
Could you please suggest a method or provide a example code.
Thanks & Regards,
Rama
Changing the Bottom axis label while dragging a point
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Rama,
That's because the labels you set on the AddXY method are strings. If you want points values after being dragged you should implement the OnGetAxisLabels event as in the code below.
Notice that in spite of adding custom labels when populating series they won't be displayed because they are immediately changed by OnGetAxisLabel event.
That's because the labels you set on the AddXY method are strings. If you want points values after being dragged you should implement the OnGetAxisLabels event as in the code below.
Code: Select all
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.AddSeries scLine
With .Series(0)
For i = 0 To 10
.AddXY i, i * i, "Point " + CStr(i + 1), clTeeColor
Next
.asLine.LinePen.Visible = False
.ShowInLegend = False
.asLine.Pointer.Visible = True
.asLine.Pointer.Style = psStar
End With
.AddSeries scLine
.Series(1).SetFunction tfSmoothing
.Series(1).DataSource = "Series0"
.Tools.Add tcDragPoint
.Tools.Items(0).asDragPoint.Series = .Series(0)
.Axis.Bottom.Labels.Separation = 0
End With
TeeCommander1.Chart = TChart1
End Sub
Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
If ((Axis = 3) And (SeriesIndex = 0)) Then
LabelText = CStr(TChart1.Series(0).XValues.Value(ValueIndex))
End If
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 |