A Real-Time Data Plotting Program
This article describes the implementation of rtp (real-time plotter), a live x,y data plotting utility based on the Qt windowing library. rtp combines live updates with zoom in, auto-scaling, and auto-tracking modes. It is meant to be used where gnuplot is limited, such as the termination of a live data pipeline. However, rtp is small and does not attempt to cover gnuplot's large feature set for producing publishable data plots.
The rtp source code is released under the GPL and is available at metalab.unc.edu/pub/linux/science/visualization/rtp-1.0.0.tar.gz. I developed and tested it under Red Hat 6.0, with Qt 1.44. A README file is included in the package to help you build and use rtp. A screenshot of rtp is shown in Figure 1.
rtp provides real-time updates and basic mouse-driven resolution selection. However, it lacks gnuplot's ability to send formatted, titled plots to a printer. rtp is still a simple piece of software (1200 lines of code) that needs many features added. By describing its principles here, I hope to provide a useful, gentle example of an application based on the Qt library and the X Window System. I also hope to motivate some interested people to do more work on a Linux-based real-time, interactive data visualization system. This could be done either by extending rtp or as a completely new project.
Because all of rtp's data comes from STDIN (standard input), interaction with the user through the X Window System is limited to setting the viewing mode. It allows the user to change the viewing mode even as new data points are being processed. The viewing modes are as follows:
Auto scale: the scaling is adjusted when necessary to include all received data points. This is the default mode and can be selected by pressing a button on the toolbar.
Auto tracking: maintains a fixed scaling, but varies the viewport offset to track the latest points. This mode is selected by pressing a button on the toolbar. The scaling will be fixed at what it was before the toolbar button was pressed.
User-defined fixed: maintains a fixed viewport (both scale and offset), as defined by the user. This mode is selected when the user drags out a viewport in the plot window with the mouse.
I based rtp on the Qt library, because many others in the Linux community are using it (e.g., KDE) and because of its high-quality documentation. An HTML tree (guaranteed to be synchronized with the Qt source because it is automatically generated from the source code and comments) describes all of Qt's classes and functions. Dalheimer also wrote a book on Qt programming that is a very helpful introduction (see Resources).
The Qt library provides a GUI programming environment that is quite complete. When programming in the Qt environment, no reference to the underlying XLib library is necessary. Qt's functionality extends beyond the GUI domain to include container classes that implement several standard data structures.
Each of Qt's functional components is packaged as a C++ class, giving C++ wizards much to ponder and tinker with and those of us who like to write operational code a good tool set. For myself, having about a year of experience writing production C code with only a college course in C++, it was fairly easy to learn the Qt C++ framework.
The Qt library makes integration of independently developed classes easier through its C++ extensions: “signals” and “slots”. A signal is a class member function that is undefined at compile time. A slot is a member function that is specially designated for connection to a signal at runtime. For example, a GUI button class could have a Push signal. At runtime, a plot window's slot Render could be connected to the button's Push. From then on, code that calls the button's Push method effectively calls the plot window's Render method.
Code based on the signals and slots mechanism is easier to read and maintain than that dealing with runtime function-pointer tables. (I'd bet the implementation uses a function pointer or two.) Qt also takes care of annoyances such as stubbing non-connected signals to an empty function, so you don't get a segmentation fault from a null pointer.
The drawback of signals and slots is that they are non-standard C++ extensions using new syntax, so Qt code with signals and slots must be passed through a preprocessor provided with the Qt library before it can be compiled. Dalheimer's book explains signals and slots in sufficient detail for you to start using them.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Introduction to MapReduce with Hadoop on Linux
- RSS Feeds
- Weechat, Irssi's Little Brother
- New Products
- Developer Poll
- Reply to comment | Linux Journal
48 min 53 sec ago - Reply to comment | Linux Journal
1 hour 34 min ago - Didn't read
1 hour 44 min ago - Reply to comment | Linux Journal
1 hour 49 min ago - Poul-Henning Kamp: welcome to
3 hours 59 min ago - This has already been done
4 hours 33 sec ago - Reply to comment | Linux Journal
4 hours 45 min ago - Welcome to 1998
5 hours 34 min ago - notifier shortcomings
5 hours 57 min ago - heroku?
7 hours 34 min ago





Comments
bad link
http://www.linuxjournal.com/article/3921
refers to rtp 1.0.0. Link is broken, version is 1.0.1
ftp://metalab.unc.edu/pub/linux/science/visualization/rtp-1.0.1.tar.gz