Working on Some Qwt Graphs
Link to previous Article though it doesn't have any code.
I am back with some more code. Recently I found working on some QWT graphs and as I dug deeper into Qwt I found that it's quite easy to work out something quite functional.
So I developed a small utility to display Qwt's graphs and a small logic that would detect spikes in a data stream.
Here's a screen shot of the actual thing in action. The left graph shows a curve and the right graph shows the detected spikes in that curve. I am showing both up and down-ward spikes.
The time is shown as units and there are some tutorials on how to get correct time to shoe on X-Axis. But here it doesn't matter as this is just a Proof of concept.
I have used a c_sinewave header to get the sinewave and I am introducing spikes using a simple randomizing logic.
On detection part, I have following comments above the block:
// tmp is current point; listOfSinePoints is super set;
// we will have a window as a subset of listOfSinePoints
// Spike detection logic here
// 1. find goodPoint window
// 2. See if current Point is in that window;
// if it is then it's a valid point else it's a spike
This is quite simple logic and works well for selected cases. A more complex and esoteric logic like prediction-based spike detection can be introduced if such cases are observed where this simple logic fails.
This serves as a good intro to Qwt's plots and curves.
Comments
Post a Comment