Hi
I am writing a GUI application that will talk to either an A to D or D to A hardware card (Analogue to Digital, ...). I chose Qt and Qwt as they both seemed to offer the flexability, power and cross platform capabilities I needed.

I have most of the Qt GUI stuff done now so I want to move onto the graph plotting. This however is where I have got stuck as I am not sure how best structure my internal data arrays to be able to generate plots efficiently.

The data I have either comes from an A to D as a series of samples in the time domain, or is generated programatically as a series of samples in the time domain to send to a D to A. Both sets of data are represented internally to the library that actually communicates with the ADC or DAC hardware as an array of 32 bit integers as both ADCs and DACs are integer devices. I only need to define the magnitude values as time (from a sample clock) is the x axis.

What I would like to do is plot the raw sample data as magnitude against time, or sample number. I also want to plot the FFT of that same data in another plot widget. Obviously I need to use another library to perform the FFT itself. The data will be of a single shot format, i.e. the user will define the length of data to capture with say the ADC and then at some point later the data will arrive to be plotted. I have a repeated capture mode also that simply performs single-shot captures, but as quickly as possible, plotting the data after each.

I started by looking at some of the Qwt examples, notably the simple plot and also refresh test examples. However both seem to pass the QwtPlotCurve->setData() member a class function, in the simple examples case a QwtSyntheticPointData derived class and for the refresh example a QwtSeriesData derived class. This was not quite what I expected as I was looking for a data object, say a vector of floats, etc. When I looked into this a bit more I realised that something a little smart was going on with these examples, as the data was generated either on the fly or once for a set of parameters and then passed to the graph widget sample by sample. I may have this wrong but thats what seemed to be going on. I have to admit I found it hard going understanding how this worked as I found no documentation for the synthetic data class or the series data class.

I am therefore not quite sure I understand how to provide data to the plot class in order to achieve the results I want efficiently without having to spend loads of time transforming and copying data. So a number of questions arrise from this which I would much appreciate some help with.

1. Given a source of data sample in some type <T>, what is the best way to pass this to the QwtPlotCurve class? It looks like I may have to convert to doubles as this seems to be what most of the data types use?
2. Given my data is effectively 1 D, i.e. y data only, and the data objects seem to expect 2 D, x/y data, do I need to create an x-axis or is there a means for the plot curve to infer this?
3. When plotting data from a repeated capture, the values in the internal data buffer will be updated rather than reallocating a new buffer, how does this work with Qwt to reduce data copying as I noticed some members associated with setData() seemed to imply that a copy would be performed and some not?
4. More generally how does the function/class derived data method work as used by the two examples?

I hope all that makes some sense. I just want to try and start writing this section of the application in the most optimal way for the application and how Qwt is intended to work, rather than approach it from the wrong direction and spend huge amounts of time and effort manipulating data from this format to that to only realise a long way down the development line that all that was unnecessary as Qwt provides this or that feature to achieve the same goal.

One other thing, I am using Qt 4.6.2 and was intending to use Qwt 6.x from svn. There was no real reason to start with the latter, apart from the newer features in it.

Cheers