1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>QCustomPlot 1.2.1 Documentation</title>
<link href="qt.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class=header>
<a class=headerLink href="index.html">Main Page</a> ·
<a class=headerLink href="classoverview.html">Class Overview</a> ·
<a class=headerLink href="hierarchy.html">Hierarchy</a> ·
<a class=headerLink href="annotated.html">All Classes</a>
</div>
<!-- Generated by Doxygen 1.8.1.2 -->
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">QCustomPlot 1.2.1 Documentation </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><div class="image">
<img src="qcp-doc-logo.png" alt="qcp-doc-logo.png"/>
</div>
<p>Below is a brief overview of and guide to the classes and their relations. If you are new to <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> and just want to start using it, it's recommended to look at the tutorials and examples at</p>
<p><a href="http://www.qcustomplot.com/">http://www.qcustomplot.com/</a></p>
<p>This documentation is especially helpful as a reference, when you're familiar with the basic concept of how to use QCustomPlot and you wish to learn more about specific functionality. See the <a class="el" href="classoverview.html">class overview</a> for diagrams explaining the relationships between the most important classes of the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> library.</p>
<p>The central widget which displays the plottables and axes on its surface is <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>. Every <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> contains four axes by default. They can be accessed via the members <a class="el" href="classQCustomPlot.html#a9a79cd0158a4c7f30cbc702f0fd800e4">xAxis</a>, <a class="el" href="classQCustomPlot.html#af6fea5679725b152c14facd920b19367">yAxis</a>, <a class="el" href="classQCustomPlot.html#ada41599f22cad901c030f3dcbdd82fd9">xAxis2</a> and <a class="el" href="classQCustomPlot.html#af13fdc5bce7d0fabd640f13ba805c0b7">yAxis2</a>, and are of type <a class="el" href="classQCPAxis.html" title="Manages a single axis inside a QCustomPlot.">QCPAxis</a>. <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> supports an arbitrary number of axes and axis rects, see the documentation of <a class="el" href="classQCPAxisRect.html" title="Holds multiple axes and arranges them in a rectangular shape.">QCPAxisRect</a> for details.</p>
<h1><a class="anchor" id="mainpage-plottables"></a>
Plottables</h1>
<p><em>Plottables</em> are classes that display any kind of data inside the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>. They all derive from <a class="el" href="classQCPAbstractPlottable.html" title="The abstract base class for all data representing objects in a plot.">QCPAbstractPlottable</a>. For example, the <a class="el" href="classQCPGraph.html" title="A plottable representing a graph in a plot.">QCPGraph</a> class is a plottable that displays a graph inside the plot with different line styles, scatter styles, filling etc.</p>
<p>Since plotting graphs is such a dominant use case, <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> has a special interface for working with <a class="el" href="classQCPGraph.html" title="A plottable representing a graph in a plot.">QCPGraph</a> plottables, that makes it very easy to handle them:<br/>
You create a new graph with <a class="el" href="classQCustomPlot.html#a6fb2873d35a8a8089842d81a70a54167">QCustomPlot::addGraph</a> and access them with <a class="el" href="classQCustomPlot.html#a6d3ed93c2bf46ab7fa670d66be4cddaf">QCustomPlot::graph</a>.</p>
<p>For all other plottables, you need to use the normal plottable interface:<br/>
First, you create an instance of the plottable you want, e.g. </p>
<div class="fragment"><div class="line"><a class="code" href="classQCPCurve.html" title="A plottable representing a parametric curve in a plot.">QCPCurve</a> *newCurve = <span class="keyword">new</span> <a class="code" href="classQCPCurve.html" title="A plottable representing a parametric curve in a plot.">QCPCurve</a>(customPlot->xAxis, customPlot->yAxis);</div>
</div><!-- fragment --><p> add it to the customPlot: </p>
<div class="fragment"><div class="line">customPlot->addPlottable(newCurve);</div>
</div><!-- fragment --><p> and then modify the properties of the newly created plottable via the <code>newCurve</code> pointer.</p>
<p>Plottables (including graphs) can be retrieved via <a class="el" href="classQCustomPlot.html#a32de81ff53e263e785b83b52ecd99d6f">QCustomPlot::plottable</a>. Since the return type of that function is the abstract base class of all plottables, <a class="el" href="classQCPAbstractPlottable.html" title="The abstract base class for all data representing objects in a plot.">QCPAbstractPlottable</a>, you will probably want to qobject_cast the returned pointer to the respective plottable subclass. (As usual, if the cast returns zero, the plottable wasn't of that specific subclass.)</p>
<p>All further interfacing with plottables (e.g how to set data) is specific to the plottable type. See the documentations of the subclasses: <a class="el" href="classQCPGraph.html" title="A plottable representing a graph in a plot.">QCPGraph</a>, <a class="el" href="classQCPCurve.html" title="A plottable representing a parametric curve in a plot.">QCPCurve</a>, <a class="el" href="classQCPBars.html" title="A plottable representing a bar chart in a plot.">QCPBars</a>, <a class="el" href="classQCPStatisticalBox.html" title="A plottable representing a single statistical box in a plot.">QCPStatisticalBox</a>, <a class="el" href="classQCPColorMap.html" title="A plottable representing a two-dimensional color map in a plot.">QCPColorMap</a>.</p>
<h1><a class="anchor" id="mainpage-axes"></a>
Controlling the Axes</h1>
<p>As mentioned, <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> has four axes by default: <em>xAxis</em> (bottom), <em>yAxis</em> (left), <em>xAxis2</em> (top), <em>yAxis2</em> (right).</p>
<p>Their range is handled by the simple <a class="el" href="classQCPRange.html" title="Represents the range an axis is encompassing.">QCPRange</a> class. You can set the range with the <a class="el" href="classQCPAxis.html#aebdfea5d44c3a0ad2b4700cd4d25b641">QCPAxis::setRange</a> function. By default, the axes represent a linear scale. To set a logarithmic scale, set <a class="el" href="classQCPAxis.html#adef29cae617af4f519f6c40d1a866ca6">QCPAxis::setScaleType</a> to <a class="el" href="classQCPAxis.html#a36d8e8658dbaa179bf2aeb973db2d6f0abf5b785ad976618816dc6f79b73216d4">QCPAxis::stLogarithmic</a>. The logarithm base can be set freely with <a class="el" href="classQCPAxis.html#a726186054be90487885a748aa1b42188">QCPAxis::setScaleLogBase</a>.</p>
<p>By default, an axis automatically creates and labels ticks in a sensible manner. See the following functions for tick manipulation:<br/>
<a class="el" href="classQCPAxis.html#ac891409315bc379e3b1abdb162c1a011">QCPAxis::setTicks</a>, <a class="el" href="classQCPAxis.html#ae867c23d3a6a7bd4d09cc66c5d018f63">QCPAxis::setAutoTicks</a>, <a class="el" href="classQCPAxis.html#a7c7111cbeac9ec5fcb40f93a1ef51a0b">QCPAxis::setAutoTickCount</a>, <a class="el" href="classQCPAxis.html#a99fe77b034e06f5b723995beab96e741">QCPAxis::setAutoTickStep</a>, <a class="el" href="classQCPAxis.html#a04ba16e1f6f78d70f938519576ed32c8">QCPAxis::setTickLabels</a>, <a class="el" href="classQCPAxis.html#a54f24f5ce8feea25209388a863d7e448">QCPAxis::setTickLabelType</a>, <a class="el" href="classQCPAxis.html#a1bddd4413df8a576b7ad4b067fb33375">QCPAxis::setTickLabelRotation</a>, <a class="el" href="classQCPAxis.html#af727db0acc6492c4c774c0700e738205">QCPAxis::setTickStep</a>, <a class="el" href="classQCPAxis.html#a62ec40bebe3540e9c1479a8fd2be3b0d">QCPAxis::setTickLength</a>,...</p>
<p>Each axis can be given an axis label (e.g. "Voltage (mV)") with <a class="el" href="classQCPAxis.html#a33bcc382c111c9f31bb0687352a2dea4">QCPAxis::setLabel</a>.</p>
<p>The distance of an axis backbone to the respective viewport border is called its margin. Normally, the margins are calculated automatically. To change this, set <a class="el" href="classQCPLayoutElement.html#accfda49994e3e6d51ed14504abf9d27d">QCPAxisRect::setAutoMargins</a> to exclude the respective margin sides, set the margins manually with <a class="el" href="classQCPLayoutElement.html#a8f450b1f3f992ad576fce2c63d8b79cf">QCPAxisRect::setMargins</a>. The main axis rect can be reached with <a class="el" href="classQCustomPlot.html#a4a37a1add5fe63060ac518cf0a4c4050">QCustomPlot::axisRect()</a>.</p>
<h1><a class="anchor" id="mainpage-legend"></a>
Plot Legend</h1>
<p>Every <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> has one <a class="el" href="classQCPLegend.html" title="Manages a legend inside a QCustomPlot.">QCPLegend</a> (as <a class="el" href="classQCustomPlot.html#a4eadcd237dc6a09938b68b16877fa6af">QCustomPlot::legend</a>) by default. A legend is a small layout element inside the plot which lists the plottables with an icon of the plottable line/symbol and a name (<a class="el" href="classQCPAbstractPlottable.html#ab79c7ba76bc7fa89a4b3580e12149f1f">QCPAbstractPlottable::setName</a>). Plottables can be added and removed from the main legend via <a class="el" href="classQCPAbstractPlottable.html#a70f8cabfd808f7d5204b9f18c45c13f5">QCPAbstractPlottable::addToLegend</a> and <a class="el" href="classQCPAbstractPlottable.html#aa1f350e510326d012b9a9c9249736c83">QCPAbstractPlottable::removeFromLegend</a>. By default, adding a plottable to <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> automatically adds it to the legend, too. This behaviour can be modified with the <a class="el" href="classQCustomPlot.html#ad8858410c2db47b7104040a3aa61c3fc">QCustomPlot::setAutoAddPlottableToLegend</a> property.</p>
<p>The <a class="el" href="classQCPLegend.html" title="Manages a legend inside a QCustomPlot.">QCPLegend</a> provides an interface to access, add and remove legend items directly, too. See <a class="el" href="classQCPLegend.html#a454272d7094437beb3278a2294006da5">QCPLegend::item</a>, <a class="el" href="classQCPLegend.html#a5ee80cf83f65e3b6dd386942ee3cc1ee">QCPLegend::itemWithPlottable</a>, <a class="el" href="classQCPLegend.html#a3ab274de52d2951faea45a6d975e6b3f">QCPLegend::addItem</a>, <a class="el" href="classQCPLegend.html#ac91595c3eaa746fe6321d2eb952c63bb">QCPLegend::removeItem</a> for example.</p>
<p>Multiple legends are supported via the <a class="el" href="thelayoutsystem.html">layout system</a> (as a <a class="el" href="classQCPLegend.html" title="Manages a legend inside a QCustomPlot.">QCPLegend</a> simply is a normal layout element).</p>
<h1><a class="anchor" id="mainpage-userinteraction"></a>
User Interactions</h1>
<p><a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> supports dragging axis ranges with the mouse (<a class="el" href="classQCPAxisRect.html#ae6aef2f7211ba6097c925dcd26008418">QCPAxisRect::setRangeDrag</a>), zooming axis ranges with the mouse wheel (<a class="el" href="classQCPAxisRect.html#a7960a9d222f1c31d558b064b60f86a31">QCPAxisRect::setRangeZoom</a>) and a complete selection mechanism.</p>
<p>The availability of these interactions is controlled with <a class="el" href="classQCustomPlot.html#a5ee1e2f6ae27419deca53e75907c27e5">QCustomPlot::setInteractions</a>. For details about the interaction system, see the documentation there.</p>
<p>Further, <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> always emits corresponding signals, when objects are clicked or doubleClicked. See <a class="el" href="classQCustomPlot.html#a57e5efa8a854620e9bf62d31fc139f53">QCustomPlot::plottableClick</a>, <a class="el" href="classQCustomPlot.html#af2e6f1cea923dae437681d01ce7d0c31">QCustomPlot::plottableDoubleClick</a> and <a class="el" href="classQCustomPlot.html#abf635f8b56ab5c16d5de9f358543e82b">QCustomPlot::axisClick</a> for example.</p>
<h1><a class="anchor" id="mainpage-items"></a>
Items</h1>
<p>Apart from plottables there is another category of plot objects that are important: Items. The base class of all items is <a class="el" href="classQCPAbstractItem.html" title="The abstract base class for all items in a plot.">QCPAbstractItem</a>. An item sets itself apart from plottables in that it's not necessarily bound to any axes. This means it may also be positioned in absolute pixel coordinates or placed at a relative position on an axis rect. Further, it usually doesn't represent data directly, but acts as decoration, emphasis, description etc.</p>
<p>Multiple items can be arranged in a parent-child-hierarchy allowing for dynamical behaviour. For example, you could place the head of an arrow at a fixed plot coordinate, so it always points to some important area in the plot. The tail of the arrow can be anchored to a text item which always resides in the top center of the axis rect, independent of where the user drags the axis ranges. This way the arrow stretches and turns so it always points from the label to the specified plot coordinate, without any further code necessary.</p>
<p>For a more detailed introduction, see the <a class="el" href="classQCPAbstractItem.html" title="The abstract base class for all items in a plot.">QCPAbstractItem</a> documentation, and from there the documentations of the individual built-in items, to find out how to use them.</p>
<h1><a class="anchor" id="mainpage-layoutelements"></a>
Layout elements and layouts</h1>
<p><a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> uses an internal layout system to provide dynamic sizing and positioning of objects like the axis rect(s), legends and the plot title. They are all based on <a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> and are arranged by placing them inside a <a class="el" href="classQCPLayout.html">QCPLayout</a>.</p>
<p>Details on this topic are given on the dedicated page about <a class="el" href="thelayoutsystem.html">the layout system</a>.</p>
<h1><a class="anchor" id="mainpage-performancetweaks"></a>
Performance Tweaks</h1>
<p>Although <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> is quite fast, some features like translucent fills, antialiasing and thick lines can cause a significant slow down. If you notice this in your application, here are some thoughts on how to increase performance. By far the most time is spent in the drawing functions, specifically the drawing of graphs. For maximum performance, consider the following (most recommended/effective measures first):</p>
<ul>
<li>use Qt 4.8.0 and up. Performance has doubled or tripled with respect to Qt 4.7.4. However QPainter was broken and drawing pixel precise things, e.g. scatters, isn't possible with Qt >= 4.8.0. So it's a performance vs. plot quality tradeoff when switching to Qt 4.8. </li>
<li>To increase responsiveness during dragging, consider setting <a class="el" href="classQCustomPlot.html#a775bdcb6329d44701aeaa6135b0e5265">QCustomPlot::setNoAntialiasingOnDrag</a> to true. </li>
<li>On X11 (GNU/Linux), avoid the slow native drawing system, use raster by supplying "-graphicssystem raster" as command line argument or calling QApplication::setGraphicsSystem("raster") before creating the QApplication object. (Only available for Qt versions before 5.0) </li>
<li>On all operating systems, use OpenGL hardware acceleration by supplying "-graphicssystem
opengl" as command line argument or calling QApplication::setGraphicsSystem("opengl") (Only available for Qt versions before 5.0). If OpenGL is available, this will slightly decrease the quality of antialiasing, but extremely increase performance especially with alpha (semi-transparent) fills, much antialiasing and a large <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> drawing surface. Note however, that the maximum frame rate might be constrained by the vertical sync frequency of your monitor (VSync can be disabled in the graphics card driver configuration). So for simple plots (where the potential framerate is far above 60 frames per second), OpenGL acceleration might achieve numerically lower frame rates than the other graphics systems, because they are not capped at the VSync frequency. </li>
<li>Avoid any kind of alpha (transparency), especially in fills </li>
<li>Avoid lines with a pen width greater than one </li>
<li>Avoid any kind of antialiasing, especially in graph lines (see <a class="el" href="classQCustomPlot.html#ae10d685b5eabea2999fb8775ca173c24">QCustomPlot::setNotAntialiasedElements</a>) </li>
<li>Avoid repeatedly setting the complete data set with <a class="el" href="classQCPGraph.html#a1df2fd710545c8ba3b2c99a39a27bf8b">QCPGraph::setData</a>. Use <a class="el" href="classQCPGraph.html#aa5c6181d84db72ce4dbe9dc15a34ef4f">QCPGraph::addData</a> instead, if most data points stay unchanged, e.g. in a running measurement. </li>
<li>Set the <em>copy</em> parameter of the setData functions to false, so only pointers get transferred. (Relevant only if preparing data maps with a large number of points, i.e. over 10000)</li>
</ul>
<h1><a class="anchor" id="mainpage-flags"></a>
Preprocessor Define Flags</h1>
<p><a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> understands some preprocessor defines that are useful for debugging and compilation: </p>
<dl>
<dt><code>QCUSTOMPLOT_COMPILE_LIBRARY</code> </dt>
<dd>Define this flag when you compile <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> as a shared library (.so/.dll) </dd>
<dt><code>QCUSTOMPLOT_USE_LIBRARY</code> </dt>
<dd>Define this flag before including the header, when using <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> as a shared library </dd>
<dt><code>QCUSTOMPLOT_CHECK_DATA</code> </dt>
<dd>If this flag is defined, the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> plottables will perform data validity checks on every redraw. This means they will give qDebug output when you plot <em>inf</em> or <em>nan</em> values, they will not fix your data. </dd>
</dl>
</div></div><!-- contents -->
<div class="footer" />Generated with <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.1.2</div>
</body>
</html>
|