ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Error compiling chartviewer.cpp
Posted by nicole on Apr-03-2012 11:08
Hi,

I'm wondering if you could implement a simple real time graph without using chartviewer
because I tried using chartviewer but it has errors during compilation. I added the
Chartviewer.h and Chartviewer.cpp along with my classes and chose 'use mfc in a shared
dll' in the use of mfc option but it yields a lot of errors such as:

error C2504: 'CStatic': base class undefined
error C2146: syntax error: missing ';' before identifier 'HBRUSH'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\\users\\nicole\\desktop\\ms_thesis (vs2010)\\conemrecog\\conemrecog\\ChartViewer.h
183 1 ConEmRecog
error C2061: syntax error : identifier 'CDC' c:\\users\\nicole\\desktop\\ms_thesis
(vs2010)\\conemrecog\\conemrecog\\ChartViewer.h 183 1 ConEmRecog
Error 5 error C2143: syntax error : missing ';' before 'private'
c:\\users\\nicole\\desktop\\ms_thesis (vs2010)\\conemrecog\\conemrecog\\ChartViewer.h
188 1 ConEmRecog

I'm using VS2010 and my application has common language runtime support. Any ideas?

Thank you very much!

  Re: Error compiling chartviewer.cpp
Posted by Peter Kwan on Apr-04-2012 01:55
Hi nicole,

The CChartViewer is for a MFC project. When you create the project in Visual Studio, is it created as an MFC project (instead of a Windows Forms or other type of project)? Do your project has any MFC container (eg. CDialog) that you can use to contain the CChartViewer? Note that linking the project to an MFC DLL will not change the project to MFC.

You mentioned that your project has "common language runtime support". I suspect it is not an MFC project. It may not even be standard C++, but is C++/CLI. Note that C++/CLI is a Microsoft proprietary language, and is not compatible with C++, although C++/CLI uses some C++ syntax (just like Javascript is not compatible with Java, despite the similar name). Only C++/CLI code can use the CLR.

If you are in fact using C++/CLI, I suggest you use "ChartDirector for .NET" instead. ChartDirector for .NET is CLR compliant and can work with any CLR language, including C++/CLI. The "ChartDirector for C++" should be used only with standard C++.

Hope this can help.

Regards
Peter Kwan

  Re: Error compiling chartviewer.cpp
Posted by Nicole on Apr-04-2012 16:47
Hi,
Thanks for your reply. Yes indeed my project is not mfc. My program is a win32 console
application. Given this, is it not possible to implement a real time graph using chartdir?


Thank you very much!

  Re: Error compiling chartviewer.cpp
Posted by Peter Kwan on Apr-05-2012 00:12
Hi Nicole,

Yes. You can use realtime chart in any application. However, your application must have a graphical user interface to display things.

From my understanding, a console application does not have a graphical user interface. Would you mind to clarify how are your currently displaying things (such as a push button) in your console application? Are you using some special GUI framework?

The ChartDirector includes sample code for the MFC GUI framework, and the QT GUI framework. The code for both GUI frameworks are released in source code format (both the MFC CChartViewer and the QT QChartViewer are in source code). If you are using other C++ GUI framework, you can freely port them to the GUI framework of your choice. (Because there are hundreds of different GUI frameworks for C++, we are unable to provide sample code for all possible GUI frameworks that can be used in C++.)

If you need further information, please kindly advice which GUI framework you are using?

Regards
Peter Kwan

  Re: Error compiling chartviewer.cpp
Posted by Nicole on Apr-05-2012 01:27
Hi peter,

I'm using a windows form with a picturebox to display the image outputted by
chartdirector. However, my issue is for every iteration, my array for the graph is
increasing that's why I wanted to have a real time graph. But by just outputting the
graph and displaying the image in the picturebox doesn't quite show the desired changes
to the graph as A real time graph would.

Thank you verymuch.

  Re: Error compiling chartviewer.cpp
Posted by Peter Kwan on Apr-05-2012 03:51
Hi Nicole,

By "picturebox", do you mean "System.Windows.Forms.PictureBox"? If this is the case, your code is using the .NET Windows Forms GUI framework with C++/CLI. As a .NET program, it is suggested you use "ChartDirector for .NET", which works with all CLR languages.

For displaying the chart in a PictureBox, it should act the same way as displaying the chart with a CChartViewer. The "changes" to the chart are due to changes to your data. If your data do not change or only change slightly, the chart will not change or only change slightly.

In the original realtime chart sample code, the data array "shifts". When a new data point arrives, the oldest data point is removed from the array, and the newest data point is appended to the array. This means the array is essentially shifted by one position before the new data point is added to the array. This results in the scrolling effect of the realtime chart. As the chart scrolls, the visible duration of the chart remains unchanged (which is 240 seconds in the sample code).

In the sample code, the shiftData function in the sample code performs the shifting of the array and appending on the new data value.

Hope this can help.

Regards
Peter Kwan