Getting the DataSource Info out of chart

TeeChart for ActiveX, COM and ASP
Post Reply
jfrancis
Newbie
Newbie
Posts: 9
Joined: Fri Nov 02, 2007 12:00 am

Getting the DataSource Info out of chart

Post by jfrancis » Fri Sep 25, 2009 12:53 am

I seem unable to get the DataSource decoded from a VARIANT

VARIANT DataSrc = m_Chart.Series(0).GetDataSource();
// Ok now what

I'd like to get the connection string out and what the axis value string are set to.

Thanks

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

Re: Getting the DataSource Info out of chart

Post by Narcís » Fri Sep 25, 2009 3:55 pm

Hi jfrancis,

What are you exactly trying to achieve with that? If you want to get axes labels you'd better use OnGetAxisLabel or OnGetNextAxisLabel event. For more information about that please read tutorial 4.

Hope this helps!
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

jfrancis
Newbie
Newbie
Posts: 9
Joined: Fri Nov 02, 2007 12:00 am

Re: Getting the DataSource Info out of chart

Post by jfrancis » Mon Sep 28, 2009 4:42 pm

Sorry was was not clear.

I'm not interested in the Axis-Label, that is ok at my end.

What I'm after is to look at the contents of the DataSource, it is returned as a VARIANT data type, see "VARIANT DataSrc = m_Chart.Series(0).GetDataSource();"

I am unsuccessful in converting it into an ADO (ADODB::_ConnectionPtr) object so that I can read the "connection string" and
the ADO (ADODB::_RecordsetPtr) to get the "source" or SQL command string.

I am working in C++ and MFC if this helps.

Thanks,
John Francis

Yeray
Site Admin
Site Admin
Posts: 9618
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Getting the DataSource Info out of chart

Post by Yeray » Mon Oct 05, 2009 9:47 am

Hi John Francis,

We've investigated it but I'm afraid we don't see a way to retrieve this information with TeeChart AX.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jfrancis
Newbie
Newbie
Posts: 9
Joined: Fri Nov 02, 2007 12:00 am

Re: Getting the DataSource Info out of chart

Post by jfrancis » Tue Oct 06, 2009 3:45 pm

I got some of the info I needed see source code below:

//|----------------------------------------------------------------------------
void CTest_TChart_DB_Load_vADlg::DisplaySourceStr(void)
{
VARIANT vrDataSrc = m_Chart.Series(0).GetDataSource();
ADODB::_RecordsetPtr aRecordSet = (_variant_t)vrDataSrc;
_variant_t var;
var = aRecordSet->GetSource();
CString strSource = (_bstr_t(var.bstrVal));
// Source String
CString sourcestr;
sourcestr.Format("Source: %s", strSource );
m_Source.SetWindowText( sourcestr );

_variant_t varConnect;
varConnect = aRecordSet->GetActiveConnection();
ADODB::_ConnectionPtr aConnection = (_variant_t)varConnect;

CString strConn = aConnection->GetConnectionString();

CString connstr;
connstr.Format("Connection String:\n %s", strConn);
int count = connstr.Replace( _T(";"), _T(";\r\n") );



m_ConnEditCtrl.SetWindowText( connstr );
}

Yeray
Site Admin
Site Admin
Posts: 9618
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Getting the DataSource Info out of chart

Post by Yeray » Wed Oct 07, 2009 8:32 am

Hi jfrancis,

Thank you for your feedback. It may help another user with a similar problem in the future.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply