Need urgent help regarding wxFreeChart

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
seshikanth
In need of some credit
In need of some credit
Posts: 1
Joined: Thu May 13, 2010 11:09 am

Need urgent help regarding wxFreeChart

Post by seshikanth »

Hi,

I am plotting a graph for my application using wxFreeChart.
Graph is about network statistics on y-axes and time on x axes.
At 1st second, i need to plot data on y-axes and for the 2nd second, i need to plot the data on y-axes. In precise, my graph is dynamic in similar to task manager performance monitor graph.

I downloaded wxFreeChart and going through the demo plots. My scenario is similar to XYDemo5 given in xydemos.cpp in sample programs. But when i execute the program binary of sample program, i am not getting any output for xy dynamic graph in wxFreeChart.

Any quick workaround would be greatly appreciated.

Thanks,
Seshikanth.
Blind_Cat
Earned a small fee
Earned a small fee
Posts: 15
Joined: Thu Sep 24, 2009 8:04 am

Post by Blind_Cat »

Hello, seshikanth.

What version wxFreeChart? What version wxWidgets? What compiler? What OS?

That do not show dynamic changes? wxFreeChartDemo or your application?
WBR, Blind_Cat.
Alan Yaniger
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 18, 2010 2:21 pm

Post by Alan Yaniger »

I'm having the same problem. I'm using wxWidgets 2.8.10, wxFreeChart 1.6 on Debian Lenny, gcc 4.3. When I run the demo, and open the category "XY Charts",and choose "XY Demo 5 - dynamic", it shows nothing. This, unfortunately. is exactly what I need a sample of. I need to be able to update a graph in real-time. Any help would be appreciated.
Blind_Cat
Earned a small fee
Earned a small fee
Posts: 15
Joined: Thu Sep 24, 2009 8:04 am

Post by Blind_Cat »

Yes. It's really bug.

To see dynamic drawing change in file xydemos.cpp
at line 304
===
Add(y);
===

to
===
BeginUpdate();
Add(y);
EndUpdate();
===
WBR, Blind_Cat.
Alan Yaniger
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 18, 2010 2:21 pm

Post by Alan Yaniger »

Andrey sent me a fix. Here's his message:

Here is the bug in dataset.cpp, it's present in 1.6 release, but fixed in SVN.

You can fix it by changing Dataset::DatasetChanged() method in dataset.cpp to following:

void Dataset::DatasetChanged()
{
if (m_updating) {
m_changed = true;
}
else {
FireDatasetChanged();
m_changed = false;
}
}
Alan Yaniger
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 18, 2010 2:21 pm

Post by Alan Yaniger »

I'm still having a problem with dynamic graphs, though. When there's no activity, and a timer event adds to the dataset, as in the dynamic graph example, the graph gets properly updated. However, if I'm reading data from the serial port in a loop, the graph does not get updated until the loop exits, even if I add to the dataset. How can I get the graph to be updated during the loop which reads from the serial port?
Alan Yaniger
In need of some credit
In need of some credit
Posts: 4
Joined: Tue May 18, 2010 2:21 pm

Post by Alan Yaniger »

I ended up using a separate thread for reading from the serial port, and that seems to have gotten around the problem.
Post Reply