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

plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing) More...

#include <jkqtplotter.h>

Inheritance diagram for JKQTPlotter:
[legend]
Collaboration diagram for JKQTPlotter:
[legend]

Classes

struct  MouseDragAction
 ties a MouseActionMode to a mouse-button and a keyboard-modifier More...
 
struct  MouseDragMarker
 describes a marker to be drawn by paintUserAction() More...
 

Public Slots

void copyData ()
 copy the data used for the current plot to the clipboard
 
void copyDataMatlab ()
 copy the data used for the current plot to the clipboard as a Matlab script
 
void openContextMenu ()
 open the context menu at the mouse position of the last click
 
void openContextMenu (int x, int y)
 open the context menu at the mouse position x and y
 
void openSpecialContextMenu ()
 open the special context menu at the mouse position of the last click
 
void openSpecialContextMenu (int x, int y)
 open the special context menu at the mouse position x and y
 
void openStandardAndSpecialContextMenu ()
 open the standard context menu with the special context menu integrated at the mouse position of the last click
 
void openStandardAndSpecialContextMenu (int x, int y)
 open the standard context menu with the special context menu integrated at the mouse position x and y
 
void openStandardContextMenu ()
 open the standard context menu at the mouse position of the last click
 
void openStandardContextMenu (int x, int y)
 open the standard context menu at the mouse position x and y
 
void populateToolbar (QToolBar *toolbar) const
 popuplate the given toolbar toolbar with all actions shown in a toolbar from this class ...
 
void print (QPrinter *printer=nullptr)
 print the current plot, if printer is nullptr a printer selection dialog is displayed
 
void redrawPlot ()
 update the plot and the overlays
 
void saveAsCSV (const QString &filename=QString(""))
 save the current plot data as a Comma Separated Values (CSV) file
 
void saveAsDIF (const QString &filename=QString(""))
 save the current plot data as a Data Interchange Format file (see https://en.wikipedia.org/wiki/Data_Interchange_Format).
 
void saveAsGerExcelCSV (const QString &filename=QString(""))
 save the current plot data as a Semicolon Separated Values (CSV) file for german Excel, i.e. with comma as decimal separator
 
void saveAsMatlab (const QString &filename=QString(""))
 save the current plot data as a Matlab Script
 
bool saveAsPDF (const QString &filename=QString(""), bool displayPreview=true)
 save the current plot as a PDF file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed
 
bool saveAsPixelImage (const QString &filename=QString(""), bool displayPreview=true, const QByteArray &outputFormat=QByteArray(), const QSize &outputSizeIncrease=QSize(0, 0))
 save the current plot as a pixel image image (PNG ...), if filename is empty a file selection dialog is displayed
 
void saveAsSemicolonSV (const QString &filename=QString(""))
 save the current plot data as a Semicolon Separated Values (SSV) file
 
bool saveAsSVG (const QString &filename=QString(""), bool displayPreview=true)
 save the current plot as a SVG file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed
 
void saveAsSYLK (const QString &filename=QString(""))
 save the current plot data as a SYmbolik LinK (SYLK) spreadsheet file (see https://en.wikipedia.org/wiki/Symbolic_Link_(SYLK) )
 
void saveAsTabSV (const QString &filename=QString(""))
 save the current plot data as a Tabulator Separated Values (CSV) file
 
void saveData (const QString &filename=QString(""), const QString &format=QString(""))
 save the data used for the current plot. The file format is extracted from the file extension (csv, ...)
 
bool saveImage (const QString &filename=QString(""), bool displayPreview=true)
 save the current plot as an image file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed. The image format is extracted from the file extension (jpeg, tiff, png, pdf, ...)
 
void setAbsoluteX (double xminn, double xmaxx)
 sets absolutely limiting x-range of the plot

 
void setAbsoluteXY (double xminn, double xmaxx, double yminn, double ymaxx)
 sets absolutely limiting x- and y-range of the plot

 
void setAbsoluteY (double yminn, double ymaxx)
 sets absolute minimum and maximum y-value to plot

 
void setContextMenuMode (JKQTPContextMenuModes mode)
 sets the mode if the standard context menu
 
void setGrid (bool val)
 sets whether the major grid lines of the major axes are shown

 
void setGridColor (QColor color)
 sets the color of all major grid lines (of the major x- and y-axis)

 
void setGridStyle (Qt::PenStyle __value)
 sets the style of all Major grid lines
 
void setGridWidth (double __value)
 sets the width of all Major grid lines
 
void setMagnification (double m)
 set the current plot magnification
 
void setMaxTooltipDistance (int v)
 maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed

 
void setMinorGridColor (QColor color)
 sets the color of all minor grid lines
 
void setMinorGridStyle (Qt::PenStyle __value)
 sets the style of all minor grid lines
 
void setMinorGridWidth (double __value)
 sets the width of all minor grid lines
 
void setMouseActionToolbarActionsActive (bool __value)
 allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions
 
void setMousePositionShown (bool __value)
 specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the top border, so the position fits in. The default widget font is used for the output.
 
void setShowZeroAxes (bool showX, bool showY)
 switches the visibility of the zero-axes associated with the x- and y-axis
 
void setShowZeroAxes (bool showXY)
 switches the visibility of the zero-axes associated with the major x- and y-axis
 
void setToolbarAlwaysOn (bool __value)
 returns whether the toolbar is always visible or only when the mouse moves to the upper left area
 
void setToolbarEnabled (bool __value)
 returns whether the toolbar is enabled
 
void setUserActionCatchSensitivity (int v)
 sensitivity (i.e. max. distance to see as one point) for user actions

 
void setUserActionMarkerBrush (const QBrush &__value)
 pen for location markers of user actions on the plot
 
void setUserActionMarkerDiameter (int v)
 size (diameter) of markers drawn by user actions

 
void setUserActionMarkerPen (const QPen &__value)
 pen for location markers of user actions on the plot
 
void setUserActionMarkerType (JKQTPUserActionMarkerType v)
 type of the location markers of user actions on the plot

 
void setUserActionOpaqueBrush (const QBrush &__value)
 pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
 
void setUserActionOpaquePen (const QPen &__value)
 pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
 
void setUserActionOverlayBrush (const QBrush &__value)
 pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
 
void setUserActionOverlayPen (const QPen &__value)
 pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
 
void setX (double xminn, double xmaxx)
 sets the x-range of the plot (minimum and maximum x-value on the x-axis)

 
void setXY (double xminn, double xmaxx, double yminn, double ymaxx, bool affectsSecondaryAxes=false)
 sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)

 
void setY (double yminn, double ymaxx)
 sets the y-range of the plot (minimum and maximum y-value on the y-axis)

 
void synchronizeXAxis (double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
 may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the other x-axis
 
void synchronizeXYAxis (double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
 may be connected to zoomChangedLocally() of a different plot and synchronizes the local x- and y-axis to the other x- and y-axis
 
void synchronizeYAxis (double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
 may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the other y-axis
 
void zoom (double xminn, double xmaxn, double yminn, double ymaxn, bool affectsSecondaryAxes=false)
 sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)

 
void zoomIn (double factor=2.0)
 zooms into the graph (the same as turning the mouse wheel) by the given factor
 
void zoomOut (double factor=2.0)
 zooms out of the graph (the same as turning the mouse wheel) by the given factor
 
void zoomToFit (bool zoomX=true, bool zoomY=true, bool includeX0=false, bool includeY0=false, double scaleX=1.05, double scaleY=1.05)
 this method zooms the graph so that all plotted datapoints are visible.
 

Signals

void beforePlotScalingRecalculate ()
 emitted before the plot scaling has been recalculated
 
void contextMenuOpened (double x, double y, QMenu *contextMenu)
 emitted whenever a context menu is opened. You can modify the menu via the parameter contextMenu!
 
void plotMouseClicked (double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button)
 emitted when a single-click event from the mouse occurs inside the plot
 
void plotMouseDoubleClicked (double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button)
 emitted when a double-click event from the mouse occurs inside the plot
 
void plotMouseMove (double x, double y)
 emitted whenever the mouse moves
 
void plotMouseWheelOperated (double x, double y, Qt::KeyboardModifiers modifiers, int deltaAngleX, int deltaAngleY)
 emitted when a single-click event from the mouse occurs inside the plot
 
void plotNewZoomRectangle (double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd, Qt::KeyboardModifiers modifiers)
 emitted when the mouse action jkqtpmdaZoomByRectangle and the drawing of the new zoom rectangle is finished (=mouse key released)
 
void plotScalingRecalculated ()
 emitted when the plot scaling has been recalculated
 
void rulerDisplayed (double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers)
 emitted when a new ruler between two points is displayed
 
void tooltipDisplayed (double x, double y, const QStringList &entries, const QList< JKQTPPlotElement * > &graphs)
 emitted when a tooltip for a datapoint is displayed
 
void userCircleFinished (double x, double y, double radius, Qt::KeyboardModifiers modifiers)
 emitted when the mouse action JKQTPlotter::CircleEvents and the drawing of the new circle is finished (=mouse key released)
 
void userEllipseFinished (double x, double y, double radiusX, double radiusY, Qt::KeyboardModifiers modifiers)
 emitted when the mouse action JKQTPlotter::EllipseEvents and the drawing of the new ellipse is finished (=mouse key released)
 
void userLineFinished (double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers)
 emitted when the mouse action JKQTPlotter::LineEvents and the drawing of the new line is finished (=mouse key released)
 
void userRectangleFinished (double x, double y, double width, double height, Qt::KeyboardModifiers modifiers)
 emitted when the mouse action JKQTPlotter::RectangleEvents and the drawing of the new rectangle is finished (=mouse key released)
 
void userScribbleClick (double x, double y, Qt::KeyboardModifiers modifiers, bool first, bool last)
 emitted when the mouse action JKQTPlotter::ScribbleEvents and a click event from the mouse occurs inside the plot, or the mouse moved while the left button is pressed down
 
void widgetResized (int new_width, int new_height, JKQTPlotter *sender)
 signal: emitted whenever the widget is resized
 
void zoomChangedLocally (double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
 signal: emitted whenever the user selects a new x-y zoom range (by mouse)
 

Public Member Functions

 JKQTPlotter (bool datastore_internal, QWidget *parent=nullptr, JKQTPDatastore *datast=nullptr)
 class constructor
 
 JKQTPlotter (JKQTPDatastore *datast, QWidget *parent=nullptr)
 class constructor for a JKQTPlotter using an external JKQTPDatastore dataset
 
 JKQTPlotter (QWidget *parent=nullptr)
 class constructor
 
virtual ~JKQTPlotter ()
 class destructor
 
void addGraph (JKQTPPlotElement *gr)
 

 
void addGraphAtBottom (JKQTPPlotElement *gr)
 add a new graph before all other graphs (i.e. at the top of the list of graphs), if the graph is already in the plot, it is moved to the top

 
void addGraphOnTop (JKQTPPlotElement *gr)
 add a new graph at the end of the graphs, if the graph is already in the plot, it is moved to the end of the list

 
template<class TJKQTPGraphContainer >
void addGraphs (const TJKQTPGraphContainer &gr, QVector< size_t > *graphIDsOut=nullptr)
 add a new graphs from a QVector<JKQTPPlotElement*>, QList<JKQTPPlotElement*>, std::vector<JKQTPPlotElement*> ... or any standard-iterateable container with JKQTPPlotElement*-items

 
void addGridPrintingPlotter (size_t x, size_t y, JKQTPlotter *plotterOther)
 add a new plotter plotterOther for grid printing mode, at location x / y
 
JKQTBasePlotter::GraphsIterator beginGraphs ()
 returns an iterator to the first graph
 
JKQTBasePlotter::GraphsConstIterator beginGraphs () const
 returns an iterator to the first graph
 
JKQTBasePlotter::GraphsConstIterator cbeginGraphs () const
 returns an iterator to the first graph
 
JKQTBasePlotter::GraphsConstIterator cendGraphs () const
 returns an iterator behind the last graph
 
void clearAllMouseMoveActions ()
 deletes all mouse-move actions
 
void clearAllMouseWheelActions ()
 deletes all mouse-wheel actions
 
void clearAllRegisteredMouseDoubleClickActions ()
 clear all registered mouse double-click actions
 
void clearAllRegisteredMouseDragActions ()
 clear all registeres mouse drag actions
 
void clearGraphs (bool deleteGraphs=true)
 remove all plots

 
void clearGridPrintingPlotters ()
 clear all additional plotters for grid printing mode
 
bool containsGraph (JKQTPPlotElement *gr)
 returns true, if the given graph is in this plot

 
void copyPixelImage (bool showPreview=true)
 copy the current plot as a pixel+svg image to the clipboard

 
void deleteGraph (JKQTPPlotElement *gr, bool deletegraph=true)
 remove the i-th graph

 
void deleteGraph (size_t i, bool deletegraph=true)
 remove the i-th graph

 
void deregisterMouseDoubleClickAction (Qt::MouseButton button, Qt::KeyboardModifiers modifier)
 deregisteres the mouse action action to be executed when a mouse double-click occurs with the given button and modifier
 
void deregisterMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifier)
 deregisteres the mouse drag action to be executed when a mouse drag operation is initialized with the given button and modifier
 
void deregisterMouseMoveAction (Qt::KeyboardModifiers modifier)
 deletes all mouse-move actions registered for a given modifier
 
void deregisterMouseWheelAction (Qt::KeyboardModifiers modifier)
 deletes all mouse-wheel actions registered for a given modifier
 
JKQTBasePlotter::GraphsIterator endGraphs ()
 returns an iterator behind the last graph
 
JKQTBasePlotter::GraphsConstIterator endGraphs () const
 returns an iterator behind the last graph
 
void forceInternalDatastore ()
 tells the plotter object to use an internal datastore (just like useInternalDatastore() ), but forces the generation of a new datastore, even if the current one is already internal (the current one will be freed in the lather case
 
double getAbsoluteXMax () const
 returns the absolute x-axis max of the primary x-axis This is the highest allowed value the the axis min/max.

 
double getAbsoluteXMin () const
 returns the absolute x-axis min of the primary x-axis. This is the lowest allowed value the the axis min/max.

 
double getAbsoluteYMax () const
 returns the absolute y-axis max of the primary y-axis This is the highest allowed value the the axis min/max.

 
double getAbsoluteYMin () const
 returns the absolute y-axis min of the primary y-axis This is the lowest allowed value the the axis min/max.

 
QAction * getActMouseLeftAsDefault ()
 action that activates the default action, set in plotterStyle!
 
const QAction * getActMouseLeftAsDefault () const
 action that activates the default action, set in plotterStyle!
 
QAction * getActMouseLeftAsPanView ()
 action that activates the pan view tool (override!)

 
const QAction * getActMouseLeftAsPanView () const
 action that activates the pan view tool (override!)

 
QAction * getActMouseLeftAsRuler ()
 action that activates the ruler tool (override!)
 
const QAction * getActMouseLeftAsRuler () const
 action that activates the ruler tool (override!)
 
QAction * getActMouseLeftAsZoomRect ()
 action that activates the zoom rectangle tool (override!)
 
const QAction * getActMouseLeftAsZoomRect () const
 action that activates the zoom rectangle tool (override!)
 
QAction * getActMouseMoveToolTip ()
 action that activates the tooltip tool (override!)

 
const QAction * getActMouseMoveToolTip () const
 action that activates the tooltip tool (override!)

 
const JKQTBasePlottergetConstplotter () const
 returns the JKQTBasePlotter object internally used for plotting
 
JKQTPContextMenuModes getContextMenuMode () const
 returns the currently set mode for the context menu
 
const JKQTPlotterStylegetCurrentPlotterStyle () const
 current style properties for this JKQTPlotter
 
JKQTPDatastoregetDatastore ()
 returns a pointer to the datastore used by this object

 
const JKQTPDatastoregetDatastore () const
 returns a pointer to the datastore used by this object

 
JKQTPPlotElementgetGraph (size_t i)
 returns description of i'th graph

 
const JKQTPPlotElementgetGraph (size_t i) const
 returns description of i'th graph

 
size_t getGraphCount ()
 returns the number of graphs

 
JKQTBasePlotter::GraphsListgetGraphs ()
 returns a list of all graphs

 
const JKQTBasePlotter::GraphsListgetGraphs () const
 returns a list of all graphs

 
double getMagnification () const
 returns the current magnification factor
 
JKQTPBaseKeygetMainKey ()
 retuns the main key object

 
const JKQTPBaseKeygetMainKey () const
 retuns the main key object

 
int getMaxTooltipDistance () const
 maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed

 
double getMouseContextX () const
 x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
 
double getMouseContextY () const
 y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
 
int getMouseLastClickX () const
 x-position of the last mouse-click (in screen pixels)
 
int getMouseLastClickY () const
 y-position of the last mouse-click (in screen pixels)
 
int getNextStyle ()
 gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles

 
JKQTBasePlotter::JKQTPPen getPlotStyle (int i) const
 returns a QPen object for the i-th plot style

 
JKQTBasePlottergetPlotter ()
 returns the JKQTBasePlotter object internally used for plotting
 
const JKQTBasePlottergetPlotter () const
 returns the JKQTBasePlotter object internally used for plotting
 
QMenu * getSpecialContextMenu () const
 returns the currently set special context menu object
 
int getToolbarIconSize () const
 get the width/height of the icons in the toolbar in pt
 
int getUserActionCatchSensitivity () const
 sensitivity (i.e. max. distance to see as one point) for user actions

 
QBrush getUserActionMarkerBrush () const
 brush for location markers of user actions on the plot
 
int getUserActionMarkerDiameter () const
 size (diameter) of markers drawn by user actions

 
QPen getUserActionMarkerPen () const
 pen for location markers of user actions on the plot
 
JKQTPUserActionMarkerType getUserActionMarkerType () const
 type of the location markers of user actions on the plot

 
QBrush getUserActionOpaqueBrush () const
 brush for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
 
QPen getUserActionOpaquePen () const
 pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
 
QBrush getUserActionOverlayBrush () const
 brush for user actions (typically semi-transparent, like e.g. zoom-rectangles)
 
QPen getUserActionOverlayPen () const
 pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
 
JKQTPHorizontalAxisBasegetXAxis (JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis)
 returns the x-axis objet of the plot

 
const JKQTPHorizontalAxisBasegetXAxis (JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) const
 returns the x-axis objet of the plot

 
double getXMax () const
 returns the current x-axis max of the primary x-axis

 
double getXMin () const
 returns the current x-axis min of the primary x-axis

 
JKQTPVerticalAxisBasegetYAxis (JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis)
 returns the y-axis objet of the plot

 
const JKQTPVerticalAxisBasegetYAxis (JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) const
 returns the y-axis objet of the plot

 
double getYMax () const
 returns the current y-axis max of the primary y-axis

 
double getYMin () const
 returns the current y-axis min of the primary y-axis

 
QImage grabPixelImage (QSize size=QSize(), bool showPreview=false)
 returns a rendering of the current plot as a QImage (pixel image) with the given size

 
bool isEmittingSignalsEnabled () const
 returns whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate()
 
bool isMousePositionShown () const
 specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the top border, so the position fits in. The default widget font is used for the output.
 
bool isPlotUpdateEnabled () const
 returns, whether automatic redrawing the plot is currently activated (e.g. you can deactivate this with setPlotUpdateEnabled() while performing major updates on the plot)
 
bool isResizeTimerRunning () const
 returns true, if the JKQTPlotter::resizeTimer is currently running and the widget is waiting for the resize-event to finish
 
bool isToolbarAlwaysOn () const
 returns whether the toolbar is always visible or only when the mouse moves to the upper left area
 
bool isToolbarEnabled () const
 returns whether the toolbar is enabled
 
void loadCurrentPlotterStyle (const QSettings &settings, const QString &group="plots/", bool alsoLoadBaseStyle=true)
 replace the current style properties for this JKQTBasePlotter with properties loaded from settings
 
void loadSettings (const QSettings &settings, const QString &group=QString("plots/"))
 loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object
 
QSize minimumSizeHint () const override
 returns the minimum size of the widget
 
void modifyGraphs (const std::function< void(JKQTPPlotElement *)> &func)
 apply functor func to all graphs in the plotter. After completing the operation, the graph is updated
 
void moveGraphBottom (int idx)
 move the given graph gr to the bottom of all graphs

 
void moveGraphBottom (JKQTPPlotElement *gr)
 move the given graph gr to the bottom of all graphs

 
void moveGraphDown (int idx)
 move the given graph gr one item down (i.e. it is drawn earlier/lower in the z-stack)

 
void moveGraphDown (JKQTPPlotElement *gr)
 move the given graph gr one item down (i.e. it is drawn earlier/lower in the z-stack)

 
void moveGraphTop (int idx)
 move the given graph gr to the end of all graphs, so it is drawn


 
void moveGraphTop (JKQTPPlotElement *gr)
 move the given graph gr to the end of all graphs, so it is drawn


 
void moveGraphUp (int idx)
 move the given graph gr one item up (i.e. it is drawn later/higher in the z-stack)

 
void moveGraphUp (JKQTPPlotElement *gr)
 move the given graph gr one item up (i.e. it is drawn later/higher in the z-stack)

 
void registerMouseDoubleClickAction (Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDoubleClickActions action)
 registeres a certain mouse action action to be executed when a mouse double-click occurs with the given button and modifier
 
void registerMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDragActions action)
 registeres a certain mouse drag action action to be executed when a mouse drag operation is initialized with the given button and modifier
 
void registerMouseMoveAction (Qt::KeyboardModifiers modifier, JKQTPMouseMoveActions action)
 specifies the action to perform on a mouse move event when a given modifier is pressed
 
void registerMouseWheelAction (Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action)
 specifies the action to perform on a mouse wheel event when a given modifier is pressed
 
void resetMasterSynchronization (JKQTBasePlotter::SynchronizationDirection synchronizeDirection=JKQTBasePlotter::sdXYAxes)
 switches any synchronization off, that has been created by synchronizeToMaster()
 
void saveCurrentPlotterStyle (QSettings &settings, const QString &group="plots/", bool alsoSaveBaseStyle=true) const
 store the current style properties for this JKQTBasePlotter with properties loaded from settings
 
void saveSettings (QSettings &settings, const QString &group=QString("plots/")) const
 saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object.
 
void setCurrentPlotterStyle (const JKQTPlotterStyle &style)
 replace the current style properties for this JKQTBasePlotter
 
void setCurrentPlotterStyle (const JKQTPlotterStyle &style, const JKQTBasePlotterStyle &baseStyle)
 replace the current style properties for this JKQTBasePlotter
 
void setEmittingSignalsEnabled (bool sig)
 specifies whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate()
 
void setGridPrinting (bool enabled)
 enables grid-printing for this plot
 
void setGridPrintingCurrentPos (size_t x, size_t y)
 set the x- and y-positions of this JKQTPlotter in the grid-printing grid
 
void setGridPrintingCurrentX (size_t x)
 set the x-position of this JKQTPlotter in the grid-printing grid
 
void setGridPrintingCurrentY (size_t y)
 set the y-position of this JKQTPlotter in the grid-printing grid
 
void setPlotUpdateEnabled (bool enable)
 sets whether automatic redrawing the plot is currently activated (e.g. you can sett his to false while performing major updates on the plot)
 
void setSpecialContextMenu (QMenu *menu)
 sets a QMenu object to be used as special context menu
 
void setToolbarIconSize (int value)
 set the width/height of the icons in the toolbar in pt
 
QSize sizeHint () const override
 returns the size of the widget
 
void sortGraphs (const std::function< bool(const JKQTPPlotElement *, const JKQTPPlotElement *)> &compareLess)
 sort the graphs, using functor compareLess to find whether a first graph shall be before (i.e. less) than a second graph. After completing the operation, the graph is updated
 
void synchronizeToMaster (JKQTPlotter *master, JKQTBasePlotter::SynchronizationDirection synchronizeDirection, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true)
 synchronize the plot borders (and zooming) with a given plotter (master --> slave/this)
 
void synchronizeXToMaster (JKQTPlotter *master, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true)
 synchronize the plot x-axis width (and x-zooming) with a given master plotter (master --> slave/this)
 
void synchronizeYToMaster (JKQTPlotter *master, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true)
 synchronize the plot y-axis height (and y-zooming) with a given master plotter (master --> slave/this)
 
void updateToolbarActions ()
 
void useAsInternalDatastore (JKQTPDatastore *newStore)
 tells the plotter object to use the given external datastore and treat it as an internal one (i.e. free it when the plotter object ist destroyed.
 
void useExternalDatastore (JKQTPDatastore *newStore)
 tells the plotter object to use the given external datastore.

 
void useInternalDatastore ()
 tells the plotter object to use an internal datastore. A new internal datastore object is generated only if the current datastore is not internal.
 

Static Public Member Functions

static int getGlobalResizeDelay ()
 returns the currently set global resize delay in milliseconds delayMS. This function is thread-safe!
 
static void setGlobalResizeDelay (int delayMS)
 sets the global resize delay in milliseconds delayMS. After calling this function all plots will use the new delay. Setting the the delay to 0 disables the delayed resize feature. This function is thread-safe!
 

Protected Types

typedef QPixmap InternalBufferImageType
 
enum class  WheelActionType {
  Zoom ,
  Pan ,
  None
}
 

Protected Slots

void delayedResizeEvent ()
 while the window is resized, the plot is only redrawn after a restartable delay, implemented by this function and resizeTimer
 
void intBeforePlotScalingRecalculate ()
 emitted before the plot scaling has been recalculated
 
void masterPlotScalingRecalculated ()
 connected to plotScalingRecalculated() of the masterPlotter
 
void pzoomChangedLocally (double newxmin, double newxmax, double newymin, double newymax, JKQTBasePlotter *sender)
 called whenever the zoom changes in plotter
 
void reactGraphVisible (bool visible)
 called from a menu entry that encodes the graph ID
 
void resetMouseLeftAction ()
 resets any previously set override action for the left mouse-button, un-modified
 
void setMouseLeftActionAsPanView ()
 action that activates the pan viewport tool
 
void setMouseLeftActionAsRuler ()
 action that activates the ruler tool
 
void setMouseLeftActionAsZoomRect ()
 action that activates the zoom rectangle tool
 
void setMouseLeftDragActionAsToolTip ()
 action that activates the tooltip tool, when dragging the mouse with the left button pressed
 
void setMouseMoveActionAsToolTip (bool enabled)
 action that (de)activates the tooltip tool, when moving the mouse without any button pressed
 

Protected Member Functions

void correctZoomRectForPanning (QRectF &rect) const
 tool function, which corrects the given rectangle (in pixels!) during a panning action. The correction is necesary towards getAbsoluteXY() to prevent an unwanted zooming in.
 
InternalBufferImageType createImageBuffer () const
 constructs a new image for the internal double-buffering
 
virtual bool event (QEvent *event) override
 
void fillInternalStructForToolTipOfClosestDataPoint (double x0, double y0, bool emitEvent=true)
 fills the inertnal mouseDragMarkers structure with data to display tooltips close to (x0, y0)
 
JKQTPMouseDoubleClickActionsHashMapIterator findMatchingMouseDoubleClickAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
 searches JKQTPlotterStyle::registeredMouseDoubleClickActions for a matching action
 
JKQTPMouseDragActionsHashMapIterator findMatchingMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
 searches JKQTPlotterStyle::registeredMouseActionModes for a matching action, returns in found whether an action was found
 
JKQTPMouseMoveActionsHashMapIterator findMatchingMouseMoveAction (Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
 searches JKQTPlotterStyle::registeredMouseMoveActions for a matching action
 
JKQTPMouseWheelActionsHashMapIterator findMatchingMouseWheelAction (Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
 searches JKQTPlotterStyle::registeredMouseWheelActions for a matching action
 
void fixBasePlotterSettings ()
 modifies the settings of plotter to match those of this object
 
QSize getImageBufferSize (float *scale_out=nullptr) const
 returns the required size of an image for the internal double-buffering
 
int getPlotYOffset () const
 calculate the y-axis shift of the plot, so there is space for the potentially displayed mouse position label
 
void initContextMenu ()
 fills the member contextMenu with all default and additionally registered actions, also calls modifyContextMenu()
 
void keyReleaseEvent (QKeyEvent *event) override
 react on key presses.
 
void leaveEvent (QEvent *event) override
 called, when the mouse leaves the widget, hides the toolbar (if visible)
 
void modifyContextMenu (QMenu *menu)
 you may overwrite this method to modify the given context menu before it is displayed.
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 event handler for a double click
 
void mouseMoveEvent (QMouseEvent *event) override
 event handler for a mouse move
 
void mousePressEvent (QMouseEvent *event) override
 event handler for a mouse down event
 
void mouseReleaseEvent (QMouseEvent *event) override
 event handler for a mouse release event
 
void paintEvent (QPaintEvent *event) override
 this simply paints the stored image to the widget's surface
 
void paintUserAction ()
 paint the user action (rectangle, ellipse, ...
 
void resetContextMenu (bool createnew=true)
 destroys the internal contextMenu and optionally creates a new one
 
void resetCurrentMouseDragAction ()
 resets the currently activated mouse drag action, e.g. called by mouseReleaseEvent()
 
void resetOverrideMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
 removes a previously set override mouse drag action for the given button/modifiers combination
 
void resizeEvent (QResizeEvent *event) override
 resizes the internal representation (image) of the graphs
 
void setOverrideMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers, JKQTPMouseDragActions action)
 sets an override mouse drag action for the given button/modifiers combination
 
void updateCursor ()
 set the current mouse cursor shappe according to currentMouseDragAction
 
void updateToolbar ()
 update settings of the toolbar
 
void wheelEvent (QWheelEvent *event) override
 event handler for a turn of the mouse wheel
 

Protected Attributes

QActionGroup * actgrpMouseLeft
 action group, that groups the actMouseLeft... actions
 
QAction * actMouseLeftAsDefault
 action that activates the default action, set in plotterStyle!
 
QAction * actMouseLeftAsPanView
 action that activates the pan view tool (override!)

 
QAction * actMouseLeftAsRuler
 action that activates the ruler tool (override!)
 
QAction * actMouseLeftAsZoomRect
 action that activates the zoom rectangle tool (override!)
 
QAction * actMouseMoveToolTip
 action that activates the tooltip tool (override!)

 
QMenu * contextMenu
 the context menu object used by this JKQTPlotter
 
JKQTPContextMenuModes contextMenuMode
 current mode for the default context menu (i.e. the right-click context menu)
 
QList< QMenu * > contextSubMenus
 internal storage for sub-menu entries of the internal contextMenu object, based on the actions returned by JKQTBasePlotter::getLstAdditionalPlotterActions()
 
MouseDragAction currentMouseDragAction
 the currently executed MouseDragAction
 
QSet< JKQTPMouseMoveActionscurrentMouseMoveAction
 the currently executed MouseMoveActions
 
bool doDrawing
 indicates whether the plot is updated automatically at the moment
 
InternalBufferImageType image
 this stores the currently displayed plot
 
quint64 lastWheelActionTimestamp
 storage for timestammp of the last QWheelEvent (used in wheelAction() to distinguish trackpad-pan ations in mode jkqtpmwaZoomByWheelAndTrackpadPan)
 
WheelActionType lastWheelActionType
 storage for last WheelActionType (used in wheelAction() to distinguish trackpad-pan ations in mode jkqtpmwaZoomByWheelAndTrackpadPan)
 
double magnification
 magnification factor for the display of the plot
 
QPointer< JKQTPlottermasterPlotterX
 the master plotter, this plotter is connected to in x-direction.
 
QPointer< JKQTPlottermasterPlotterY
 the master plotter, this plotter is connected to in y-direction.
 
const quint64 maxWheelEventSeriesTimestampDifference
 max. time between two QWheelEvents that are recognized as one series
 
QMenu * menuSpecialContextMenu
 use this QMenu instance instead of the standard context menu of this widget
 
QSize minSize
 current minimal size of the JKQTPlotter widget to properly display the plot
 
double mouseContextX
 x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
 
double mouseContextY
 y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
 
bool mouseDragingRectangle
 this is set true if we are drawing a zoom rectangle
 
QList< MouseDragMarkermouseDragMarkers
 internal list of markers to be drawn by paintUserAction()
 
double mouseDragRectXEnd
 when draging the mouse this contains the x-coordinate the mouse is currently pointing to
 
int mouseDragRectXEndPixel
 when draging the mouse this contains the x-coordinate the mouse is currently pointing to (in pixels)
 
double mouseDragRectXStart
 when draging the mouse this contains the x-coordinate the user clicked on (in plot coordinates)
 
int mouseDragRectXStartPixel
 when draging the mouse this contains the x-coordinate the user clicked on (in pixels)
 
double mouseDragRectYEnd
 when zooming by moving the mouse this contains the y-coordinate the mouse is currently pointing to
 
int mouseDragRectYEndPixel
 when draging the mouse this contains the y-coordinate the mouse is currently pointing to (in pixels)
 
double mouseDragRectYStart
 when draging the mouse this contains the y-coordinate the user clicked on (in plot coordinates)
 
int mouseDragRectYStartPixel
 when zooming by moving the mouse this contains the y-coordinate the user clicked on (in pixels)
 
int mouseLastClickX
 x-position of the last mouse-click (in screen pixels)
 
int mouseLastClickY
 y-position of the last mouse-click (in screen pixels)
 
double mousePosX
 x-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates)
 
double mousePosY
 y-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates)
 
InternalBufferImageType oldImage
 this can be used when drawing a zoom rectangle to store an unchanged copy of the currently displayed image.
 
JKQTBasePlotterplotter
 JKQTBasePlotter used to plot.
 
JKQTPlotterStyle plotterStyle
 current style properties for this JKQTPlotter
 
JKQTPMouseDragActionsHashMap registeredOverrideMouseDragActionModes
 list of override mouse drag action modes, that override the settings ing plotterStyle.registeredMouseDragActionModes
 
QTimer resizeTimer
 timer used while the graph is resized to delay the redrawing with new size (in the meantime, an intermediate graphic is displayed)
 
JKVanishQToolBartoolbar
 toolbar class used for user input
 

Static Protected Attributes

static std::atomic< int > jkqtp_RESIZE_DELAY
 delay for resizing in milliseconds. If set to 0, resize delay is disabled and resizeTimer is unused.
 

Detailed Description

plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)

This class is a QWidget-wrapper around JKQTBasePlotter. It uses the tools from JKQTBasePlotter to display scientific plots. This class mostly adds the Widget for the output and adds different types of user interactions.

Please have a look at the documentation of JKQTBasePlotter for details on the management of graphs and the formating/styling of the plot and graphs!

The rest of this documentation ins split into sections that each treat a special topic, as outlines below:

Basic Usage of JKQTPlotter

JKQTPlotter is a plotter widget which wraps around a JKQTBasePlotter instanced that does the actual drawing. A basic usage of JKQTPlotter looks like this:

// create a new JKQTPlotter instance
JKQTPlotter* plot = new JKQTPlotter(parentWidget);
// fill two vectors with dtaa for a graph:
QVector<double> X, Y;
fillDataVectors(X, Y);
// make data available to the internal datastore of the plotter:
size_t columnX=plot->getDatastore()->addCopiedColumn(X, "x");
size_t columnY=plot->getDatastore()->addCopiedColumn(Y, "y");
// create a graph/curve, which displays the data
graph1->setXColumn(columnX);
graph1->setYColumn(columnY);
graph1->setTitle(QObject::tr("graph title"));
plot->addGraph(graph1);
// autoscale the plot
plot->zoomToFit();
// alternatively set the axis dimension by hand:
plot->setXY(-10,10,-10,10);
size_t addCopiedColumn(TIterator first, TIterator last, const QString &name=QString(""))
add one column to the datastore. It will be filled with the values from first ... last
Definition jkqtpdatastorage.h:871
virtual void setTitle(const QString &__value)
sets the title of the plot (for display in key!).
void setYColumn(int __value)
the column that contains the y-component of the datapoints
void setXColumn(int __value)
the column that contains the x-component of the datapoints
This implements xy line plots. This also alows to draw symbols at the data points.
Definition jkqtplines.h:61
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
void zoomToFit(bool zoomX=true, bool zoomY=true, bool includeX0=false, bool includeY0=false, double scaleX=1.05, double scaleY=1.05)
this method zooms the graph so that all plotted datapoints are visible.
Definition jkqtplotter.h:1039
void setXY(double xminn, double xmaxx, double yminn, double ymaxx, bool affectsSecondaryAxes=false)
sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)
Definition jkqtplotter.h:1167
void addGraph(JKQTPPlotElement *gr)
Definition jkqtplotter.h:784
JKQTPDatastore * getDatastore()
returns a pointer to the datastore used by this object
Definition jkqtplotter.h:611

The result should look something like this:

Starting from this basic example, you can observe several important principles:

  1. Data is stored in an (internal) instance of JKQTPDatastore, which is accessible through JKQTPlotter::getDatastore(). This datastore can either own its data (which is done here, as we copy the data into the store by calling JKQTPDatastore::addCopiedColumn(), or it can merely reference to the data (then data needs to be available as array of double values).
  2. Naming conventions (excerpt from Conventions: Naming and Plot Construction ):
    • plot is the complete drawn image, including the axes, the graphs, the key and all other visual elements
    • plot element any sub element of the plot, e.g. a single coordinate axis, the key, but also any graph/curve
    • graph is a single curve/image/geometric element in the plot
    • geometric element is a special graph that does not represent a curve based on data from the JKQTPDatastore, but a single graphic element, like a rectangle/circle/line/..., some text, a single symbol
    • key is the legend of the plot
    • coordinate axis is each of the x- or y-axis (there might be addition axes, e.g. when showing a color-scale)
  3. Each graph is represented by a class derived from JKQTPPlotElement (in the example we instanciated a JKQTPXYLineGraph, which shows data as a scatter of symbols that may (or may not) be connected by a line). Creating the graph class does not yet add it to the plotter. To add it, call JKQTPlotter::addGraph(). Only after this sep, the graph is displayed. You can modify the apperance of the graph (e.g. colors, name in the key ...) by setting properties in the graph class instance.
  4. You can auto-zoom the axis ranges of the plot by calling JKQTPlotter::zoomToFit(), or set them exlicitly by calling JKQTPlotter::setXY(). The user can later zoom in/out by the mouse (and other means). You can limit this zoom range by setting an absolute axis range, calling e.g. JKQTPlotter::setAbsoluteXY(). The the user cannot zoom farther out than the given range(s).
  5. If you want to style the plot itself, you need to set properties of the underlying JKQTBasePloter instance, which is accessible through JKQTPlotter::getPlotter(). If you want to style the coordinate axes, you can acces their representing objects by caling JKQTPlotter::getXAxis() or JKQTPlotter::getYAxis().
See also
Example (JKQTPlotter): Very simple line-graph and
JKQTPlotterQtCreator

Synchronizing Several Plots

Often a single plot is not sufficient, but several plots need to be aligned with respect to each other:

In the Qt Window this is achieved by placing several JKQTPlotter objects into a QGridLayout. In order to support this alignment, also when exporting/printing a plot, and when the user interactions with the plot (e.g. zooming), JKQTPlotter offers an API which allows to :

Note
This API adopts and extends the possibilities of JKQTBasePlotter. Please see the documentation there for details:

User-Interactions/GUI Features

JKQTPlotter offers a lot of user-interaction features out of the box. These are detailed below.

Context Menu of JKQTPlotter

The class JKQTPlotter has a context menu that already offers a lot of functionality.

It allows to:

  • copy or save the data from the internal JKQTPDatastore
  • copy or save the plot to an image file (PNG, PDF, ...), includes a softisticated export-preview dialog:

  • print the plot (includes a softisticated print-preview dialog):

    Print Preview Dialog
    Print Preview Dialog with modified (relative) size, line-width and font-size
  • open a dialog with a table of the plot data:

    Data Table Dialog (with buttons to save or copy the data)
  • zoom into/out of the plot and determine an auto-zoom, which shows all of the plot data
  • switch the visibility of the different graphs in the plot

You can activate this menu, by setting setContextMenuMode(jkqtpcmmStandardContextMenu); and binding a mouse-action (typically the right-click) to the context menu by calling deregisterMouseDragAction(Qt::RightButton,Qt::NoModifier) which deregisters any user actions from the rhs single mouse click. In that case, the context menu is opened by default (see setContextMenuMode() to choose the mode of the context menu).

In addition JKQTPlotter provides several ways to customize this menu:

  • You can add additional actions to the JKQTPlotter, by calling JKQTPlotter::addAction() (i.e. using the default Qt mechanism) and/or by adding actions to the internal JKQTBasePlotter, using JKQTBasePlotter::registerAdditionalAction()
  • You can modify the menu, when it is displayed, by connecting a slot to the signal JKQTPlotter::contextMenuOPened(x,y,menu):
    connect(plot, SIGNAL(contextMenuOpened(double, double, QMenu*)), this, SLOT(contextMenuOpened(double, double, QMenu*)));
    // ...
    void TestUserInteraction::contextMenuOpened(double x, double y, QMenu *contextMenu)
    {
    contextMenu->addSeparator();
    QAction* act=contextMenu->addMenu(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y))->addAction("user-added action");
    connect(act, &QAction::triggered, [x,y]() { QMessageBox::warning(nullptr, tr("Plot Context Menu"),
    tr("Context Menu was opened at x/y=%1/%2!").arg(x).arg(y),
    QMessageBox::Ok,
    QMessageBox::Ok); });
    labMouseAction->setText(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y));
    }
    QMenu * contextMenu
    the context menu object used by this JKQTPlotter
    Definition jkqtplotter.h:1590
    void contextMenuOpened(double x, double y, QMenu *contextMenu)
    emitted whenever a context menu is opened. You can modify the menu via the parameter contextMenu!

Special (User-Defined) Context Menu of JKQTPlotter

In addition to the standard context menu, JKQTPlotter can also be configures to display a special, user-defined context menu. To do so, call `setContextMenuMode(jkqtpcmmSpecialContextMenu) and set your menu, by calling setSpecialContextMenu() You can also combine the special menu and the standard menu, by calling setContextMenuMode(jkqtpcmmStandardAndSpecialContextMenu) .

You can also use the signal contextMenuOpened() to modify the special context menu, but note that alterations to this menu are permanently stored in the special menu object. See contextMenuOpened() for a detailed discussion and ways to circumvent this!

Toolbar of JKQTPlotter

In addition to the context-menu, a JKQtPlotter also also provides a toolbar at its top that offers most of the functionality of the context menu. Usually this toolbar is enabled (see toolbarEnabled) and is in a mode where it is hidden, until the mouse moves over an area at the top of the plot (see toolbarAlwaysOn):

Hidden Toolbar
Shown Toolbar

If toolbarAlwaysOn is set to true (setToolbarAlwaysOn() ), the toolbar is always displayed:

See also
toolbarEnabled, toolbarAlwaysOn, Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter

QActions from a JKQTPlotter

Often you want to allow the suer to operate a plot from a user-defined QToolBar or a QMenu/QMenuBar in your application (e.g. provide zooming commands ...). there are generally two ways to achieve this:

  1. Simply connect home-brewn QAction instances to the slots provided by JKQTPlotter and JKQTBasePlotter. This also allows you to connect different plot properties to edit widgets in your forms.
    // add a checkbox to show and hide the position display label in the plot
    chkPositionDisplay=new QCheckBox(tr("show mouse cursor position"), this);
    chkPositionDisplay->setChecked(plot->isMousePositionShown());
    connect(chkPositionDisplay, SIGNAL(toggled(bool)), plot, SLOT(setMousePositionShown(bool)));
    void setMousePositionShown(bool __value)
    specifies whether to display the current position of the mouse in the top border of the plot (this ma...
  2. For several functions (especially those also present in JKQTPlotter's context-emun, you can also find readily available QAction instances. these are available from JKQTBasePlotter (e.g. by JKQTBasePlotter::getActionPrint() ...). From JKQTPlotter you therefor have to use: getPlotter()->getActionPrint()
    // add some of the default QActions from the JKQTPlotter to the window menu
    // Some of the are also available in the context menu and toolbar of the JKQTPlotter
    // others are not
    QMenu* menuPlot=menuBar()->addMenu("Plot-Menu");
    menuPlot->addAction(plot->getPlotter()->getActionPrint());
    QMenu* menuPlotS=menuPlot->addMenu("Save ...");
    menuPlotS->addAction(plot->getPlotter()->getActionSaveData());
    menuPlotS->addAction(plot->getPlotter()->getActionSavePDF()); // not available from JKQTPlotter by default
    menuPlotS->addAction(plot->getPlotter()->getActionSavePlot());
See also
Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter

Mouse-Interaction in JKQTPlotter

This section summarizes all user-interaction functions in JKQTPlotter that somehow relate to the mouse. These are:

Note
Zooming and Paning interactions apply to both axes when they are performed with the mouse inside the plot. They are limited to one of the two axes, when the mouse hovers over that axis (e.g. when you zoom by mouse-wheel while the mouse pointer is below the plot, over the x-axis, only the x-axis is affected by the operation).

Actions When Dragging the Mouse

JKQTPlotter offers several methods that allow to customize, how it reacts to mouse actions:

  • registerMouseDragAction() tells JKQTPlotter to perform a certain action (selected from JKQTPlotter::MouseActionMode) when a specified mouse button is pushed while a specified (or no) keyborad modifiers (e.g. CTRL,ALT,SHIFT...) is pressed. By default JKQTPlotter calls these two registers in its constructors:
    registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, JKQTPlotter::MouseActionMode::jkqtpmdaZoomByRectangle);
    registerMouseDragAction(Qt::LeftButton, Qt::ControlModifier, JKQTPlotter::MouseActionMode::jkqtpmdaPanPlotOnMove);
    void registerMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDragActions action)
    registeres a certain mouse drag action action to be executed when a mouse drag operation is initializ...
    Therefore by default you can draw a zoom rectangle with the left mouse button without modifiers and you can pan/drag the plot with the left mouse-button while keeping CTRL pressed.
  • deregisterMouseDragAction() deletes a previously defined user-interaction
  • clearAllRegisteredMouseDragActions() deletes all previously specified user-actions

Pressing the ESC key will stop the current JKQTPlotter::MouseActionMode.

If e.g. the mode JKQTPlotter::MouseActionMode::jkqtpmdaZoomByRectangle is selected, while you drag the mouse, the zoom rectangle is drawn over the plot. You can modify the style of drawing using these functions:

Zooming with the mouse
Draw Rectangle User-Action
Drag the Plot Viewport
Measurement Ruler Tool
Data Point Tooltip Tool

Actions After (Double-)Clicks on the Mouse Buttons

The right mouse button has a special role: If it is single-clicked and no JKQTPlotter::MouseActionMode is specified for the vent, it opens the context menu, unless you call setContextMenuMode(jkqtpcmmNoContextMenu) . You can also use setContextMenuMode() to specify which type of context menu is shown. See JKQTPContextMenuModes for details on the available modes.

For any mouse-click, one of the following signals is emitted:

The reaction to double-clicks of the mouse buttons can be specified separately. The possible actions are listed in JKQTPMouseDoubleClickActions. You can bind one of these actions to a specific click with these functions:

The button to react to is specified as a parameter.

Actions When a Mouse Wheel Event Occurs

The actions to be performed when the mouse wheel is operated are specified in JKQTPMouseWheelActions. You can bind one of these actions to the mouse-wheel (under the condition that a specified Qt::KeyboardModifiers is pressed) by using these functions:

In addition the signal void plotMouseWheelOperated() is emitted whenever a mouse-wheel event occurs.

Mouse Move Signaling and Actions

In addition the signal plotMouseMove() is called whenever the mouse moves over the plot. Additional signals may be emitted, depending on the currently active JKQTPlotter::MouseActionMode.

Also the current mouse position is shown above the graph by default (can be switched on or off using setMousePositionShown() ).

The actions to be performed when the mouse moves without a mouse-button pressed are specified in JKQTPMouseMoveActions. You can bind one of these actions to the mouse (under the condition that a specified Qt::KeyboardModifiers is pressed) by using these functions:

Fast Resizing of a Plot Widget

When the user resized the widget, the graph would in principle have to be readrawn for every intermediate step. As this is very timeconsuming, JKQTPlotter uses a different approach: Actual Redrawing is delayed a few 100ms and this delay is reset whenever the widget size changes. Only after the last delay expires, the plot is redrawn. In between an image of the last state of the plot is simple stretched/compressed to fill the new/current widget size. In sum this looks like this:

How to use JKQTPlotter in the Qt Form Designer

As JKQTPlotter is a standard Qt widget, you can also use it in Qt UI-files designed with the Qt From Designer (e.g. from within QTCreator). For this to work you have to use the Promote QWidget"-feature of the form designer. The steps you need to take are detailed below:

  1. add a new UI-file to your project and open it in the Form Editor. Then right-click the form and select Promote Widgets ...:

  2. In the dialog that opens, you have to define JKQTPlotter as a promotion to QWidget as shown below. Finally store the settings by clicking Add and closing the dialog with Close.

  3. Now you can add a QWidgetfrom the side-bar to the form and then promote it to JKQTPlotter, by selecting and right-clicking the QWidget and then selecting Promote To | JKQTPlotter:

See also
Tutorial (JKQTPlotter): Using a JKQTPlotter inside a Qt User Interface Designer (UI) File
Also see Tutorial (JKQTPlotter): Styling a JKQtPlotter for another example of using the Qt UI Designer with JKQTPlotter

Member Typedef Documentation

◆ InternalBufferImageType

typedef QPixmap JKQTPlotter::InternalBufferImageType
protected

Member Enumeration Documentation

◆ WheelActionType

enum class JKQTPlotter::WheelActionType
strongprotected
Enumerator
Zoom 
Pan 
None 

Constructor & Destructor Documentation

◆ JKQTPlotter() [1/3]

JKQTPlotter::JKQTPlotter ( bool  datastore_internal,
QWidget *  parent = nullptr,
JKQTPDatastore datast = nullptr 
)
explicit

class constructor

If datastore_internal ==false, you can supply an external JKQTPDatastore with the parameter datast

◆ JKQTPlotter() [2/3]

JKQTPlotter::JKQTPlotter ( JKQTPDatastore datast,
QWidget *  parent = nullptr 
)
explicit

class constructor for a JKQTPlotter using an external JKQTPDatastore dataset

◆ JKQTPlotter() [3/3]

JKQTPlotter::JKQTPlotter ( QWidget *  parent = nullptr)
explicit

class constructor

generated a new internal JKQTPDatastore

◆ ~JKQTPlotter()

virtual JKQTPlotter::~JKQTPlotter ( )
virtual

class destructor

Member Function Documentation

◆ addGraph()

void JKQTPlotter::addGraph ( JKQTPPlotElement gr)
inline



◆ addGraphAtBottom()

void JKQTPlotter::addGraphAtBottom ( JKQTPPlotElement gr)
inline

add a new graph before all other graphs (i.e. at the top of the list of graphs), if the graph is already in the plot, it is moved to the top

Parameters
grgraph object (of type JKQTPPlotElement) to be added. Note: The JKQTPlotter takes ownership of graph gr .
Note
the added graph is drawn BELOW/BEFORE all other graphs.

◆ addGraphOnTop()

void JKQTPlotter::addGraphOnTop ( JKQTPPlotElement gr)
inline

add a new graph at the end of the graphs, if the graph is already in the plot, it is moved to the end of the list

Parameters
grgraph object (of type JKQTPPlotElement) to be added. Note: The JKQTPlotter takes ownership of graph gr .
Note
the added graph is drawn ABOVE/AFTER all other graphs.

◆ addGraphs()

template<class TJKQTPGraphContainer >
void JKQTPlotter::addGraphs ( const TJKQTPGraphContainer &  gr,
QVector< size_t > *  graphIDsOut = nullptr 
)
inline

add a new graphs from a QVector<JKQTPPlotElement*>, QList<JKQTPPlotElement*>, std::vector<JKQTPPlotElement*> ... or any standard-iterateable container with JKQTPPlotElement*-items

Template Parameters
TJKQTPGraphContainera container type with default C++-sytle iterator interface (i.e. methods begin() and end() and an iterator, which may be moved to the next element with the operator ++ .
Parameters
grContainer of type TJKQTPGraphContainer, which contains the graphs Note: The JKQTPlotter takes ownership of graphs in gr .
[out]graphIDsOutoptional output parameter, the vector will contain the IDs of each graph added to theis plot

◆ addGridPrintingPlotter()

void JKQTPlotter::addGridPrintingPlotter ( size_t  x,
size_t  y,
JKQTPlotter plotterOther 
)

add a new plotter plotterOther for grid printing mode, at location x / y

Note
This function call forwards to JKQTBasePlotter::addGridPrintingPlotter()
See also
setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), Synchronizing Several Plots

◆ beforePlotScalingRecalculate

void JKQTPlotter::beforePlotScalingRecalculate ( )
signal

emitted before the plot scaling has been recalculated

◆ beginGraphs() [1/2]

JKQTBasePlotter::GraphsIterator JKQTPlotter::beginGraphs ( )
inline

returns an iterator to the first graph

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ beginGraphs() [2/2]

JKQTBasePlotter::GraphsConstIterator JKQTPlotter::beginGraphs ( ) const
inline

returns an iterator to the first graph

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ cbeginGraphs()

JKQTBasePlotter::GraphsConstIterator JKQTPlotter::cbeginGraphs ( ) const
inline

returns an iterator to the first graph

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ cendGraphs()

JKQTBasePlotter::GraphsConstIterator JKQTPlotter::cendGraphs ( ) const
inline

returns an iterator behind the last graph

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ clearAllMouseMoveActions()

void JKQTPlotter::clearAllMouseMoveActions ( )

◆ clearAllMouseWheelActions()

void JKQTPlotter::clearAllMouseWheelActions ( )

◆ clearAllRegisteredMouseDoubleClickActions()

void JKQTPlotter::clearAllRegisteredMouseDoubleClickActions ( )

clear all registered mouse double-click actions

◆ clearAllRegisteredMouseDragActions()

void JKQTPlotter::clearAllRegisteredMouseDragActions ( )

clear all registeres mouse drag actions

◆ clearGraphs()

void JKQTPlotter::clearGraphs ( bool  deleteGraphs = true)
inline

remove all plots

Parameters
deleteGraphsif set true (default) the graph objects will also be deleted

◆ clearGridPrintingPlotters()

void JKQTPlotter::clearGridPrintingPlotters ( )

◆ containsGraph()

bool JKQTPlotter::containsGraph ( JKQTPPlotElement gr)
inline

returns true, if the given graph is in this plot


◆ contextMenuOpened

void JKQTPlotter::contextMenuOpened ( double  x,
double  y,
QMenu *  contextMenu 
)
signal

emitted whenever a context menu is opened. You can modify the menu via the parameter contextMenu!

Parameters
xx-position of the context-menu (in plot coordinates)
yy-position of the context-menu (in plot coordinates)
contextMenuQMenu-object of the context menu. This object may be altered to display additional items ... Here is an example:
contextMenu->addSeparator();
QAction* act=contextMenu->addMenu(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y))->addAction("user-added action");
connect(act, &QAction::triggered, [x,y]() { QMessageBox::warning(nullptr, tr("Plot Context Menu"),
tr("Context Menu was opened at x/y=%1/%2!").arg(x).arg(y),
QMessageBox::Ok,
QMessageBox::Ok); });
Please read the warning below!!!
Warning
A note of care: This signal can be used to alter the context menu. It behaves differently, depending on whether you use the standard context menu, or the special context menu (setSpecialContextMenu()). If the standard menu is opened, your alterations are valid until it is shown the next time (i.e. the internal context menu object is deleted in between). If you show the special context menu only, your alterations are permanently stored in the menu object. I.e. if you use the code example above and open the menu several times, it will accumulate additional menu entries! If you must modify the special menu, just access actions and do not add or delete any in a slot bound to this signal! You can recognize the special menu with code like this:
if (contextMenu == plot->getSpecialContextMenu()) {
//...
// do something with the special menu, do not add/remove entries
} else {
//...
// do something with the standard menu, you are free to do anything!
}
See also
Context Menu of JKQTPlotter , Special (User-Defined) Context Menu of JKQTPlotter, Mouse-Interaction in JKQTPlotter

◆ copyData

void JKQTPlotter::copyData ( )
inlineslot

copy the data used for the current plot to the clipboard

copies data as tab separated data with the system-decimal point.

◆ copyDataMatlab

void JKQTPlotter::copyDataMatlab ( )
inlineslot

copy the data used for the current plot to the clipboard as a Matlab script

example output:

% data from columne 1 ('x')
x = [ 0 0.251327 0.502655 ... ];
% data from columne 2 ('y')
y = [ 0 0.24869 0.481754 ... ];
See also
saveAsMatlab()

◆ copyPixelImage()

void JKQTPlotter::copyPixelImage ( bool  showPreview = true)
inline

copy the current plot as a pixel+svg image to the clipboard


◆ correctZoomRectForPanning()

void JKQTPlotter::correctZoomRectForPanning ( QRectF &  rect) const
protected

tool function, which corrects the given rectangle (in pixels!) during a panning action. The correction is necesary towards getAbsoluteXY() to prevent an unwanted zooming in.

◆ createImageBuffer()

InternalBufferImageType JKQTPlotter::createImageBuffer ( ) const
protected

constructs a new image for the internal double-buffering

◆ delayedResizeEvent

void JKQTPlotter::delayedResizeEvent ( )
protectedslot

while the window is resized, the plot is only redrawn after a restartable delay, implemented by this function and resizeTimer

See also
resizeTimer

◆ deleteGraph() [1/2]

void JKQTPlotter::deleteGraph ( JKQTPPlotElement gr,
bool  deletegraph = true 
)
inline

remove the i-th graph


◆ deleteGraph() [2/2]

void JKQTPlotter::deleteGraph ( size_t  i,
bool  deletegraph = true 
)
inline

remove the i-th graph


◆ deregisterMouseDoubleClickAction()

void JKQTPlotter::deregisterMouseDoubleClickAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifier 
)

deregisteres the mouse action action to be executed when a mouse double-click occurs with the given button and modifier

◆ deregisterMouseDragAction()

void JKQTPlotter::deregisterMouseDragAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifier 
)

deregisteres the mouse drag action to be executed when a mouse drag operation is initialized with the given button and modifier

◆ deregisterMouseMoveAction()

void JKQTPlotter::deregisterMouseMoveAction ( Qt::KeyboardModifiers  modifier)

deletes all mouse-move actions registered for a given modifier

See also
registerMouseMoveAction(), clearAllMouseMoveActions(), Mouse-Interaction in JKQTPlotter

◆ deregisterMouseWheelAction()

void JKQTPlotter::deregisterMouseWheelAction ( Qt::KeyboardModifiers  modifier)

deletes all mouse-wheel actions registered for a given modifier

See also
registerMouseWheelAction(), clearAllMouseWheelActions(), Mouse-Interaction in JKQTPlotter

◆ endGraphs() [1/2]

JKQTBasePlotter::GraphsIterator JKQTPlotter::endGraphs ( )
inline

returns an iterator behind the last graph

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ endGraphs() [2/2]

JKQTBasePlotter::GraphsConstIterator JKQTPlotter::endGraphs ( ) const
inline

returns an iterator behind the last graph

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ event()

virtual bool JKQTPlotter::event ( QEvent *  event)
overrideprotectedvirtual

◆ fillInternalStructForToolTipOfClosestDataPoint()

void JKQTPlotter::fillInternalStructForToolTipOfClosestDataPoint ( double  x0,
double  y0,
bool  emitEvent = true 
)
protected

fills the inertnal mouseDragMarkers structure with data to display tooltips close to (x0, y0)

if emitEvent is true, the signal is emitted before the function returns

◆ findMatchingMouseDoubleClickAction()

JKQTPMouseDoubleClickActionsHashMapIterator JKQTPlotter::findMatchingMouseDoubleClickAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifiers,
bool *  found = nullptr 
) const
protected

◆ findMatchingMouseDragAction()

JKQTPMouseDragActionsHashMapIterator JKQTPlotter::findMatchingMouseDragAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifiers,
bool *  found = nullptr 
) const
protected

searches JKQTPlotterStyle::registeredMouseActionModes for a matching action, returns in found whether an action was found

◆ findMatchingMouseMoveAction()

JKQTPMouseMoveActionsHashMapIterator JKQTPlotter::findMatchingMouseMoveAction ( Qt::KeyboardModifiers  modifiers,
bool *  found = nullptr 
) const
protected

searches JKQTPlotterStyle::registeredMouseMoveActions for a matching action

◆ findMatchingMouseWheelAction()

JKQTPMouseWheelActionsHashMapIterator JKQTPlotter::findMatchingMouseWheelAction ( Qt::KeyboardModifiers  modifiers,
bool *  found = nullptr 
) const
protected

searches JKQTPlotterStyle::registeredMouseWheelActions for a matching action

◆ fixBasePlotterSettings()

void JKQTPlotter::fixBasePlotterSettings ( )
protected

modifies the settings of plotter to match those of this object

◆ forceInternalDatastore()

void JKQTPlotter::forceInternalDatastore ( )
inline

tells the plotter object to use an internal datastore (just like useInternalDatastore() ), but forces the generation of a new datastore, even if the current one is already internal (the current one will be freed in the lather case

◆ getAbsoluteXMax()

double JKQTPlotter::getAbsoluteXMax ( ) const
inline

returns the absolute x-axis max of the primary x-axis This is the highest allowed value the the axis min/max.

See also
JKQTPCoordinateAxis::getAbsoluteMax()

◆ getAbsoluteXMin()

double JKQTPlotter::getAbsoluteXMin ( ) const
inline

returns the absolute x-axis min of the primary x-axis. This is the lowest allowed value the the axis min/max.

See also
JKQTPCoordinateAxis::getAbsoluteMin()

◆ getAbsoluteYMax()

double JKQTPlotter::getAbsoluteYMax ( ) const
inline

returns the absolute y-axis max of the primary y-axis This is the highest allowed value the the axis min/max.

See also
JKQTPCoordinateAxis::getAbsoluteMax()

◆ getAbsoluteYMin()

double JKQTPlotter::getAbsoluteYMin ( ) const
inline

returns the absolute y-axis min of the primary y-axis This is the lowest allowed value the the axis min/max.

See also
JKQTPCoordinateAxis::getAbsoluteMin()

◆ getActMouseLeftAsDefault() [1/2]

QAction * JKQTPlotter::getActMouseLeftAsDefault ( )

action that activates the default action, set in plotterStyle!

◆ getActMouseLeftAsDefault() [2/2]

const QAction * JKQTPlotter::getActMouseLeftAsDefault ( ) const

action that activates the default action, set in plotterStyle!

◆ getActMouseLeftAsPanView() [1/2]

QAction * JKQTPlotter::getActMouseLeftAsPanView ( )

action that activates the pan view tool (override!)

◆ getActMouseLeftAsPanView() [2/2]

const QAction * JKQTPlotter::getActMouseLeftAsPanView ( ) const

action that activates the pan view tool (override!)

◆ getActMouseLeftAsRuler() [1/2]

QAction * JKQTPlotter::getActMouseLeftAsRuler ( )

action that activates the ruler tool (override!)

◆ getActMouseLeftAsRuler() [2/2]

const QAction * JKQTPlotter::getActMouseLeftAsRuler ( ) const

action that activates the ruler tool (override!)

◆ getActMouseLeftAsZoomRect() [1/2]

QAction * JKQTPlotter::getActMouseLeftAsZoomRect ( )

action that activates the zoom rectangle tool (override!)

◆ getActMouseLeftAsZoomRect() [2/2]

const QAction * JKQTPlotter::getActMouseLeftAsZoomRect ( ) const

action that activates the zoom rectangle tool (override!)

◆ getActMouseMoveToolTip() [1/2]

QAction * JKQTPlotter::getActMouseMoveToolTip ( )

action that activates the tooltip tool (override!)

◆ getActMouseMoveToolTip() [2/2]

const QAction * JKQTPlotter::getActMouseMoveToolTip ( ) const

action that activates the tooltip tool (override!)

◆ getConstplotter()

const JKQTBasePlotter * JKQTPlotter::getConstplotter ( ) const
inline

returns the JKQTBasePlotter object internally used for plotting

◆ getContextMenuMode()

JKQTPContextMenuModes JKQTPlotter::getContextMenuMode ( ) const

◆ getCurrentPlotterStyle()

const JKQTPlotterStyle & JKQTPlotter::getCurrentPlotterStyle ( ) const

◆ getDatastore() [1/2]

JKQTPDatastore * JKQTPlotter::getDatastore ( )
inline

returns a pointer to the datastore used by this object


◆ getDatastore() [2/2]

const JKQTPDatastore * JKQTPlotter::getDatastore ( ) const
inline

returns a pointer to the datastore used by this object


◆ getGlobalResizeDelay()

static int JKQTPlotter::getGlobalResizeDelay ( )
static

returns the currently set global resize delay in milliseconds delayMS. This function is thread-safe!

See also
jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer

◆ getGraph() [1/2]

JKQTPPlotElement * JKQTPlotter::getGraph ( size_t  i)
inline

returns description of i'th graph

Note
If you modify the returned graph, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ getGraph() [2/2]

const JKQTPPlotElement * JKQTPlotter::getGraph ( size_t  i) const
inline

returns description of i'th graph

Note
If you modify the returned graph, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ getGraphCount()

size_t JKQTPlotter::getGraphCount ( )
inline

returns the number of graphs


◆ getGraphs() [1/2]

JKQTBasePlotter::GraphsList & JKQTPlotter::getGraphs ( )
inline

returns a list of all graphs

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ getGraphs() [2/2]

const JKQTBasePlotter::GraphsList & JKQTPlotter::getGraphs ( ) const
inline

returns a list of all graphs

Note
If you modify the graphs or change their position, a replot may not happen, so call redrawPlot() if the plotter is e.g. embedded in a visible widget to cause a redrawing of the plot!

◆ getImageBufferSize()

QSize JKQTPlotter::getImageBufferSize ( float *  scale_out = nullptr) const
protected

returns the required size of an image for the internal double-buffering

◆ getMagnification()

double JKQTPlotter::getMagnification ( ) const
inline

returns the current magnification factor

◆ getMainKey() [1/2]

JKQTPBaseKey * JKQTPlotter::getMainKey ( )
inline

retuns the main key object


◆ getMainKey() [2/2]

const JKQTPBaseKey * JKQTPlotter::getMainKey ( ) const
inline

retuns the main key object


◆ getMaxTooltipDistance()

int JKQTPlotter::getMaxTooltipDistance ( ) const

maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed


◆ getMouseContextX()

double JKQTPlotter::getMouseContextX ( ) const

x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)

See also
Context Menu of JKQTPlotter , getMouseContextY(), getMouseLastClickX(), getMouseLastClickY()

◆ getMouseContextY()

double JKQTPlotter::getMouseContextY ( ) const

y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)

See also
Context Menu of JKQTPlotter , getMouseContextX(), getMouseLastClickX(), getMouseLastClickY()

◆ getMouseLastClickX()

int JKQTPlotter::getMouseLastClickX ( ) const

x-position of the last mouse-click (in screen pixels)

See also
getMouseLastClickY(), getMouseContextX(), getMouseContextY()

◆ getMouseLastClickY()

int JKQTPlotter::getMouseLastClickY ( ) const

y-position of the last mouse-click (in screen pixels)

See also
getMouseLastClickX(), getMouseContextX(), getMouseContextY()

◆ getNextStyle()

int JKQTPlotter::getNextStyle ( )
inline

gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles


◆ getPlotStyle()

JKQTBasePlotter::JKQTPPen JKQTPlotter::getPlotStyle ( int  i) const
inline

returns a QPen object for the i-th plot style


◆ getPlotter() [1/2]

JKQTBasePlotter * JKQTPlotter::getPlotter ( )
inline

returns the JKQTBasePlotter object internally used for plotting

◆ getPlotter() [2/2]

const JKQTBasePlotter * JKQTPlotter::getPlotter ( ) const
inline

returns the JKQTBasePlotter object internally used for plotting

◆ getPlotYOffset()

int JKQTPlotter::getPlotYOffset ( ) const
protected

calculate the y-axis shift of the plot, so there is space for the potentially displayed mouse position label

◆ getSpecialContextMenu()

QMenu * JKQTPlotter::getSpecialContextMenu ( ) const

◆ getToolbarIconSize()

int JKQTPlotter::getToolbarIconSize ( ) const

get the width/height of the icons in the toolbar in pt

◆ getUserActionCatchSensitivity()

int JKQTPlotter::getUserActionCatchSensitivity ( ) const

sensitivity (i.e. max. distance to see as one point) for user actions


◆ getUserActionMarkerBrush()

QBrush JKQTPlotter::getUserActionMarkerBrush ( ) const

◆ getUserActionMarkerDiameter()

int JKQTPlotter::getUserActionMarkerDiameter ( ) const

size (diameter) of markers drawn by user actions


◆ getUserActionMarkerPen()

QPen JKQTPlotter::getUserActionMarkerPen ( ) const

◆ getUserActionMarkerType()

JKQTPUserActionMarkerType JKQTPlotter::getUserActionMarkerType ( ) const

type of the location markers of user actions on the plot

See also
Actions When Dragging the Mouse

◆ getUserActionOpaqueBrush()

QBrush JKQTPlotter::getUserActionOpaqueBrush ( ) const

brush for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)

See also
Actions When Dragging the Mouse
setUserActionOpaqueBrush(), getUserActionOpaqueBrush(), JKQTPlotterStyle::userActionOpaqueBrush Actions When Dragging the Mouse

◆ getUserActionOpaquePen()

QPen JKQTPlotter::getUserActionOpaquePen ( ) const

pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)

See also
Actions When Dragging the Mouse
setUserActionOpaquePen(), getUserActionOpaquePen(), JKQTPlotterStyle::userActionOpaquePen Actions When Dragging the Mouse

◆ getUserActionOverlayBrush()

QBrush JKQTPlotter::getUserActionOverlayBrush ( ) const

◆ getUserActionOverlayPen()

QPen JKQTPlotter::getUserActionOverlayPen ( ) const

pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)

See also
Actions When Dragging the Mouse
setUserActionOverlayPen(), getUserActionOverlayPen(), JKQTPlotterStyle::userActionOverlayPen Actions When Dragging the Mouse

◆ getXAxis() [1/2]

JKQTPHorizontalAxisBase * JKQTPlotter::getXAxis ( JKQTPCoordinateAxisRef  axis = JKQTPPrimaryAxis)
inline

returns the x-axis objet of the plot

See also
Axis Ticks and Grids

◆ getXAxis() [2/2]

const JKQTPHorizontalAxisBase * JKQTPlotter::getXAxis ( JKQTPCoordinateAxisRef  axis = JKQTPPrimaryAxis) const
inline

returns the x-axis objet of the plot

See also
Axis Ticks and Grids

◆ getXMax()

double JKQTPlotter::getXMax ( ) const
inline

returns the current x-axis max of the primary x-axis

See also
JKQTPCoordinateAxis::getMax()

◆ getXMin()

double JKQTPlotter::getXMin ( ) const
inline

returns the current x-axis min of the primary x-axis

See also
JKQTPCoordinateAxis::getMin()

◆ getYAxis() [1/2]

JKQTPVerticalAxisBase * JKQTPlotter::getYAxis ( JKQTPCoordinateAxisRef  axis = JKQTPPrimaryAxis)
inline

returns the y-axis objet of the plot

See also
Axis Ticks and Grids

◆ getYAxis() [2/2]

const JKQTPVerticalAxisBase * JKQTPlotter::getYAxis ( JKQTPCoordinateAxisRef  axis = JKQTPPrimaryAxis) const
inline

returns the y-axis objet of the plot

See also
Axis Ticks and Grids

◆ getYMax()

double JKQTPlotter::getYMax ( ) const
inline

returns the current y-axis max of the primary y-axis

See also
JKQTPCoordinateAxis::getMax()

◆ getYMin()

double JKQTPlotter::getYMin ( ) const
inline

returns the current y-axis min of the primary y-axis

See also
JKQTPCoordinateAxis::getMin()

◆ grabPixelImage()

QImage JKQTPlotter::grabPixelImage ( QSize  size = QSize(),
bool  showPreview = false 
)
inline

returns a rendering of the current plot as a QImage (pixel image) with the given size

See also
saveAsPixelImage(), copyPixelImage()

◆ initContextMenu()

void JKQTPlotter::initContextMenu ( )
protected

fills the member contextMenu with all default and additionally registered actions, also calls modifyContextMenu()

Note
This function calls resetContextMenu() internally!
See also
resetContextMenu(), contextMenuMode

◆ intBeforePlotScalingRecalculate

void JKQTPlotter::intBeforePlotScalingRecalculate ( )
protectedslot

emitted before the plot scaling has been recalculated

◆ isEmittingSignalsEnabled()

bool JKQTPlotter::isEmittingSignalsEnabled ( ) const
inline

returns whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate()

◆ isMousePositionShown()

bool JKQTPlotter::isMousePositionShown ( ) const

specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the top border, so the position fits in. The default widget font is used for the output.

See also
mousePositionTemplate, Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter, Mouse Move Signaling and Actions
setMousePositionShown(), JKQTPlotterStyle::displayMousePosition, Mouse Move Signaling and Actions

◆ isPlotUpdateEnabled()

bool JKQTPlotter::isPlotUpdateEnabled ( ) const

returns, whether automatic redrawing the plot is currently activated (e.g. you can deactivate this with setPlotUpdateEnabled() while performing major updates on the plot)

See also
setPlotUpdateEnabled()

◆ isResizeTimerRunning()

bool JKQTPlotter::isResizeTimerRunning ( ) const

returns true, if the JKQTPlotter::resizeTimer is currently running and the widget is waiting for the resize-event to finish

See also
jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer

◆ isToolbarAlwaysOn()

bool JKQTPlotter::isToolbarAlwaysOn ( ) const

returns whether the toolbar is always visible or only when the mouse moves to the upper left area

If toolbarAlwaysOn is set to true:

If toolbarAlwaysOn is set to false, the toolbar only appears when the mouse is in the right location:

Hidden Toolbar
Shown Toolbar
See also
toolbarEnabled, Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter
setToolbarAlwaysOn(), JKQTPlotterStyle::toolbarAlwaysOn

◆ isToolbarEnabled()

bool JKQTPlotter::isToolbarEnabled ( ) const

◆ keyReleaseEvent()

void JKQTPlotter::keyReleaseEvent ( QKeyEvent *  event)
overrideprotected

react on key presses.

These shortcuts are defined:

  • ESC stops current zooming/drawing action

◆ leaveEvent()

void JKQTPlotter::leaveEvent ( QEvent *  event)
overrideprotected

called, when the mouse leaves the widget, hides the toolbar (if visible)

◆ loadCurrentPlotterStyle()

void JKQTPlotter::loadCurrentPlotterStyle ( const QSettings &  settings,
const QString &  group = "plots/",
bool  alsoLoadBaseStyle = true 
)

replace the current style properties for this JKQTBasePlotter with properties loaded from settings

Parameters
settingsthe QSettings object to read from
groupgroup in settings to read from
alsoLoadBaseStyleif true, then also JKQTBasePlotter::loadCurrentPlotterStyle() of the internal JKQTBasePlotter is called
See also
JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), Styling System

◆ loadSettings()

void JKQTPlotter::loadSettings ( const QSettings &  settings,
const QString &  group = QString("plots/") 
)

loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object

◆ masterPlotScalingRecalculated

void JKQTPlotter::masterPlotScalingRecalculated ( )
protectedslot

connected to plotScalingRecalculated() of the masterPlotter

◆ minimumSizeHint()

QSize JKQTPlotter::minimumSizeHint ( ) const
override

returns the minimum size of the widget

◆ modifyContextMenu()

void JKQTPlotter::modifyContextMenu ( QMenu *  menu)
protected

you may overwrite this method to modify the given context menu before it is displayed.

The plotter will fill the menu with the default items and then call this method. The default implementation does NOTHING.

See also
Context Menu of JKQTPlotter , Mouse-Interaction in JKQTPlotter

◆ modifyGraphs()

void JKQTPlotter::modifyGraphs ( const std::function< void(JKQTPPlotElement *)> &  func)
inline

apply functor func to all graphs in the plotter. After completing the operation, the graph is updated

◆ mouseDoubleClickEvent()

void JKQTPlotter::mouseDoubleClickEvent ( QMouseEvent *  event)
overrideprotected

event handler for a double click

See also
registerMouseDoubleClickAction(), deregisterMouseDoubleClickAction()

◆ mouseMoveEvent()

void JKQTPlotter::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

event handler for a mouse move

This implements two behaviours:

  • if displayMousePosition is true , stores the current mouse position in mousePosX, mousePosY
  • if necessary, contributes to user-actions started by mousePressEvent()
  • emits plotMouseMove() if the mouse is inside the plot rectangle .
  • execute mouseMoveActions
See also
mousePosX, mousePosY
registerMouseWheelAction(), deregisterMouseWheelAction(), registeredMouseWheelActions

◆ mousePressEvent()

void JKQTPlotter::mousePressEvent ( QMouseEvent *  event)
overrideprotected

event handler for a mouse down event

This event determines the action to be performed from registeredMouseActionModes and then sets currentMouseDragAction accordingly and starts the mouse action.

See also
registerMouseDragAction(), deregisterMouseDragAction(), registeredJKQTPMouseDragActions

◆ mouseReleaseEvent()

void JKQTPlotter::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

event handler for a mouse release event

this finishes the action, started by mousePressEvent()

◆ moveGraphBottom() [1/2]

void JKQTPlotter::moveGraphBottom ( int  idx)
inline

move the given graph gr to the bottom of all graphs


◆ moveGraphBottom() [2/2]

void JKQTPlotter::moveGraphBottom ( JKQTPPlotElement gr)
inline

move the given graph gr to the bottom of all graphs


◆ moveGraphDown() [1/2]

void JKQTPlotter::moveGraphDown ( int  idx)
inline

move the given graph gr one item down (i.e. it is drawn earlier/lower in the z-stack)


◆ moveGraphDown() [2/2]

void JKQTPlotter::moveGraphDown ( JKQTPPlotElement gr)
inline

move the given graph gr one item down (i.e. it is drawn earlier/lower in the z-stack)


◆ moveGraphTop() [1/2]

void JKQTPlotter::moveGraphTop ( int  idx)
inline

move the given graph gr to the end of all graphs, so it is drawn


◆ moveGraphTop() [2/2]

void JKQTPlotter::moveGraphTop ( JKQTPPlotElement gr)
inline

move the given graph gr to the end of all graphs, so it is drawn


◆ moveGraphUp() [1/2]

void JKQTPlotter::moveGraphUp ( int  idx)
inline

move the given graph gr one item up (i.e. it is drawn later/higher in the z-stack)


◆ moveGraphUp() [2/2]

void JKQTPlotter::moveGraphUp ( JKQTPPlotElement gr)
inline

move the given graph gr one item up (i.e. it is drawn later/higher in the z-stack)


◆ openContextMenu [1/2]

void JKQTPlotter::openContextMenu ( )
slot

open the context menu at the mouse position of the last click

See also
Context Menu of JKQTPlotter , Mouse-Interaction in JKQTPlotter

◆ openContextMenu [2/2]

void JKQTPlotter::openContextMenu ( int  x,
int  y 
)
slot

open the context menu at the mouse position x and y

See also
Context Menu of JKQTPlotter , Mouse-Interaction in JKQTPlotter

◆ openSpecialContextMenu [1/2]

void JKQTPlotter::openSpecialContextMenu ( )
slot

open the special context menu at the mouse position of the last click

See also
Special (User-Defined) Context Menu of JKQTPlotter, Mouse-Interaction in JKQTPlotter

◆ openSpecialContextMenu [2/2]

void JKQTPlotter::openSpecialContextMenu ( int  x,
int  y 
)
slot

open the special context menu at the mouse position x and y

See also
Special (User-Defined) Context Menu of JKQTPlotter, Mouse-Interaction in JKQTPlotter

◆ openStandardAndSpecialContextMenu [1/2]

void JKQTPlotter::openStandardAndSpecialContextMenu ( )
slot

open the standard context menu with the special context menu integrated at the mouse position of the last click

See also
Special (User-Defined) Context Menu of JKQTPlotter, Mouse-Interaction in JKQTPlotter

◆ openStandardAndSpecialContextMenu [2/2]

void JKQTPlotter::openStandardAndSpecialContextMenu ( int  x,
int  y 
)
slot

open the standard context menu with the special context menu integrated at the mouse position x and y

See also
Context Menu of JKQTPlotter , Special (User-Defined) Context Menu of JKQTPlotter, Mouse-Interaction in JKQTPlotter

◆ openStandardContextMenu [1/2]

void JKQTPlotter::openStandardContextMenu ( )
slot

open the standard context menu at the mouse position of the last click

See also
Context Menu of JKQTPlotter , Mouse-Interaction in JKQTPlotter

◆ openStandardContextMenu [2/2]

void JKQTPlotter::openStandardContextMenu ( int  x,
int  y 
)
slot

open the standard context menu at the mouse position x and y

See also
Context Menu of JKQTPlotter , Mouse-Interaction in JKQTPlotter

◆ paintEvent()

void JKQTPlotter::paintEvent ( QPaintEvent *  event)
overrideprotected

this simply paints the stored image to the widget's surface

◆ paintUserAction()

void JKQTPlotter::paintUserAction ( )
protected

paint the user action (rectangle, ellipse, ...

◆ plotMouseClicked

void JKQTPlotter::plotMouseClicked ( double  x,
double  y,
Qt::KeyboardModifiers  modifiers,
Qt::MouseButton  button 
)
signal

emitted when a single-click event from the mouse occurs inside the plot

Parameters
xx-position of the mouse (in plot coordinates)
yy-position of the mouse (in plot coordinates)
modifierskey-modifiers when the click occured
buttonmouse-button that was used for the click

◆ plotMouseDoubleClicked

void JKQTPlotter::plotMouseDoubleClicked ( double  x,
double  y,
Qt::KeyboardModifiers  modifiers,
Qt::MouseButton  button 
)
signal

emitted when a double-click event from the mouse occurs inside the plot

Parameters
xx-position of the mouse (in plot coordinates)
yy-position of the mouse (in plot coordinates)
modifierskey-modifiers when the click occured
buttonmouse-button that was used for the click

◆ plotMouseMove

void JKQTPlotter::plotMouseMove ( double  x,
double  y 
)
signal

emitted whenever the mouse moves

Parameters
xx-position of the mouse (in plot coordinates)
yy-position of the mouse (in plot coordinates)

◆ plotMouseWheelOperated

void JKQTPlotter::plotMouseWheelOperated ( double  x,
double  y,
Qt::KeyboardModifiers  modifiers,
int  deltaAngleX,
int  deltaAngleY 
)
signal

emitted when a single-click event from the mouse occurs inside the plot

Parameters
xx-position of the mouse (in plot coordinates)
yy-position of the mouse (in plot coordinates)
modifierskey-modifiers when the click occured
deltaAngleXamount of rotation (in eighths of a degree) of the wheel in x-direction
deltaAngleYamount of rotation (in eighths of a degree) of the wheel in y-direction

◆ plotNewZoomRectangle

void JKQTPlotter::plotNewZoomRectangle ( double  mouseDragRectXStart,
double  mouseDragRectXEnd,
double  mouseDragRectYStart,
double  mouseDragRectYEnd,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when the mouse action jkqtpmdaZoomByRectangle and the drawing of the new zoom rectangle is finished (=mouse key released)

Parameters
mouseDragRectXStartstart of the selected x-range (in plot coordinates)
mouseDragRectXEndend of the selected x-range (in plot coordinates)
mouseDragRectYStartstart of the selected x-range (in plot coordinates)
mouseDragRectYEndend of the selected x-range (in plot coordinates)
modifierskey-modifiers when the click occured

◆ plotScalingRecalculated

void JKQTPlotter::plotScalingRecalculated ( )
signal

emitted when the plot scaling has been recalculated

◆ populateToolbar

void JKQTPlotter::populateToolbar ( QToolBar *  toolbar) const
slot

popuplate the given toolbar toolbar with all actions shown in a toolbar from this class ...

This function can be used to populate an external toolbar with actions for this JKQTPlotter.

◆ print

void JKQTPlotter::print ( QPrinter *  printer = nullptr)
inlineslot

print the current plot, if printer is nullptr a printer selection dialog is displayed

Note
This function is only available on platforms with QPrinter support!

◆ pzoomChangedLocally

void JKQTPlotter::pzoomChangedLocally ( double  newxmin,
double  newxmax,
double  newymin,
double  newymax,
JKQTBasePlotter sender 
)
protectedslot

called whenever the zoom changes in plotter

◆ reactGraphVisible

void JKQTPlotter::reactGraphVisible ( bool  visible)
protectedslot

called from a menu entry that encodes the graph ID

◆ redrawPlot

void JKQTPlotter::redrawPlot ( )
slot

update the plot and the overlays

◆ registerMouseDoubleClickAction()

void JKQTPlotter::registerMouseDoubleClickAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifier,
JKQTPMouseDoubleClickActions  action 
)

registeres a certain mouse action action to be executed when a mouse double-click occurs with the given button and modifier

◆ registerMouseDragAction()

void JKQTPlotter::registerMouseDragAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifier,
JKQTPMouseDragActions  action 
)

registeres a certain mouse drag action action to be executed when a mouse drag operation is initialized with the given button and modifier

◆ registerMouseMoveAction()

void JKQTPlotter::registerMouseMoveAction ( Qt::KeyboardModifiers  modifier,
JKQTPMouseMoveActions  action 
)

specifies the action to perform on a mouse move event when a given modifier is pressed

See also
deregisterMouseMoveAction(), clearAllMouseMoveActions(), Mouse-Interaction in JKQTPlotter

◆ registerMouseWheelAction()

void JKQTPlotter::registerMouseWheelAction ( Qt::KeyboardModifiers  modifier,
JKQTPMouseWheelActions  action 
)

specifies the action to perform on a mouse wheel event when a given modifier is pressed

See also
deregisterMouseWheelAction(), clearAllMouseWheelActions(), Mouse-Interaction in JKQTPlotter

◆ resetContextMenu()

void JKQTPlotter::resetContextMenu ( bool  createnew = true)
protected

destroys the internal contextMenu and optionally creates a new one

Parameters
createnewif ==true, contextMenu is reinitialized with a (shiny) new QMenu, otherwise it is set to nullptr after destroying the old menu.
See also
initContextMenu(), contextMenuMode

◆ resetCurrentMouseDragAction()

void JKQTPlotter::resetCurrentMouseDragAction ( )
protected

resets the currently activated mouse drag action, e.g. called by mouseReleaseEvent()

◆ resetMasterSynchronization()

void JKQTPlotter::resetMasterSynchronization ( JKQTBasePlotter::SynchronizationDirection  synchronizeDirection = JKQTBasePlotter::sdXYAxes)

switches any synchronization off, that has been created by synchronizeToMaster()

Note
This function internally calls JKQTBasePlotter::synchronizeToMaster()
See also
synchronizeToMaster(), synchronizeXToMaster(), resetMasterSynchronization(), Synchronizing Several Plots

◆ resetMouseLeftAction

void JKQTPlotter::resetMouseLeftAction ( )
protectedslot

resets any previously set override action for the left mouse-button, un-modified

See also
setMouseLeftActionAsRuler(), setMouseLeftActionAsToolTip()

◆ resetOverrideMouseDragAction()

void JKQTPlotter::resetOverrideMouseDragAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifiers 
)
protected

removes a previously set override mouse drag action for the given button/modifiers combination

See also
setOverrideMouseDragAction(), resetOverrideMouseDragAction(), registeredOverrideMouseDragActionModes

◆ resizeEvent()

void JKQTPlotter::resizeEvent ( QResizeEvent *  event)
overrideprotected

resizes the internal representation (image) of the graphs

◆ rulerDisplayed

void JKQTPlotter::rulerDisplayed ( double  x1,
double  y1,
double  x2,
double  y2,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when a new ruler between two points is displayed

Parameters
x1x-coordinate of the start of the line (in plot coordinates)
y1y-coordinate of the start of the line (in plot coordinates)
x2x-coordinate of the end of the line (in plot coordinates)
y2y-coordinate of the end of the line (in plot coordinates)
modifierskey-modifiers when the rectangle was finished

◆ saveAsCSV

void JKQTPlotter::saveAsCSV ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a Comma Separated Values (CSV) file

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown

This method uses JKQTBasePlotterStyle::CSVdecimalSeparator as decimal separator and JKQTBasePlotterStyle::CSVcommentInitializer as comment initializer!

◆ saveAsDIF

void JKQTPlotter::saveAsDIF ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a Data Interchange Format file (see https://en.wikipedia.org/wiki/Data_Interchange_Format).

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown
See also
saveData()

◆ saveAsGerExcelCSV

void JKQTPlotter::saveAsGerExcelCSV ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a Semicolon Separated Values (CSV) file for german Excel, i.e. with comma as decimal separator

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown

example output:

# x, y
0, 0
0,251327; 0,24869
0,502655; 0,481754
...
See also
saveData(), saveAsSemicolonSV()

◆ saveAsMatlab

void JKQTPlotter::saveAsMatlab ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a Matlab Script

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown

example output:

% data from columne 1 ('x')
x = [ 0 0.251327 0.502655 ... ];
% data from columne 2 ('y')
y = [ 0 0.24869 0.481754 ... ];
See also
copyDataMatlab(), saveData()

◆ saveAsPDF

bool JKQTPlotter::saveAsPDF ( const QString &  filename = QString(""),
bool  displayPreview = true 
)
inlineslot

save the current plot as a PDF file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed

Parameters
filenamethe filename to save to, if empty a file save dialog is displayed
displayPreviewif true, a save/print-preview dialog is displayed that allows to make some modifications to the generated image, otherwise the image is saved with default settings.
Returns
Returns true if the file was save successfully
Note
Exporting to PDF requires QPrinter-support, if it is not available on your platform, this function will not be available either!

◆ saveAsPixelImage

bool JKQTPlotter::saveAsPixelImage ( const QString &  filename = QString(""),
bool  displayPreview = true,
const QByteArray &  outputFormat = QByteArray(),
const QSize &  outputSizeIncrease = QSize(0,0) 
)
inlineslot

save the current plot as a pixel image image (PNG ...), if filename is empty a file selection dialog is displayed

Parameters
filenamename of the stored file, if no outputFormat is given, the file format is deduced by the file extension in filename
displayPreviewif true a dialog is shown that allows to modify the generated output (zoo, scaling, ...)
outputFormatspecify the file format for the generated file
outputSizeIncreaseif given, the size of the generated pixel image is increased by this number of pixels in addition to the required space
Returns
returns true on success

This function may generate any pixel-graphics format, supported by Qt and listed in QImageWriter::supportedImageFormats(). The parameters are comparable to the standard Qt functions like QImage::save(), which is also used internally.

See also
grabPixelImage(), copyPixelImage()

◆ saveAsSemicolonSV

void JKQTPlotter::saveAsSemicolonSV ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a Semicolon Separated Values (SSV) file

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown

example output:

# x, y
0; 0
0.251327; 0.24869
0.502655; 0.481754
...

This method uses JKQTBasePlotterStyle::CSVdecimalSeparator as decimal separator and JKQTBasePlotterStyle::CSVcommentInitializer as comment initializer!

◆ saveAsSVG

bool JKQTPlotter::saveAsSVG ( const QString &  filename = QString(""),
bool  displayPreview = true 
)
inlineslot

save the current plot as a SVG file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed

Parameters
filenamethe filename to save to, if empty a file save dialog is displayed
displayPreviewif true, a save/print-preview dialog is displayed that allows to make some modifications to the generated image, otherwise the image is saved with default settings.
Returns
Returns true if the file was save successfully
Note
Exporting to SVG requires QPrinter-support, if it is not available on your platform, this function will not be available either!

◆ saveAsSYLK

void JKQTPlotter::saveAsSYLK ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a SYmbolik LinK (SYLK) spreadsheet file (see https://en.wikipedia.org/wiki/Symbolic_Link_(SYLK) )

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown
See also
saveData()

◆ saveAsTabSV

void JKQTPlotter::saveAsTabSV ( const QString &  filename = QString(""))
inlineslot

save the current plot data as a Tabulator Separated Values (CSV) file

Parameters
filenamethe file to save to, if filename is empty, a file open dialog will be shown

example output:

# x y
0 0
0.251327 0.24869
0.502655 0.481754
...

This method uses JKQTBasePlotterStyle::CSVdecimalSeparator as decimal separator and JKQTBasePlotterStyle::CSVcommentInitializer as comment initializer!

See also
saveData()

◆ saveCurrentPlotterStyle()

void JKQTPlotter::saveCurrentPlotterStyle ( QSettings &  settings,
const QString &  group = "plots/",
bool  alsoSaveBaseStyle = true 
) const

store the current style properties for this JKQTBasePlotter with properties loaded from settings

Parameters
settingsthe QSettings object to write to
groupgroup in settings to write to
alsoSaveBaseStyleif true, then also JKQTBasePlotter::saveCurrentPlotterStyle() of the internal JKQTBasePlotter is called
See also
JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), Styling System

◆ saveData

void JKQTPlotter::saveData ( const QString &  filename = QString(""),
const QString &  format = QString("") 
)
inlineslot

save the data used for the current plot. The file format is extracted from the file extension (csv, ...)

Parameters
filenamethe filename to save to, if empty a file save dialog is displayed
formatThe parameter format specifies the export format. if it is empty the format will be choosen according to the file extension, or if filename is also empty the format will be choosen according to what is selected in the file selection dialog. See below for a listing of supported values.
Returns
returns true if the data was exported successfully.

These values are supported for format (if format is not provided, the function tries to guess it from the file extensions liste below):

In addition you can use the custom exporters implemented as JKQTPSaveDataAdapter and registered using JKQTBasePlotter::registerSaveDataAdapter(). For these you need to use format = "customN", where N is the index of the exporter in the list of registered exporters.

◆ saveImage

bool JKQTPlotter::saveImage ( const QString &  filename = QString(""),
bool  displayPreview = true 
)
inlineslot

save the current plot as an image file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed. The image format is extracted from the file extension (jpeg, tiff, png, pdf, ...)

Parameters
filenamethe filename to save to, if empty a file save dialog is displayed
displayPreviewif true, a save/print-preview dialog is displayed that allows to make some modifications to the generated image, otherwise the image is saved with default settings.
Returns
Returns true if the file was save successfully

This function is comparable to saveAsPixelImage(), but it allows to save into any graphics format, including SVG and PF (if printer-support is compiled into the library). Also it may use the custom exporters implemented as JKQTPPaintDeviceAdapter and registered via JKQTBasePlotter::registerPaintDeviceAdapter().

See also
grabPixelImage(), copyPixelImage(), saveAsPixelImage(), JKQTBasePlotter::registerPaintDeviceAdapter(), JKQTPPaintDeviceAdapter

◆ saveSettings()

void JKQTPlotter::saveSettings ( QSettings &  settings,
const QString &  group = QString("plots/") 
) const

saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object.

This method only saves those properties that differ from their default value.

◆ setAbsoluteX

void JKQTPlotter::setAbsoluteX ( double  xminn,
double  xmaxx 
)
inlineslot

sets absolutely limiting x-range of the plot

The user (or programmer) cannot zoom to a viewport that is larger than the range given to this function. This is implemented by calling JKQTPCoordinateAxis::setAbsoluteRange() for the major x-axes!

Parameters
xminnabsolute minimum of x-axis
xmaxxabsolute maximum of x-axis
Note
if the aspect ratio of this does not fit into the widget, it is possible that you don't see the complete contents!
See also
setAbsoluteXY(), setAbsoluteY(), JKQTPCoordinateAxis::setAbsoluteRange()

◆ setAbsoluteXY

void JKQTPlotter::setAbsoluteXY ( double  xminn,
double  xmaxx,
double  yminn,
double  ymaxx 
)
inlineslot

sets absolutely limiting x- and y-range of the plot

The user (or programmer) cannot zoom to a viewport that is larger than the range given to this function. This is implemented by calling JKQTPCoordinateAxis::setAbsoluteRange() for the major axes!

Parameters
xminnabsolute minimum of x-axis
xmaxxabsolute maximum of x-axis
yminnabsolute minimum of y-axis
ymaxxabsolute maximum of y-axis
Note
if the aspect ratio of this does not fit into the widget, it is possible that you don't see the complete contents!
See also
setAbsoluteX(), setAbsoluteY(), JKQTPCoordinateAxis::setAbsoluteRange()

◆ setAbsoluteY

void JKQTPlotter::setAbsoluteY ( double  yminn,
double  ymaxx 
)
inlineslot

sets absolute minimum and maximum y-value to plot

The user (or programmer) cannot zoom to a viewport that is larger than the range given to this function. This is implemented by calling JKQTPCoordinateAxis::setAbsoluteRange() for the major y-axes!

Parameters
yminnabsolute minimum of y-axis
ymaxxabsolute maximum of y-axis
Note
if the aspect ratio of this does not fit into the widget, it is possible that you don't see the complete contents!
See also
setAbsoluteXY(), setAbsoluteX(), JKQTPCoordinateAxis::setAbsoluteRange()

◆ setContextMenuMode

void JKQTPlotter::setContextMenuMode ( JKQTPContextMenuModes  mode)
slot

◆ setCurrentPlotterStyle() [1/2]

void JKQTPlotter::setCurrentPlotterStyle ( const JKQTPlotterStyle style)

◆ setCurrentPlotterStyle() [2/2]

void JKQTPlotter::setCurrentPlotterStyle ( const JKQTPlotterStyle style,
const JKQTBasePlotterStyle baseStyle 
)

◆ setEmittingSignalsEnabled()

void JKQTPlotter::setEmittingSignalsEnabled ( bool  sig)
inline

specifies whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate()

◆ setGlobalResizeDelay()

static void JKQTPlotter::setGlobalResizeDelay ( int  delayMS)
static

sets the global resize delay in milliseconds delayMS. After calling this function all plots will use the new delay. Setting the the delay to 0 disables the delayed resize feature. This function is thread-safe!

See also
jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer

◆ setGrid

void JKQTPlotter::setGrid ( bool  val)
inlineslot

sets whether the major grid lines of the major axes are shown

Grid visible
Grid invisible
See also
JKQTPCoordinateAxis::setDrawGrid() and JKQTPGridStyle::enabled in JKQTPCoordinateAxisStyle::majorGridStyle

◆ setGridColor

void JKQTPlotter::setGridColor ( QColor  color)
inlineslot

sets the color of all major grid lines (of the major x- and y-axis)

See also
JKQTPCoordinateAxis::setGridColor() and JKQTPGridStyle::lineColor in JKQTPCoordinateAxisStyle::majorGridStyle

◆ setGridPrinting()

void JKQTPlotter::setGridPrinting ( bool  enabled)

◆ setGridPrintingCurrentPos()

void JKQTPlotter::setGridPrintingCurrentPos ( size_t  x,
size_t  y 
)

◆ setGridPrintingCurrentX()

void JKQTPlotter::setGridPrintingCurrentX ( size_t  x)

◆ setGridPrintingCurrentY()

void JKQTPlotter::setGridPrintingCurrentY ( size_t  y)

◆ setGridStyle

void JKQTPlotter::setGridStyle ( Qt::PenStyle  __value)
inlineslot

sets the style of all Major grid lines

◆ setGridWidth

void JKQTPlotter::setGridWidth ( double  __value)
inlineslot

sets the width of all Major grid lines

◆ setMagnification

void JKQTPlotter::setMagnification ( double  m)
slot

set the current plot magnification

◆ setMaxTooltipDistance

void JKQTPlotter::setMaxTooltipDistance ( int  v)
slot

maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed


◆ setMinorGridColor

void JKQTPlotter::setMinorGridColor ( QColor  color)
inlineslot

sets the color of all minor grid lines

◆ setMinorGridStyle

void JKQTPlotter::setMinorGridStyle ( Qt::PenStyle  __value)
inlineslot

sets the style of all minor grid lines

◆ setMinorGridWidth

void JKQTPlotter::setMinorGridWidth ( double  __value)
inlineslot

sets the width of all minor grid lines

◆ setMouseActionToolbarActionsActive

void JKQTPlotter::setMouseActionToolbarActionsActive ( bool  __value)
slot

allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions

See also
getActMouseLeftAsDefault(), getActMouseLeftAsRuler(), getActMouseLeftAsToolTip()

◆ setMouseLeftActionAsPanView

void JKQTPlotter::setMouseLeftActionAsPanView ( )
protectedslot

action that activates the pan viewport tool

See also
resetMouseLeftAction(), setMouseLeftActionAsToolTip()

◆ setMouseLeftActionAsRuler

void JKQTPlotter::setMouseLeftActionAsRuler ( )
protectedslot

action that activates the ruler tool

See also
resetMouseLeftAction(), setMouseLeftActionAsToolTip()

◆ setMouseLeftActionAsZoomRect

void JKQTPlotter::setMouseLeftActionAsZoomRect ( )
protectedslot

action that activates the zoom rectangle tool

See also
resetMouseLeftAction(), setMouseLeftActionAsToolTip()

◆ setMouseLeftDragActionAsToolTip

void JKQTPlotter::setMouseLeftDragActionAsToolTip ( )
protectedslot

action that activates the tooltip tool, when dragging the mouse with the left button pressed

See also
resetMouseLeftAction()

◆ setMouseMoveActionAsToolTip

void JKQTPlotter::setMouseMoveActionAsToolTip ( bool  enabled)
protectedslot

action that (de)activates the tooltip tool, when moving the mouse without any button pressed

See also
setMouseLeftActionAsRuler(), resetMouseLeftAction()

◆ setMousePositionShown

void JKQTPlotter::setMousePositionShown ( bool  __value)
slot

specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the top border, so the position fits in. The default widget font is used for the output.

See also
mousePositionTemplate, Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter, Mouse Move Signaling and Actions
isMousePositionShown(), JKQTPlotterStyle::displayMousePosition, Mouse Move Signaling and Actions

◆ setOverrideMouseDragAction()

void JKQTPlotter::setOverrideMouseDragAction ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifiers,
JKQTPMouseDragActions  action 
)
protected

sets an override mouse drag action for the given button/modifiers combination

See also
setOverrideMouseDragAction(), resetOverrideMouseDragAction(), registeredOverrideMouseDragActionModes

◆ setPlotUpdateEnabled()

void JKQTPlotter::setPlotUpdateEnabled ( bool  enable)

sets whether automatic redrawing the plot is currently activated (e.g. you can sett his to false while performing major updates on the plot)

See also
isPlotUpdateEnabled()

◆ setShowZeroAxes [1/2]

void JKQTPlotter::setShowZeroAxes ( bool  showX,
bool  showY 
)
inlineslot

switches the visibility of the zero-axes associated with the x- and y-axis

Parameters
showXindicates whether to show the zero-axis associated with the x-axis (i.e. x==0 or the vertical zero-axis)
showYindicates whether to show the zero-axis associated with the y-axis (i.e. y==0 or the horizontal zero-axis)

◆ setShowZeroAxes [2/2]

void JKQTPlotter::setShowZeroAxes ( bool  showXY)
inlineslot

switches the visibility of the zero-axes associated with the major x- and y-axis

Parameters
showXindicates whether to show the zero-axis associated with the x-axis (i.e. x==0 or the vertical zero-axis)
showYindicates whether to show the zero-axis associated with the y-axis (i.e. y==0 or the horizontal zero-axis)
See also
JKQTPCoordinateAxis::showZeroAxis() and JKQTPCoordinateAxisStyle::showZeroAxis

◆ setSpecialContextMenu()

void JKQTPlotter::setSpecialContextMenu ( QMenu *  menu)

◆ setToolbarAlwaysOn

void JKQTPlotter::setToolbarAlwaysOn ( bool  __value)
slot

returns whether the toolbar is always visible or only when the mouse moves to the upper left area

If toolbarAlwaysOn is set to true:

If toolbarAlwaysOn is set to false, the toolbar only appears when the mouse is in the right location:

Hidden Toolbar
Shown Toolbar
See also
toolbarEnabled, Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter
isToolbarAlwaysOn(), JKQTPlotterStyle::toolbarAlwaysOn

◆ setToolbarEnabled

void JKQTPlotter::setToolbarEnabled ( bool  __value)
slot

◆ setToolbarIconSize()

void JKQTPlotter::setToolbarIconSize ( int  value)

set the width/height of the icons in the toolbar in pt

◆ setUserActionCatchSensitivity

void JKQTPlotter::setUserActionCatchSensitivity ( int  v)
slot

sensitivity (i.e. max. distance to see as one point) for user actions


◆ setUserActionMarkerBrush

void JKQTPlotter::setUserActionMarkerBrush ( const QBrush &  __value)
slot

◆ setUserActionMarkerDiameter

void JKQTPlotter::setUserActionMarkerDiameter ( int  v)
slot

size (diameter) of markers drawn by user actions


◆ setUserActionMarkerPen

void JKQTPlotter::setUserActionMarkerPen ( const QPen &  __value)
slot

◆ setUserActionMarkerType

void JKQTPlotter::setUserActionMarkerType ( JKQTPUserActionMarkerType  v)
slot

type of the location markers of user actions on the plot

See also
Actions When Dragging the Mouse

◆ setUserActionOpaqueBrush

void JKQTPlotter::setUserActionOpaqueBrush ( const QBrush &  __value)
slot

pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)

See also
Actions When Dragging the Mouse
setUserActionOpaqueBrush(), getUserActionOpaqueBrush(), JKQTPlotterStyle::userActionOpaqueBrush Actions When Dragging the Mouse

◆ setUserActionOpaquePen

void JKQTPlotter::setUserActionOpaquePen ( const QPen &  __value)
slot

pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)

See also
Actions When Dragging the Mouse
setUserActionOpaquePen(), getUserActionOpaquePen(), JKQTPlotterStyle::userActionOpaquePen Actions When Dragging the Mouse

◆ setUserActionOverlayBrush

void JKQTPlotter::setUserActionOverlayBrush ( const QBrush &  __value)
slot

pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)

See also
Actions When Dragging the Mouse
setUserActionOverlayBrush(), getUserActionOverlayBrush(), JKQTPlotterStyle::userActionOverlayBrush Actions When Dragging the Mouse

◆ setUserActionOverlayPen

void JKQTPlotter::setUserActionOverlayPen ( const QPen &  __value)
slot

pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)

See also
Actions When Dragging the Mouse
setUserActionOverlayPen(), getUserActionOverlayPen(), JKQTPlotterStyle::userActionOverlayPen Actions When Dragging the Mouse

◆ setX

void JKQTPlotter::setX ( double  xminn,
double  xmaxx 
)
inlineslot

sets the x-range of the plot (minimum and maximum x-value on the x-axis)

Parameters
xminnabsolute minimum of x-axis
xmaxxabsolute maximum of x-axis
affectsSecondaryAxesif true, the secondary axes are affectedtoo, by using a relative zooming scheme, i.e. if a major axis range shrinks by 50%, also the secondary ranges shrink by 50% [default: false]
Note
You cannot expand the x-range outside the absolute x-range set e.g. by setAbsoluteX()! Also the range will be limited to possible values (e.g. to positive values if you use logarithmic axes).

Uppon setting, this function emits the signal zoomChangedLocally(), if emitting signals is activated at the moment (e.g. using setEmittingSignalsEnabled() ).

See also
setY(), setXY(), zoomToFit(), setAbsoluteXY(), JKQTPlotter::setY()

◆ setXY

void JKQTPlotter::setXY ( double  xminn,
double  xmaxx,
double  yminn,
double  ymaxx,
bool  affectsSecondaryAxes = false 
)
inlineslot

sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)

Parameters
xminnabsolute minimum of x-axis
xmaxxabsolute maximum of x-axis
yminnabsolute minimum of y-axis
ymaxxabsolute maximum of y-axis
affectsSecondaryAxesif true, the secondary axes are affectedtoo, by using a relative zooming scheme, i.e. if a major axis range shrinks by 50%, also the secondary ranges shrink by 50% [default: false]
Note
You cannot expand the ranges outside the absolute ranges set e.g. by setAbsoluteXY()! Also the range will be limited to possible values (e.g. to positive values if you use logarithmic axes).

Uppon setting, this function emits the signal zoomChangedLocally(), if emitting signals is activated at the moment (e.g. using setEmittingSignalsEnabled() ).

See also
setX(), setX(), zoomToFit(), setAbsoluteXY()

◆ setY

void JKQTPlotter::setY ( double  yminn,
double  ymaxx 
)
inlineslot

sets the y-range of the plot (minimum and maximum y-value on the y-axis)

Parameters
yminnabsolute minimum of y-axis
ymaxxabsolute maximum of y-axis
affectsSecondaryAxesif true, the secondary axes are affectedtoo, by using a relative zooming scheme, i.e. if a major axis range shrinks by 50%, also the secondary ranges shrink by 50% [default: false]
Note
You cannot expand the y-range outside the absolute y-range set e.g. by setAbsoluteY()! Also the range will be limited to possible values (e.g. to positive values if you use logarithmic axes).

Uppon setting, this function emits the signal zoomChangedLocally(), if emitting signals is activated at the moment (e.g. using setEmittingSignalsEnabled() ).

See also
setX(), setXY(), zoomToFit(), setAbsoluteXY(), JKQTPlotter::setX()

◆ sizeHint()

QSize JKQTPlotter::sizeHint ( ) const
override

returns the size of the widget

◆ sortGraphs()

void JKQTPlotter::sortGraphs ( const std::function< bool(const JKQTPPlotElement *, const JKQTPPlotElement *)> &  compareLess)
inline

sort the graphs, using functor compareLess to find whether a first graph shall be before (i.e. less) than a second graph. After completing the operation, the graph is updated

◆ synchronizeToMaster()

void JKQTPlotter::synchronizeToMaster ( JKQTPlotter master,
JKQTBasePlotter::SynchronizationDirection  synchronizeDirection,
bool  synchronizeAxisLength = true,
bool  synchronizeZoomingMasterToSlave = true,
bool  synchronizeZoomingSlaveToMaster = true 
)

synchronize the plot borders (and zooming) with a given plotter (master --> slave/this)

This function allows two plotters to draw a graph with exactly the same height or width as in another graph. For example if you want to have two plotters which are positioned one above the other (and have the same widget widths, which could be guaranteed by a QLayout) you may want to make sure that their plotWidth s are always the same. In this case call

plotter2->synchronizeToMaster(plotter1, sdXAxis, true)

of the lower plotter plotter2 . Now whenever the size of plotter1 changes, also plotter2 is redrawn with the changed borders.

Different Synchronization Settings for synchronizeDirection=sdXAxis
Parameters
masterthe plotter widget to synchronize to
synchronizeDirectiondirection in which to synchronize
synchronizeAxisLengthdo you want the axis length to be synchronized?
synchronizeZoomingMasterToSlaveif set, also zooming in the master leads to a modification of the linked axes in the slave
synchronizeZoomingSlaveToMasterif set, also zooming in the slave leads to a modification of the linked axes in the master
See also
synchronizeXToMaster(), synchronizeYToMaster(), resetMasterSynchronization(), Synchronizing Several Plots

◆ synchronizeXAxis

void JKQTPlotter::synchronizeXAxis ( double  newxmin,
double  newxmax,
double  newymin,
double  newymax,
JKQTPlotter sender 
)
slot

may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the other x-axis

See also
Synchronizing Several Plots

◆ synchronizeXToMaster()

void JKQTPlotter::synchronizeXToMaster ( JKQTPlotter master,
bool  synchronizeAxisLength = true,
bool  synchronizeZoomingMasterToSlave = true,
bool  synchronizeZoomingSlaveToMaster = true 
)

synchronize the plot x-axis width (and x-zooming) with a given master plotter (master --> slave/this)

Parameters
masterthe plotter widget to synchronize to
synchronizeAxisLengthdo you want the axis length to be synchronized?
synchronizeZoomingMasterToSlaveif set, also zooming in the master leads to a modification of the linked axes in the slave
synchronizeZoomingSlaveToMasterif set, also zooming in the slave leads to a modification of the linked axes in the master
Different Synchronization Settings for synchronizeDirection=sdXAxis
Note
This is a short-cut to synchronizeToMaster() with synchronizeDirection=csXAxis
See also
synchronizeToMaster(), synchronizeYToMaster(), resetMasterSynchronization(), Synchronizing Several Plots

◆ synchronizeXYAxis

void JKQTPlotter::synchronizeXYAxis ( double  newxmin,
double  newxmax,
double  newymin,
double  newymax,
JKQTPlotter sender 
)
slot

may be connected to zoomChangedLocally() of a different plot and synchronizes the local x- and y-axis to the other x- and y-axis

See also
Synchronizing Several Plots

◆ synchronizeYAxis

void JKQTPlotter::synchronizeYAxis ( double  newxmin,
double  newxmax,
double  newymin,
double  newymax,
JKQTPlotter sender 
)
slot

may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the other y-axis

See also
Synchronizing Several Plots

◆ synchronizeYToMaster()

void JKQTPlotter::synchronizeYToMaster ( JKQTPlotter master,
bool  synchronizeAxisLength = true,
bool  synchronizeZoomingMasterToSlave = true,
bool  synchronizeZoomingSlaveToMaster = true 
)

synchronize the plot y-axis height (and y-zooming) with a given master plotter (master --> slave/this)

Parameters
masterthe plotter widget to synchronize to
synchronizeAxisLengthdo you want the axis length to be synchronized?
synchronizeZoomingMasterToSlaveif set, also zooming in the master leads to a modification of the linked axes in the slave
synchronizeZoomingSlaveToMasterif set, also zooming in the slave leads to a modification of the linked axes in the master
Note
This function internally calls JKQTBasePlotter::synchronizeToMaster()
This is a short-cut to synchronizeToMaster() with synchronizeDirection=csXAxis
See also
synchronizeToMaster(), synchronizeXToMaster(), resetMasterSynchronization(), Synchronizing Several Plots

◆ tooltipDisplayed

void JKQTPlotter::tooltipDisplayed ( double  x,
double  y,
const QStringList &  entries,
const QList< JKQTPPlotElement * > &  graphs 
)
signal

emitted when a tooltip for a datapoint is displayed

Parameters
xx-coordinate of the center of the marked datapoint (in plot coordinates)
yy-coordinate of the center of the marked datapoint (in plot coordinates)
entriescontents of the tooltip
graphsgraph objects that created the entries

◆ updateCursor()

void JKQTPlotter::updateCursor ( )
protected

set the current mouse cursor shappe according to currentMouseDragAction

◆ updateToolbar()

void JKQTPlotter::updateToolbar ( )
protected

update settings of the toolbar

◆ updateToolbarActions()

void JKQTPlotter::updateToolbarActions ( )

reinitializes the toolbar, i.e. fills in QActions added to the QWidget since its creation/the last call to this function

◆ useAsInternalDatastore()

void JKQTPlotter::useAsInternalDatastore ( JKQTPDatastore newStore)
inline

tells the plotter object to use the given external datastore and treat it as an internal one (i.e. free it when the plotter object ist destroyed.

◆ useExternalDatastore()

void JKQTPlotter::useExternalDatastore ( JKQTPDatastore newStore)
inline

tells the plotter object to use the given external datastore.

If the current datastore is internally managed, this method will free that object and use the supplied datastore with external management. If the current datastore is already external, this method will simply replace it by the new one.

◆ useInternalDatastore()

void JKQTPlotter::useInternalDatastore ( )
inline

tells the plotter object to use an internal datastore. A new internal datastore object is generated only if the current datastore is not internal.

◆ userCircleFinished

void JKQTPlotter::userCircleFinished ( double  x,
double  y,
double  radius,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when the mouse action JKQTPlotter::CircleEvents and the drawing of the new circle is finished (=mouse key released)

Parameters
xx-coordinate of the center of the circle (in plot coordinates)
yy-coordinate of the center of the circle (in plot coordinates)
radiusradius of the circle (in plot coordinates)
modifierskey-modifiers when the rectangle was finished

◆ userEllipseFinished

void JKQTPlotter::userEllipseFinished ( double  x,
double  y,
double  radiusX,
double  radiusY,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when the mouse action JKQTPlotter::EllipseEvents and the drawing of the new ellipse is finished (=mouse key released)

Parameters
xx-coordinate of the center of the ellipse (in plot coordinates)
yy-coordinate of the center of the ellipse (in plot coordinates)
radiusXhalf-axis in x-direction of the ellipse (in plot coordinates)
radiusYhalf-axis in y-direction of the ellipse (in plot coordinates)
modifierskey-modifiers when the rectangle was finished

◆ userLineFinished

void JKQTPlotter::userLineFinished ( double  x1,
double  y1,
double  x2,
double  y2,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when the mouse action JKQTPlotter::LineEvents and the drawing of the new line is finished (=mouse key released)

Parameters
x1x-coordinate of the start of the line (in plot coordinates)
y1y-coordinate of the start of the line (in plot coordinates)
x2x-coordinate of the end of the line (in plot coordinates)
y2y-coordinate of the end of the line (in plot coordinates)
modifierskey-modifiers when the rectangle was finished

◆ userRectangleFinished

void JKQTPlotter::userRectangleFinished ( double  x,
double  y,
double  width,
double  height,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when the mouse action JKQTPlotter::RectangleEvents and the drawing of the new rectangle is finished (=mouse key released)

Parameters
xx-coordinate of the bottom left corner of the rectangle (in plot coordinates)
yy-coordinate of the bottom left corner of the rectangle (in plot coordinates)
widthwidth of the rectangle (in plot coordinates)
heightheight of the rectangle (in plot coordinates)
modifierskey-modifiers when the rectangle was finished

◆ userScribbleClick

void JKQTPlotter::userScribbleClick ( double  x,
double  y,
Qt::KeyboardModifiers  modifiers,
bool  first,
bool  last 
)
signal

emitted when the mouse action JKQTPlotter::ScribbleEvents and a click event from the mouse occurs inside the plot, or the mouse moved while the left button is pressed down

Parameters
xx-position of the mouse (in plot coordinates)
yy-position of the mouse (in plot coordinates)
modifierskey-modifiers when the event was generated
firstif true: this is the first event of a series that starts with pressing the mouse-button down, within the series, this is false
lastif true: this is the last event of a series that ends when releasing the mouse-button, within the series, this is false

◆ wheelEvent()

void JKQTPlotter::wheelEvent ( QWheelEvent *  event)
overrideprotected

event handler for a turn of the mouse wheel

Executes the user action defined for the mouse wheel.

See also
registerMouseWheelAction(), deregisterMouseWheelAction(), registeredMouseWheelActions

◆ widgetResized

void JKQTPlotter::widgetResized ( int  new_width,
int  new_height,
JKQTPlotter sender 
)
signal

signal: emitted whenever the widget is resized

Parameters
new_widthnew width of the widget (in pixels)
new_heightnew height of the widget (in pixels)
senderJKQTPlotter sending this event

This signal is designed to be connected to these Q_SLOTS: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis()

◆ zoom

void JKQTPlotter::zoom ( double  xminn,
double  xmaxn,
double  yminn,
double  ymaxn,
bool  affectsSecondaryAxes = false 
)
inlineslot

sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)

Parameters
xminnabsolute minimum of x-axis
xmaxxabsolute maximum of x-axis
yminnabsolute minimum of y-axis
ymaxxabsolute maximum of y-axis
affectsSecondaryAxesif true, the secondary axes are affectedtoo, by using a relative zooming scheme, i.e. if a major axis range shrinks by 50%, also the secondary ranges shrink by 50% [default: false]
Note
You cannot expand the ranges outside the absolute ranges set e.g. by setAbsoluteXY()! Also the range will be limited to possible values (e.g. to positive values if you use logarithmic axes).

Uppon setting, this function emits the signal zoomChangedLocally(), if emitting signals is activated at the moment (e.g. using setEmittingSignalsEnabled() ).

See also
setX(), setX(), zoomToFit(), setAbsoluteXY()
Deprecated:
The function JKQTBasePlotter::zoom() is deprecated and will be removed in future version, use JKQTBasePlotter::setXY() instead!
Deprecated:
The function JKQTPlotter::zoom() is deprecated and will be removed in future version, use JKQTPlotter::setXY() instead!

◆ zoomChangedLocally

void JKQTPlotter::zoomChangedLocally ( double  newxmin,
double  newxmax,
double  newymin,
double  newymax,
JKQTPlotter sender 
)
signal

signal: emitted whenever the user selects a new x-y zoom range (by mouse)

Parameters
newxminstart of the selected x-range (in plot coordinates)
newxmaxend of the selected x-range (in plot coordinates)
newyminstart of the selected x-range (in plot coordinates)
newymaxend of the selected x-range (in plot coordinates)
senderJKQTPlotter sending this event

This signal is designed to be connected to these Q_SLOTS: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis()

◆ zoomIn

void JKQTPlotter::zoomIn ( double  factor = 2.0)
inlineslot

zooms into the graph (the same as turning the mouse wheel) by the given factor

◆ zoomOut

void JKQTPlotter::zoomOut ( double  factor = 2.0)
inlineslot

zooms out of the graph (the same as turning the mouse wheel) by the given factor

◆ zoomToFit

void JKQTPlotter::zoomToFit ( bool  zoomX = true,
bool  zoomY = true,
bool  includeX0 = false,
bool  includeY0 = false,
double  scaleX = 1.05,
double  scaleY = 1.05 
)
inlineslot

this method zooms the graph so that all plotted datapoints are visible.

Parameters
zoomXif set true (default) zooms the x axis
zoomYif set true (default) zooms the y axis
includeX0if this is true zoomToFit() will ensure that $ x=0 $ is visible in the plot (only for non-logx plots, default: false)
includeY0if this is true zoomToFit() will ensure that $ y=0 $ is visible in the plot (only for non-logy plots, default: false)
scaleXthe plot will have a width of $ \mbox{Xscale}\cdot\Delta x $ where $ \Delta x $ is the actual x-axis data range For logx plots we actually use this on the logarithmized data! (default: 1.05)
scaleYthe plot will have a height of $ \mbox{Yscale}\cdot\Delta < $ where $ \Delta < $ is the actual <-axis data range For log< plots we actually use this on the logarithmized data! (default: 1.05)

Member Data Documentation

◆ actgrpMouseLeft

QActionGroup* JKQTPlotter::actgrpMouseLeft
protected

action group, that groups the actMouseLeft... actions

◆ actMouseLeftAsDefault

QAction* JKQTPlotter::actMouseLeftAsDefault
protected

action that activates the default action, set in plotterStyle!

◆ actMouseLeftAsPanView

QAction* JKQTPlotter::actMouseLeftAsPanView
protected

action that activates the pan view tool (override!)

◆ actMouseLeftAsRuler

QAction* JKQTPlotter::actMouseLeftAsRuler
protected

action that activates the ruler tool (override!)

◆ actMouseLeftAsZoomRect

QAction* JKQTPlotter::actMouseLeftAsZoomRect
protected

action that activates the zoom rectangle tool (override!)

◆ actMouseMoveToolTip

QAction* JKQTPlotter::actMouseMoveToolTip
protected

action that activates the tooltip tool (override!)

◆ contextMenu

QMenu* JKQTPlotter::contextMenu
protected

the context menu object used by this JKQTPlotter

Note
this might be ==nullptr occasionally, therefore you need to check it, before accessing it!
See also
Context Menu of JKQTPlotter , resetContextMenu(), initContextMenu(), contextMenuMode

◆ contextMenuMode

JKQTPContextMenuModes JKQTPlotter::contextMenuMode
protected

current mode for the default context menu (i.e. the right-click context menu)

See also
Context Menu of JKQTPlotter

◆ contextSubMenus

QList<QMenu*> JKQTPlotter::contextSubMenus
protected

internal storage for sub-menu entries of the internal contextMenu object, based on the actions returned by JKQTBasePlotter::getLstAdditionalPlotterActions()

◆ currentMouseDragAction

MouseDragAction JKQTPlotter::currentMouseDragAction
protected

the currently executed MouseDragAction

◆ currentMouseMoveAction

QSet<JKQTPMouseMoveActions> JKQTPlotter::currentMouseMoveAction
protected

the currently executed MouseMoveActions

◆ doDrawing

bool JKQTPlotter::doDrawing
protected

indicates whether the plot is updated automatically at the moment

See also
setPlotUpdateEnabled(), isPlotUpdateEnabled()

◆ image

InternalBufferImageType JKQTPlotter::image
protected

this stores the currently displayed plot

◆ jkqtp_RESIZE_DELAY

std::atomic<int> JKQTPlotter::jkqtp_RESIZE_DELAY
staticprotected

delay for resizing in milliseconds. If set to 0, resize delay is disabled and resizeTimer is unused.

See also
jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer

◆ lastWheelActionTimestamp

quint64 JKQTPlotter::lastWheelActionTimestamp
protected

storage for timestammp of the last QWheelEvent (used in wheelAction() to distinguish trackpad-pan ations in mode jkqtpmwaZoomByWheelAndTrackpadPan)

◆ lastWheelActionType

WheelActionType JKQTPlotter::lastWheelActionType
protected

storage for last WheelActionType (used in wheelAction() to distinguish trackpad-pan ations in mode jkqtpmwaZoomByWheelAndTrackpadPan)

◆ magnification

double JKQTPlotter::magnification
protected

magnification factor for the display of the plot

◆ masterPlotterX

QPointer<JKQTPlotter> JKQTPlotter::masterPlotterX
protected

the master plotter, this plotter is connected to in x-direction.

◆ masterPlotterY

QPointer<JKQTPlotter> JKQTPlotter::masterPlotterY
protected

the master plotter, this plotter is connected to in y-direction.

◆ maxWheelEventSeriesTimestampDifference

const quint64 JKQTPlotter::maxWheelEventSeriesTimestampDifference
protected

max. time between two QWheelEvents that are recognized as one series

◆ menuSpecialContextMenu

QMenu* JKQTPlotter::menuSpecialContextMenu
protected

use this QMenu instance instead of the standard context menu of this widget

See also
Special (User-Defined) Context Menu of JKQTPlotter

◆ minSize

QSize JKQTPlotter::minSize
protected

current minimal size of the JKQTPlotter widget to properly display the plot

◆ mouseContextX

double JKQTPlotter::mouseContextX
protected

x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)

◆ mouseContextY

double JKQTPlotter::mouseContextY
protected

y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)

◆ mouseDragingRectangle

bool JKQTPlotter::mouseDragingRectangle
protected

this is set true if we are drawing a zoom rectangle

◆ mouseDragMarkers

QList<MouseDragMarker> JKQTPlotter::mouseDragMarkers
protected

internal list of markers to be drawn by paintUserAction()

◆ mouseDragRectXEnd

double JKQTPlotter::mouseDragRectXEnd
protected

when draging the mouse this contains the x-coordinate the mouse is currently pointing to

◆ mouseDragRectXEndPixel

int JKQTPlotter::mouseDragRectXEndPixel
protected

when draging the mouse this contains the x-coordinate the mouse is currently pointing to (in pixels)

◆ mouseDragRectXStart

double JKQTPlotter::mouseDragRectXStart
protected

when draging the mouse this contains the x-coordinate the user clicked on (in plot coordinates)

◆ mouseDragRectXStartPixel

int JKQTPlotter::mouseDragRectXStartPixel
protected

when draging the mouse this contains the x-coordinate the user clicked on (in pixels)

◆ mouseDragRectYEnd

double JKQTPlotter::mouseDragRectYEnd
protected

when zooming by moving the mouse this contains the y-coordinate the mouse is currently pointing to

◆ mouseDragRectYEndPixel

int JKQTPlotter::mouseDragRectYEndPixel
protected

when draging the mouse this contains the y-coordinate the mouse is currently pointing to (in pixels)

◆ mouseDragRectYStart

double JKQTPlotter::mouseDragRectYStart
protected

when draging the mouse this contains the y-coordinate the user clicked on (in plot coordinates)

◆ mouseDragRectYStartPixel

int JKQTPlotter::mouseDragRectYStartPixel
protected

when zooming by moving the mouse this contains the y-coordinate the user clicked on (in pixels)

◆ mouseLastClickX

int JKQTPlotter::mouseLastClickX
protected

x-position of the last mouse-click (in screen pixels)

◆ mouseLastClickY

int JKQTPlotter::mouseLastClickY
protected

y-position of the last mouse-click (in screen pixels)

◆ mousePosX

double JKQTPlotter::mousePosX
protected

x-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates)

◆ mousePosY

double JKQTPlotter::mousePosY
protected

y-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates)

◆ oldImage

InternalBufferImageType JKQTPlotter::oldImage
protected

this can be used when drawing a zoom rectangle to store an unchanged copy of the currently displayed image.

◆ plotter

JKQTBasePlotter* JKQTPlotter::plotter
protected

JKQTBasePlotter used to plot.

◆ plotterStyle

JKQTPlotterStyle JKQTPlotter::plotterStyle
protected

◆ registeredOverrideMouseDragActionModes

JKQTPMouseDragActionsHashMap JKQTPlotter::registeredOverrideMouseDragActionModes
protected

list of override mouse drag action modes, that override the settings ing plotterStyle.registeredMouseDragActionModes

See also
setOverrideMouseDragAction(), resetOverrideMouseDragAction(), JKQTPlotterStyle::registeredMouseDragActionModes

◆ resizeTimer

QTimer JKQTPlotter::resizeTimer
protected

timer used while the graph is resized to delay the redrawing with new size (in the meantime, an intermediate graphic is displayed)

See also
delayedResizeEvent()
See also
jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer

◆ toolbar

JKVanishQToolBar* JKQTPlotter::toolbar
protected

toolbar class used for user input


The documentation for this class was generated from the following file: