Page 1 of 1

How to append new data to the existing series?

Posted: Mon Dec 04, 2006 7:16 am
by 9529132
Hi,

I would like to use AddArray to append new data to the existing series. How to do that?

Thanks,
David

Posted: Mon Dec 04, 2006 9:52 am
by narcis
Hi David,

Have you seen the example at All Features\Welcome!\Speeed in the features demo? They show how to use arrays with TeeChart. You'll find the features demo at TeeChart's program group.

Posted: Mon Dec 04, 2006 10:19 am
by 9529132
Hi, NarcĂ­s,

I know how to use AddArray to add new data, but I don't know how to use it to append new data to existing old data. For example, if the series have 1000 data, how to append another 1000 data to the end of it using AddArray?

By the way, have you received my demo code about the code crash? Any news about it?

Thanks a lot.
David

Posted: Mon Dec 04, 2006 10:36 am
by narcis
Hi David,
I know how to use AddArray to add new data, but I don't know how to use it to append new data to existing old data. For example, if the series have 1000 data, how to append another 1000 data to the end of it using AddArray?
I'm afraid there's no way to append data, you'll need to manually append the arrays and them to the series or may be better looping through the array and add points using AddXY.
By the way, have you received my demo code about the code crash? Any news about it?
Sorry for the delay. We are aware of that and reply ASAP.

Posted: Mon Dec 04, 2006 10:44 am
by 9529132
Thanks. Hopefully I can get updates ASAP.

Re: How to append new data to the existing series?

Posted: Tue Oct 27, 2009 8:45 pm
by 9523585
Has anything been done on this issue to address appending array data to a series? I get blocks of records in to my application in real-time, and would like to see an AppendArray function in the ISeries interface. Currently, I have to use AddXY for every single value. Being able to append thousands of records at a time would speed things up a lot.

Re: How to append new data to the existing series?

Posted: Wed Oct 28, 2009 9:57 am
by yeray
Hi TMECHAM,

The series values are stored in an array so an AppendArray function would take the given array, append the array at series' Yvalues and use AddArray function, that simply assigns the given array to the YValues array. So implementing an AppendArray function would be fastest than preparing the final array yourself and using the AddArray function.
Anyway, I'll add this to the wish list to be implemented in future releases (TV52014513).

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False

  TChart1.AddSeries scPoint
  
  Const size1 = 10
  Dim array1(size1) As Double
  Dim i As Integer
  For i = 0 To size1 - 1
    array1(i) = Rnd * 100
  Next i
  
  TChart1.Series(0).AddArray size1, array1
  
  Const size2 = 10
  Dim array2(size2) As Double
  For i = 0 To size2 - 1
    array2(i) = Rnd * 100
  Next i
  
  Dim tmparray(size1 + size2) As Double
  For i = 0 To size1 + size2 - 1
    If i < size1 Then
      tmparray(i) = TChart1.Series(0).YValues.Value(i)
    Else
      tmparray(i) = array2(i - size1)
    End If
  Next i
  
  TChart1.Series(0).AddArray size1 + size2, tmparray
End Sub
Also note that with XML, to append data is possible: http://www.teechart.net/support/viewtopic.php?t=3092