ObjexxPlot: Welcome to the Family | Objexx Labs
Like most engineering simulation tools, ObjexxSISAME has various time series and function inputs and outputs, and users need a way to plot them. Even though ObjexxSISAME does its own plotting there is still a need for a solid stand-alone plotting tool. We have used various solutions over the years but none met all our goals. Recently we thought Kst was the answer: it seemed powerful, fast, and flexible. Alas, even building the latest code didn't solve the command line processing and overlay plotting bugs. Plus it can't, of course, handle NHTSA UDS file, which we still support in ObjexxSISAME along with ASCII signal files.
Recently (over lunch burritos!) it hit us: we have the signal processing code and Qwt plotting sitting there in ObjexxSISAME so how hard could it be to extract that and build exactly the plotting tool we wanted. With some deadlines bearing down we set a goal of getting a prototype running in a few days and having the basic application done in one person-week. This turned out to be very doable, and with a couple more days to add some spiffy features and print/export support ObjexxPlot was born. (Just to be confusing the first version is 2.0 to sync with ObjexxSISAME versioning.)
So what were our goals for ObjexxPlot? Most important, it had to be very easy to use. So, you can throw an arbitrary number of file names/globs at its command line and it loads them all into overlay plot tabs grouped by their dimensional types. Curve controls for line thickness and display of data point dots should be one step/click away. Of course you need to be able to zoom and pan around the plot and the zoom+pan state should be preserved if you look at another plot tab and when you print or export the plot.
Since we want to allow large sets of curves to be displayed in each overlay for usability we need a way of seeing which curve(s) go with which file(s). Qwt doesn't yet have an efficient curve "picker" capability but a quadtree is in the works! Until then we have highlighting of curves by legend selection with selected curves brought in front of unselected and unselected curves given alpha transparency.
And, of course, the plots have to look good. So curve antialiasing is enabled. And the GUI has a simple, clean layout.
Plots are not very useful if you can't print them and export them to high-quality PDF and image format files. Qt's printing and export support is a little bit over-complicated, with printers, and printer-info, and painters, and various image objects. And then some things that should work just don't work on all platforms. After some trial and a lot of error we found the right combination of QPainter, QPixmap, QImage, and so forth to get it all working.
Setting up the plot legends for export proves to be a challenge. An early lesson was that Qwt's legend support wasn't flexible enough for even GUI use and certainly not useful for printing and exporting. The output legend can't, of course, have a scroll bar to view all the entries so what turned out to make sense was to "draw" an offscreen legend view. For print and PDF output the legend has to be paged (in case of many curves) and have enough space for long path/file names. Suffice it to say, we spent a surprising amount of time getting legend output right!
Finally, we wanted ObjexxPlot to be fast. Really fast. As ObjexxSISAME models get larger the amount of signal data grows and we don't want users to have to wait for plots to load. Plus, well, why not! Between Qwt's native speed and its support for sharing your data pointers (to avoid copying), and C++11 move semantics we were able to get great performance. Signal objects are both owned by the plot they live in, which is the right OO model, and are never copied despite needing to read them before knowing which plot they will be assigned to. Nice!
We have lots of ideas for extending ObjexxPlot (and we welcome input from our users) but this was a great little whirlwind project that shows how much you can leverage existing code and, more important, knowledge of packages like Qt and Qwt to achieve impressive development efficiency. Not sure why it took us so long to do this — never underestimate the inspiration of a good burrito!
Contact Objexx for more information on ObjexxPlot.