Property Last does not update when adding values from array

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
sydro
Newbie
Newbie
Posts: 1
Joined: Mon Mar 27, 2006 12:00 am

Property Last does not update when adding values from array

Post by sydro » Wed May 10, 2006 10:11 am

When adding values to a serie by adding the whole array at once, the property "Last" of xValues/yValues of the series still remains 0. This leads to errors using the DownSampling-Function.

Example:
dim xVal(100) as double, yVal(100) as single
xVal(0) = 1
yVal(0) = 1
....
tChart1.series(0).add(xVal, yVal)

->the property "Last" is still 0!!

Using a for-loop to add every point individual, the property is being updated and the DownSampling-Function works.

How can I force TeeChart to update this value.

Thanks,
Dirk

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon May 15, 2006 4:12 pm

Hi Dirk,

I did some tests and Last property works fine. However, I found another error when populating the series with an array. I've added this issue (TF02011417) to our defect list to be fixed for future releases.

Using the code below gives an IndexOutOfRange error when clicking Button1 (populating the series with an array) but works fine clicking Button2 (populating the series with a for loop).

Code: Select all

    Private NumValues As Integer = 1000

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        Dim rndVal As New Random()
        Dim xVal(NumValues) As Double, yVal(NumValues) As Single

        For i = 0 To xVal.Length - 1
            xVal(i) = i
            yVal(i) = rndVal.Next()
        Next i
        Line1.Add(xVal, yVal)

        TChart1.Header.Text = Line1.XValues.Last.ToString() & ", " & Line1.YValues.Last.ToString()
        Line2.CheckDataSource()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim i As Integer
        Dim rndVal As New Random()

        For i = 0 To NumValues - 1
            Line1.Add(i, rndVal.Next())
        Next

        TChart1.Header.Text = Line1.XValues.Last.ToString() & ", " & Line1.YValues.Last.ToString()
        Line2.CheckDataSource()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim i As Integer

        For i = 0 To TChart1.Series.Count - 1
            TChart1.Series(i).Clear()
        Next
    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
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply