JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
Collaboration diagram for Performance Considerations when Setting up Plots:

Many of the function in JKQTPlotter case an immediate redraw of the widget. Examples are JKQTPlott::setX(), JKQTPlotter::setY(), JKQTPlotter::setAbsoluteX(), JKQTPlotter::setAbsoluteY(), JKQTPlotter::addGraph() ... so if you use a combination of these while setting up your plot, it is possible to cause several (rather expensive) redraws of the plot widget. Therefore you can disable this redrawing, using JKQTPlotter::setPlotUpdateEnabled() and you can explicitly cause a redraw with JKQTPlotter::redrawPlot(). To make this process even easier to use, there is a guard helper class for this: JKQTPlotterUpdateGuard.

Here is a code example:

{
JKQTPlotterUpdateGuard guard(plotter);
// set up plot here, e.g.
plotter->setX();
plotter->setY(); ...
} // Block ends and immediate plot updates are reenabled. Also JKQTPlotter::redrawPlot() is called.
Guard Class (RAII construct) for JKQTPlotter that disables replotting on construction and reenables i...
Definition jkqtplotter.h:1750

This code has the same effect as the long version without the guard class shown below:

const bool wasReplotEnabled=plotter->isPlotUpdateEnabled();
plotter->setPlotUpdateEnabled(false);
// set up plot here, e.g.
plotter->setX();
plotter->setY(); ...
// Setup ends and immediate plot updates are reenabled. Also JKQTPlotter::redrawPlot() is called.
plotter->setPlotUpdateEnabled(false);
if (wasReplotEnabled) plotter->redrawPlot();
See also
JKQTPlotter::setPlotUpdateEnabled(), JKQTPlotter::redrawPlot(), JKQTPlotterUpdateGuard