Page 1 of 1

How to identify the LAST point in a line chart?

Posted: Sat Aug 17, 2013 6:39 pm
by 16666763
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?

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

Posted: Mon Aug 19, 2013 10:17 am
by 10050769
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,