TeeChart for ActiveX, COM and ASP
-
xpar
- Newbie
- Posts: 8
- Joined: Thu Sep 15, 2005 4:00 am
- Location: nl
Post
by xpar » 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.
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";
this gives me a runtime error, what is the good way to do this ? What type does the pserie->DataSource expect ?
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Fri Feb 15, 2008 4:22 pm
Hi xpar,
You'll find an example at C:\Program Files\Steema Software\TeeChart Pro v7 ActiveX Control\Examples\Visual C++\Version 6\ADO Single Record. More information can also be found at Tutorial 15 - MS VC++ Applications. You'll find the tutorials at TeeChart's program group.
Hope this helps!
-
xpar
- Newbie
- Posts: 8
- Joined: Thu Sep 15, 2005 4:00 am
- Location: nl
Post
by xpar » Mon Feb 18, 2008 9:25 am
Thanks, I changed to
Code: Select all
_variant_t v((LPDISPATCH)recordset);
and it worked!