Page 1 of 1

COleDispatch exception using TChart 5.0.6.0 OCX

Posted: Wed May 12, 2004 9:29 am
by 6919297
Hi,

I've just updated from 5.0.5.0 to 5.0.6.0 and now get this exception when calling the CAxis::MaxVisibleSeriesValue() method or the CCanvas::GetHandleDC() method. The code for these methods has not been changed and the IDL for 5.0.6.0 suggests that there are no changes in the OCX for these functions.

Any suggestions please? (Other than using version 6 :)

Glyn

Posted: Wed May 12, 2004 6:56 pm
by Pep
Hi,

I cannot reproduce the problem here using the following line (with the TeeChart Pro v5.06) :
m_chart.GetAxis().GetBottom().MaxVisibleSeriesValue(true,0);

Could you please post the code which are you using or post an example to the steema.public.attachments newsgroup ?

Posted: Mon May 17, 2004 8:46 am
by 6919297
Hi, I don't think I can distill the code down to anything that could be posted as the app. is very complex. But basically the primary interface to the TeeChart OCX is the autogenerated C++ classes found in the examples directory of the installation (which incidentally don't appear to have been updated for 5.0.6).

In response to an OnBeforeDrawChart event the code gets a CAxis object for the left axis. It then calls MaxVisibleSeriesValue(TRUE, 0) but the invoke method returns 0x80020009. I have seen other function calls return this value as well, MaxVisibleSeriesValue just happens to be the first one hit.

I am using VisualStudio.NET 2002 by the way.

Posted: Wed May 19, 2004 9:04 am
by Chris
Hi Glyn,

In VS.NET 2002 using TeeChart AXv5.0.7.0 (the latest release), the following code does not produce an error:

Code: Select all

void CCplusdotNETMFCDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	m_Chart1.AddSeries(scBar);
	CSeries bar1 = m_Chart1.Series(0);
	bar1.FillSampleValues(20);
}
BEGIN_EVENTSINK_MAP(CCplusdotNETMFCDlg, CDialog)
	ON_EVENT(CCplusdotNETMFCDlg, IDC_TCHART1, 39, OnBeforeDrawChartTchart1, VTS_NONE)
END_EVENTSINK_MAP()

void CCplusdotNETMFCDlg::OnBeforeDrawChartTchart1()
{
	double ret;
	CAxes axes = m_Chart1.get_Axis();
	CAxis leftAxis = axes.GetLeft();
	ret=leftAxis.MaxVisibleSeriesValue(true, 0);
}
The value ret here is wrong (-9.255e+061) as OnBeforeDrawChart is called before the axes have been drawn.

Do you get the same results at your end?

Posted: Thu May 20, 2004 1:31 pm
by 6919297
Hi Chris,

I've tried going back to 5.0.5, which was working fine before, and it now crashes on this same call. Putting your code in place causes the same crash. The code works ok on the first graph that our app displays but crashes when it's starting up a new graph.

The code works fine on other PC's in the office, the only difference is that mine has had 5.0.6 installed at some point. As part of our build we copy the teechart5.ocx to the system32 directory and register it and this has always worked fine before. Is it possible that 5.0.6 has left some registry setting somewhere that might be interfering?

Regards

Glyn Thomas

Posted: Fri May 21, 2004 8:21 am
by 6919297
Further to this, the problem seemed to be related to just one specific application data file. If we changed the current file being displayed then when the new graph was created there was no problem.

However, from what I could observe of the problem, it seemed to me that the call to MaxVisibleSeriesValue() was being made at a time when there were no series with data associated with the left axis. Presumably this meant that the left axis had not done it's calculations at that point. I don't know if this helps at all?

regards

Glyn Thomas

Posted: Fri May 21, 2004 12:08 pm
by Chris
Hi Glyn,

I'm still having difficulties reproducing this one in TeeChart AXv5.0.7.0. This version of TeeChart can be downloaded from Download -> Customers Downloads but only in the form of TeeChartAX5English.exe (OCX + CAB). The full blown installer, TeeChart5Activex.exe, will be available shortly.

I have attached the project I've been working on to:
news://www.berneda.com/steema.public.attachments
This project contains all the new class files (*.cpp, *.h) you need to run AXv5.0.7.0.

Can you reproduce this problem with AXv5.0.7.0? If you can, is there any chance of you modifying my project so I can reproduce it here?

Posted: Fri Jun 04, 2004 10:04 am
by 6919297
Hi Chris,

Sorry to be so long replying. I've downloaded your code and recreated the project in the version of visualstudio that we use, and there is no problem. I tried running it with no graph series created or with no serier associated with the left axis but still no problem.

I think this must have been something very specific to the data file in our application. If I ever discover what was going on I'll let you know.

Thanks for your help.

Glyn