How to identify the LAST point in a line chart?

TeeChart for ActiveX, COM and ASP
Post Reply
Kaprice
Newbie
Newbie
Posts: 11
Joined: Wed Aug 14, 2013 12:00 am

How to identify the LAST point in a line chart?

Post by Kaprice » Sat Aug 17, 2013 6:39 pm

I want to display the value in a line chart for only the last data point.

So far, I've discovered the TChart_SalesAndBacklog_OnGetSeriesMark event, but how do I identify the FINAL data point so I can set the MarkText for it?

OR, is there a better way to do what I'm trying to accomplish?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to identify the LAST point in a line chart?

Post by Sandra » Mon Aug 19, 2013 10:17 am

Hello kaprice,

I have made a simple code where I have identified the last data point using the LastValueIndex Series property.

Code: Select all

Private Sub Form_Load()
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues
TChart1.Aspect.View3D = False
TChart1.Series(0).Marks.Visible = True
End Sub

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
If ValueIndex = TChart1.Series(SeriesIndex).LastValueIndex Then
     TChart1.Series(SeriesIndex).Marks.Item(ValueIndex).Visible = True
Else
    TChart1.Series(SeriesIndex).Marks.Item(ValueIndex).Visible = False
End If
End Sub
Could you tell us if previous code works in your end?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply