|
Does anyone know how to use this control to plot dynamic data?.
I have a function which is called when a new value(val) enters my application.
I want to plot this new value at point : x = x+1 , y = val. The graph should then jump one step to the left if x is larger than x_max.
Best regards Bjornarsen
Bjornarsen
|
|
|
|
|
Hi
Here is one solution for your reference.I guess that you want a dynamic chart in which X value is increasing with time and Y value is random or defined under your command.If it is,you can use setdata() to feed your requirements.
Following is some sample code FYI...
======================================================
void CXGraphDemoView::OnDrawChart()
{
// TODO: Add your command handler code here
// setup data
timer1=SetTimer(1000,10,NULL);
// m_Graph.GetXAxis(0).SetCurrentRange(-500,0,30);
}
void CXGraphDemoView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
// for (int i = 0; i < VALCOUNT; i++)
if (nCount<valcount)
{
="" m_values[ncount].fyval="-85" +="" ((="" sin(ncount="" 180.0="" *="" 3.14115926)="" 10));
="" m_values[ncount].fxval="nCount;
" m_graph.setdata="" (m_values,="" ncount+1,="" 0,="" 0);
="" m_graph.getyaxis(0).setcurrentrange(-120,-40,10);
="" m_graph.getxaxis(0).setcurrentrange(0,500,30);
="" if="" (ncount="">500)
{
m_Graph.GetXAxis(0).SetCurrentRange(nCount-500,nCount,30);
}
m_Graph.Invalidate();
}
nCount++;
CView::OnTimer(nIDEvent);
}
void CXGraphDemoView::OnStopTimer()
{
// TODO: Add your command handler code here
if (timer1!=NULL)
{
KillTimer(timer1);
TRACE("Stopped.\n");
}
}
================================================================
At first you can allocate big enough array to contain your data(X/Y values) and initialized with zero.Then update the array values with pair of X/Y value and use SetData(,Count,) to increase count to update the graph data.You can get one dynamic chart floating with time.
Thanks for the author's great job!
Cheers!
Sam Zhao
|
|
|
|
|
This property bug is met in my side too.Refer to prev articals it seems that the auther has known this bug and will provide one fixed version.But till now we can't see it.
Do any one have fixed this bug?Can you share your solution?I tried to fix it under one user's steps.But seems no effect...
I met this issue under release and debug mode.
|
|
|
|
|
You must open de XGraph_src project.
Then, edit IDD_CURVE dialog and add a combobox called IDC_CBFILLCURVE in the same position that you can see in the example (Xgraph_bin).
Recompile it, and the problem is solved
|
|
|
|
|
still does not work, can someone send me a working version?
I got a lot of crashes with this code.
andrew_xiang@yahoo.com
|
|
|
|
|
i compiled the pure demo with vc++6 and get an "debug assertion failed" message in dlgdata.cpp, line 43 when i doubleclick on one of the graphs. this happens in both, release and debug version. is this a bug or have i forgotten to do some changes?
|
|
|
|
|
Prev artical by another also mentioned this bug in the posted code here.But this bug is fixed in author's demo DLL file.Maybe the great author mixed up the source code here .
Another problem in the posted project is about the project settings.Refer to prev artical you can find that you should modify the setting to get sucessful DLL in debug mode.
Hope the auther would provide another release to improve this great job!
Cheers!
Chao
|
|
|
|
|
--------------------Configuration: XGRAPH - Win32 Debug--------------------
Build : warning : failed to (or don't know how to) build 'E:\Temp\Graph Source\XGraph_src\Debug\XGRAPH.pch'
Compiling...
StdAfx.cpp
e:\temp\graph source\xgraph_src\stdafx.cpp(5) : fatal error C1083: Cannot open precompiled header file: 'Debug/XGRAPH.pch': No such file or directory
Error executing cl.exe.
XGRAPH10d.dll - 1 error(s), 1 warning(s)
|
|
|
|
|
try to build the "Win32" Release or Debug instead of the "Win32 Unicode" Release or Debug
|
|
|
|
|
Prev thread has mentioned this issue.
|
|
|
|
|
Most of the problems on XGraph discussed here before still have no answers...
So, when I looked at it closer I've found some troubles that're very important to me:
1. It will be nice if I could rotate text by 90 degree when using the date-time format on X axis so it could comprise more values.
2. Famous assertion on dbl-click (properties dialog).
3. Print and print preview still don't work.
4. There's some clipping problems while displaying values on X axis. That problem can be figured out on the screenshot provided in the original article.
5. Can I enlarge the bitmap resolution on saving?
|
|
|
|
|
I am trying to use the graph in visual basic and I cant add the dll as a reference or control. What is the way to use this control in a visual basic application?
Abhi
|
|
|
|
|
Hey,
just a short problem report, when you delete the curves which gives the maxmima and minima for the autoscaling the autoscaling is not refreshed and stays on the values of the delete curves. This only will change when you bring in a new curve with greater max and smaller min.
Cheers!
|
|
|
|
|
thank you for this very nice component.
But have you updated the demo sources.
I cannot compile sources with VC++ .NET (functions are not found at link).
|
|
|
|
|
Sir!
when i run the project, visual c++ tell me can not find the XGraph10d.dll file,but i have, can you tell the reaon why i can not run the project???
thank you very much!
|
|
|
|
|
Just copy the DLL sitting in the Release folder to Debug folder or build in release mode. This will fix your problem.
Sisira
|
|
|
|
|
Hi
Thanks for the gr8 work Gunnar Bolle. Its really fantastic, but i face problem with printing too. I am even getting assertion failure when i double click on the graph to popup the properties dlg, this occurs only when i use the .dll and .lib's compiled in debug mode, but whereas if i compile in the release mode it works..fine..
can anyone suggest on this..pls...
Really good work.. iam inspired with the work...
venky
|
|
|
|
|
Got the same problem.
It only shows in Debug-Mode because only Debug-mode asserts, if a window-handle is valid.
The problem is in CurveDlg: the control with ID IDCCBFILLCURVE no longer exists as a combobox but now is an checkbox.
So you have to delete the member m_cbFillCurve and all references including DDX_Control and DDX_CBIndex
|
|
|
|
|
sorry but this doesn't seem to be the solution to this problem - it crashes anyway!
|
|
|
|
|
hi Gunnar Bolle,
Great work gunnar..
Your graph have solved many of my 2d graphics problems.
I am interested in your new versions of XGRAPH. send me the link or upload the newer versions.
I am unable to print the graph and i expect that there is bug in printing.
bye,
krush.
|
|
|
|
|
Hi
Thanks for the gr8 work Gunnar Bolle. Its really fantastic, but i face problem with printing too. I am even getting assertion failure when i double click on the graph to popup the properties dlg, this occurs only when i use the .dll and .lib's compiled in debug mode, but whereas if i compile in the release mode it works..fine..
can anyone suggest on this..pls...
Really good work.. iam inspired with the work...
venky
|
|
|
|
|
This control is awesome! Kudos
Best regards
Enrico
|
|
|
|
|
I downloaded the program and when I build it there is no problem but when I try and execute it, I get an error saying :
"This application has failed to start because XGRAPH10d.dll was not found. Re-installing the application may fix this problem"
Please I am so new to all this that I am not sure what to do, please can anyone help?
|
|
|
|
|
you have started the application in "Debug"-Mode, so it is searching for a XGraph10d.dll. Try to compile the XGraph-Source in "Debug"-Mode to generate the XGrahph10d.dll, or just switch the application to "Release"-Mode, so that the XGraph10.dll (watch out the "d" )is used, which is already there.
Another hint:
When you try to compile the Debug-Version of the XGraph, there will be an error message about "Precompiled"-Headers. To solve this, you have to change the Project-Settings for the File "stdafx.h" to /YX"stdafx.h" under the Project-Settings -> c/c++ (Tab) -> "Project-Options" (Textfield).
|
|
|
|
|
hi,
You have run the program in the debug version.
Change the settings to release version and rebuilt the program, your problem will be solved.
If u want to built in debug version first built the xgraph_src and then copy the xgraph10d.dll to your release folder and rebuild
regards,
krush
|
|
|
|