Fastplotter
Introduction
In the course of putting together a set of real-time graphs using python, I found that the resulting application took around 30-40% of the available CPU time. Looking for an alternative Qt/Qwt was suggested. I took a demo-application and transformed into a program which can connect into M&C monitor streams and draw fast plots with <1% CPU usage.
Pythonic persons would look down upon this as hard-coding, so I endeavored to make the program and resulting screens configurable via an XML file. Using the same binary, the new application may serve a number of fast RT-displays.
Layout Management
If only a single graph is desired, layout is not necessary. However, if multiple graphs are specified, then layout management becomes an issue. Two types of layouts are supported: Grid layout (where graphs are set into equally sized sub-regions) or box layouts, where a hierarchy of layout managers are used to specify graphs of varying sizes. Grid layouts are the easiest to manage, while box layouts require an understanding of GUI layout mechanisms.
Example Grid Layout:
<graphconfig>
<gridlayout>
<TR>
<TD>
<graph></graph> Graph at (col=1,row=1)
</TD>
<TD>
<graph></graph> Graph at (col=2,row=1)
</TD>
</TR>
<TR>
<TD>
<graph></graph> Graph at (col=1,row=2)
</TD>
<TD>
<graph></graph> Graph at (col=2,row=2)
</TD>
</TR>
</gridlayout>
</graphconfig>
XML Syntax
Tag Hierarchy
The <graphiconfig> is the root node, and only one instance is allowed. The vbox/hbox layout technique is based upon (but not implemented through) the XUL syntax. The page documenting box layouts can be found
here.
In summary, this model allows you to divide a window into a series of boxes. Elements inside of a box will orient themselves horizontally or vertically. Specifying the following would place two graphs side-by-side:
<graphconfig>
<hbox>
<graph>
</graph>
<graph>
</graph>
</hbox>
</graphconfig>
A more complex example would place a set of four graphs on a page: (text between tags are comments)
<graphconfig>
<vbox>
<hbox>
<graph>
(Upper left graph)
</graph>
<graph>
(Upper right graph)
</graph>
</hbox>
<hbox>
<graph>
(Lower left graph)
</graph>
<graph>
(Lower right graph)
</graph>
</hbox>
</vbox>
</graphconfig>
<graphiconfig> Tag
<frame> Tag
<vbox> Tag
<hbox> Tag
<graph> Tag
<plot> Tag
<xaxis> Tag
<yaxis> Tag
--
JoeBrandt - 08 Feb 2009