Hello,
I assign an ADO recordset to the property. Then i add a new record to the recordset. The new record doesn't show up in the chart!
What's wrong?
nefis
DataSource property
Hi Nefis,
have you tried to use the ITChart.RefreshData and CheckDataSource methods when the records has been modified ?
Josep Lluis Jorge
http://support.steema.com
have you tried to use the ITChart.RefreshData and CheckDataSource methods when the records has been modified ?
Josep Lluis Jorge
http://support.steema.com
Could you please to tell me what's wrong with the code. It's running but no points are showed:Pep wrote:Hi Nefis,
have you tried to use the ITChart.RefreshData and CheckDataSource methods when the records has been modified ?
Josep Lluis Jorge
http://support.steema.com
Code: Select all
Option Explicit
Private Const DField = "DT"
Private Const VField = "Value"
Private Const TimeFrame = 1 / (24 * 60 * 12) '5 sec
Private rs As ADODB.Recordset
Private Sub Form_Load()
Set rs = New ADODB.Recordset
Call rs.Fields.Append(DField, adDate)
Call rs.Fields.Append(VField, adDouble)
Call rs.Open
Call TChart1.AddSeries(scLine)
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
TChart1.Axis.Left.Otherside = True
TChart1.Series(0).DataSource = rs
TChart1.Series(0).ValueLists.Items(0).DateTime = True
TChart1.Series(0).ValueLists.Items(0).ValueSource = DField
TChart1.Series(0).ValueLists.Items(1).ValueSource = VField
Timer1.Interval = 1000
End Sub
Private Sub Form_Resize()
Call TChart1.Move(0, 0, Width - 100, Height - 400)
End Sub
Private Sub Timer1_Timer()
Static t As Double
Static DT As Date
If TChart1.Series(0).Count = 0 Then
t = 1000
DT = Now
'Call TChart1.Series(0).AddXY(DT, t, "", vbRed)
Call AddPoint(DT, t)
Else
t = t - Rnd + 0.5
DT = DT + TimeFrame
'Call TChart1.Series(0).AddXY(DT, t, "", vbRed)
Call AddPoint(DT, t)
End If
End Sub
Private Sub AddPoint(DT As Date, Value As Double)
rs.AddNew
rs(DField) = DT
rs(VField) = Value
rs.Update
Call TChart1.Series(0).CheckDataSource
End Sub
Hello Nefis,
In this case, when datasourcing to a Recordset you'll need to reset the Datasource property when modifying the Recordset. That's due to an internal issue that may be ironed out in a future release.
ie.
I can't find a reference to this in the documentation. I'll make a note for a description to be included in the next update.
Regards,
Marc Meumann
Steema Support
In this case, when datasourcing to a Recordset you'll need to reset the Datasource property when modifying the Recordset. That's due to an internal issue that may be ironed out in a future release.
ie.
Code: Select all
Private Sub AddPoint(DT As Date, Value As Double)
rs.AddNew
rs(DField) = DT
rs(VField) = Value
rs.Update
TChart1.Series(0).DataSource = rs
End Sub
Regards,
Marc Meumann
Steema Support
Hello Nefis,
TeeChart re-reads the Recordset but 'enbloc' so I don't think you'll notice a performance overhead. CheckDatasource would need to do something similar too as to reflect changes in existing records (as well as to pick-up new records) the entire Recordset would need to be scanned.
Regards,
Marc Meumann
Steema Support
TeeChart re-reads the Recordset but 'enbloc' so I don't think you'll notice a performance overhead. CheckDatasource would need to do something similar too as to reflect changes in existing records (as well as to pick-up new records) the entire Recordset would need to be scanned.
Regards,
Marc Meumann
Steema Support
Marc,Marc wrote:Hello Nefis,
TeeChart re-reads the Recordset but 'enbloc' so I don't think you'll notice a performance overhead. CheckDatasource would need to do something similar too as to reflect changes in existing records (as well as to pick-up new records) the entire Recordset would need to be scanned.
Regards,
Marc Meumann
Steema Support
i would do it a bit different. ADO Recordset provides comprehensive set of events which could be used to update only changed records.
nefis