using Series->DataSource from C++
Posted: Fri Feb 15, 2008 4:04 pm
Hi,
i am trying to connect my series to a mysql datasource (TeeChart 7 Activex). For MySQL I create an ADO recordset through the MySQL ODBC driver.
i am using TeeChart from a #import statement.
this gives me a runtime error, what is the good way to do this ? What type does the pserie->DataSource expect ?
i am trying to connect my series to a mysql datasource (TeeChart 7 Activex). For MySQL I create an ADO recordset through the MySQL ODBC driver.
i am using TeeChart from a #import statement.
Code: Select all
#import <msado15.dll> rename("EOF", "EndOfFile")
#import "C:\Program Files\TeeChart7\TeeChart7.ocx"
_COM_SMARTPTR_TYPEDEF(_Recordset, __uuidof(_Recordset));
_RecordsetPtr recordset = ...;
CString sql(_T("SELECT * FROM measurements limit 200"));
recordset->Open(sql);
CWnd * pteechart = ...;
ITChartPtr teechart = pteechart->GetControlUnknown();
_variant_t v((LPUNKNOWN)recordset);
long serie = teechart->AddSeries(scLine);
ISeriesPtr pserie = teechart->Series(serie);
pserie->DataSource = v;
pserie->LabelsSource = "DateTimeID";
pserie->XValues->ValueSource = "DateTimeID";
pserie->XValues->DateTime = TRUE;
pserie->YValues->ValueSource = "RelativeTime";