-
October 11th, 2005, 07:36 AM
#1
C++ MFC MSChart
I am a beginner in C++.
I have tried to implement a chart from a MFC dialog box by using MSChart.
I didn't find any tutorial to learn how to link data with a MSChart and how to handle basic implementation.
Is it because MSChart is only used in VB?
Thanks for any help
Kropcheck...
-
October 11th, 2005, 07:43 AM
#2
Re: C++ MFC MSChart
Since MSChart is an ActiveX control, it can be used with any language that speaks COM, including C++. Take a look at this article . It should help get you started.
Gort...Klaatu, Barada Nikto!
-
October 11th, 2005, 08:33 AM
#3
Re: C++ MFC MSChart
Thanks for this quick reply, it is always nice to get support by advance user.
I have tried this tutorial (even before sending my first mail) which seems fairly simple but nevertheless I had a problem to access to the following function:
m_Chart.SetChartData(saRet.Detach());
"SetChartData" doesn't belong to the CChart class when "Refresh" is perfectly recognised.
with -> class CChart : public CWnd
-> CChart m_Chart;
I went through all the class members/functions of m_Chart but none looks like "SetChartData" or BindData. There is probably more than one way to link data with the chart. I am not used to too much advance variable type but I am opened to any possibilities.
Kropchek
PS: By the way, the problem could come from the version of MSChart: Microsoft Chart 6.0 (SP4) OLEDB with Microsoft Visual Studio C++.NET 2002.
-
October 11th, 2005, 08:40 AM
#4
Re: C++ MFC MSChart
Have you followed the steps to add the chart object to your dialog? The object should be of type CMSChart, not CWnd.
Gort...Klaatu, Barada Nikto!
-
October 11th, 2005, 08:57 AM
#5
Re: C++ MFC MSChart
I think I did a stupid mistake when I used the "Variable Wizard", by mistake I modified the "Variable type". So by default the Wizard created a CWnd type class instead of CMSChart.
I hope now everything will go OK.
More news in a few minutes.
Thanks for your patience.
Kropcheck... which thinks that these wizards are great but never trusts them even when no error appears.
-
October 11th, 2005, 09:32 AM
#6
Re: C++ MFC MSChart
Obviously the wizard which create the variable doesn't work properly.
Each time I create a variable linked to the component ID_MSCHART, I end up with a new class derivated from CWnd and not CMSChart.
I have tried to change manually "class CChart : public CWnd" to "class CChart : public CMSChart" but CMSChart is undefined as class.
Should I import the library as "#include Mschart.h" somewhere or could it be a problem of .dll (which seems strange because I managed to add MSChart in the toolbox of component).
Kropcheck
-
April 22nd, 2013, 06:14 AM
#7
Re: C++ MFC MSChart
Did you make the wrapper for the class?
Try to use:
#import <msdatsrc.tlb> no_namespace
#import <mschrt20.ocx> no_namespace
Then make a member variable for the chart, via Resources Dialog Designer, by assigning the chart to the class wrapper, something like CDMSChart class.
Cheers,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|