JKQTPlotter
an extensive Qt4/Qt5 Plotter framework (including a fast variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies

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

#include <jkqtplotter.h>

Inheritance diagram for JKQTPlotter:
Collaboration diagram for JKQTPlotter:

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 displayed data to cpliboard More...
 
void copyDataMatlab ()
 copy displayed data to cpliboard in Matlab syntax More...
 
void openContextMenu ()
 open the context menu at the mouse position of the last click More...
 
void openContextMenu (int x, int y)
 open the context menu at the mouse position x and y More...
 
void openSpecialContextMenu ()
 open the special context menu at the mouse position of the last click More...
 
void openSpecialContextMenu (int x, int y)
 open the special context menu at the mouse position x and y More...
 
void openStandardAndSpecialContextMenu ()
 open the standard context menu with the special context menu integrated at the mouse position of the last click More...
 
void openStandardAndSpecialContextMenu (int x, int y)
 open the standard context menu with the special context menu integrated at the mouse position x and y More...
 
void openStandardContextMenu ()
 open the standard context menu at the mouse position of the last click More...
 
void openStandardContextMenu (int x, int y)
 open the standard context menu at the mouse position x and y More...
 
void populateToolbar (QToolBar *toolbar) const
 popuplate the given toolbar toolbar with all actions shown in a toolbar from this class ... More...
 
void print (QPrinter *printer=nullptr)
 print the current plot, if printer is nullptr a printer selection dialog is displayed More...
 
void redrawOverlays ()
 replot overlays only (use redrawPlot() to replot the plot and the overlays) More...
 
void redrawPlot ()
 update the plot and the overlays More...
 
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, ...) More...
 
void 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, ...) More...
 
void setAbsoluteX (double xminn, double xmaxx)
 sets absolutely limiting x-range of the plot More...
 
void setAbsoluteXY (double xminn, double xmaxx, double yminn, double ymaxx)
 sets absolutely limiting x- and y-range of the plot More...
 
void setAbsoluteY (double yminn, double ymaxx)
 sets absolute minimum and maximum y-value to plot More...
 
void setContextMenuMode (JKQTPContextMenuModes mode)
 sets the mode if the standard context menu More...
 
void setGrid (bool val)
 sets whether to plot grid lines or not More...
 
void setGridColor (QColor color)
 sets the color of all Major grid lines More...
 
void setGridStyle (Qt::PenStyle __value)
 sets the style of all Major grid lines More...
 
void setGridWidth (double __value)
 sets the width of all Major grid lines More...
 
void setMagnification (double m)
 set the current plot magnification More...
 
void setMaxTooltipDistance (int v)
 maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed More...
 
void setMinorGridColor (QColor color)
 sets the color of all minor grid lines More...
 
void setMinorGridStyle (Qt::PenStyle __value)
 sets the style of all minor grid lines More...
 
void setMinorGridWidth (double __value)
 sets the width of all minor grid lines More...
 
void setMouseActionToolbarActionsActive (bool __value)
 allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions More...
 
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. More...
 
void setShowZeroAxes (bool showX, bool showY)
 switches the visibility of the zero-axes associated with the x- and y-axis More...
 
void setShowZeroAxes (bool showXY)
 switches the visibility of the zero-axes associated with the x- and y-axis More...
 
void setToolbarAlwaysOn (bool __value)
 returns whether the toolbar is always visible or only when the mouse moves to the upper left area More...
 
void setToolbarEnabled (bool __value)
 returns whether the toolbar is enabled More...
 
void setUserActionCatchSensitivity (int v)
 sensitivity (i.e. max. distance to see as one point) for user actions More...
 
void setUserActionMarkerBrush (const QBrush &__value)
 pen for location markers of user actions on the plot More...
 
void setUserActionMarkerDiameter (int v)
 size (diameter) of markers drawn by user actions More...
 
void setUserActionMarkerPen (const QPen &__value)
 pen for location markers of user actions on the plot More...
 
void setUserActionMarkerType (JKQTPUserActionMarkerType v)
 type of the location markers of user actions on the plot More...
 
void setUserActionOpaqueBrush (const QBrush &__value)
 pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips) More...
 
void setUserActionOpaquePen (const QPen &__value)
 pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips) More...
 
void setUserActionOverlayBrush (const QBrush &__value)
 pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles) More...
 
void setUserActionOverlayPen (const QPen &__value)
 pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles) More...
 
void setX (double xminn, double xmaxx)
 sets the x-range of the plot (minimum and maximum x-value on the x-axis) More...
 
void setXY (double xminn, double xmaxx, double yminn, double ymaxx)
 sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis) More...
 
void setY (double yminn, double ymaxx)
 sets the y-range of the plot (minimum and maximum y-value on the y-axis) More...
 
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 More...
 
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 More...
 
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 More...
 
void zoom (double nxmin, double nxmax, double nymin, double nymax)
 sets x/ymin and x/ymax to the supplied values and replots the graph (zoom operation!) More...
 
void zoomIn (double factor=2.0)
 zooms into the graph (the same as turning the mouse wheel) by the given factor More...
 
void zoomOut (double factor=2.0)
 zooms out of the graph (the same as turning the mouse wheel) by the given factor More...
 
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. More...
 

Signals

void beforePlotScalingRecalculate ()
 emitted before the plot scaling has been recalculated More...
 
void contextMenuOpened (double x, double y, QMenu *contextMenu)
 emitted whenever a context menu is opened. You can modify the menu via the parameter contextMenu! More...
 
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 More...
 
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 More...
 
void plotMouseMove (double x, double y)
 emitted whenever the mouse moves More...
 
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 More...
 
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) More...
 
void plotScalingRecalculated ()
 emitted when the plot scaling has been recalculated More...
 
void rulerDisplayed (double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers)
 emitted when a new ruler between two points is displayed More...
 
void tooltipDisplayed (double x, double y, const QStringList &entries, const QList< JKQTPPlotElement * > &graphs)
 emitted when a tooltip for a datapoint is displayed More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
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 More...
 
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) More...
 

Public Member Functions

 JKQTPlotter (bool datastore_internal, QWidget *parent=nullptr, JKQTPDatastore *datast=nullptr)
 class constructor More...
 
 JKQTPlotter (JKQTPDatastore *datast, QWidget *parent=nullptr)
 class constructor for a JKQTPlotter using an external JKQTPDatastore dataset More...
 
 JKQTPlotter (QWidget *parent=nullptr)
 class constructor More...
 
virtual ~JKQTPlotter ()
 class destructor More...
 
size_t addGraph (JKQTPPlotElement *gr)
 add a new graph, returns it's position in the graphs list More...
 
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 More...
 
void addGridPrintingPlotter (size_t x, size_t y, JKQTPlotter *plotterOther)
 add a new plotter plotterOther for grid printing mode, at location x / y More...
 
void clearAllMouseWheelActions ()
 deletes all mouse-wheel actions More...
 
void clearAllRegisteredMouseDoubleClickActions ()
 clear all registered mouse double-click actions More...
 
void clearAllRegisteredMouseDragActions ()
 clear all registeres mouse drag actions More...
 
void clearGraphs (bool deleteGraphs=true)
 remove all plots More...
 
void clearGridPrintingPlotters ()
 clear all additional plotters for grid printing mode More...
 
bool containsGraph (JKQTPPlotElement *gr)
 returns true, if the given graph is present More...
 
void deleteGraph (JKQTPPlotElement *gr, bool deletegraph=true)
 remove the given graph, if it is contained More...
 
void deleteGraph (size_t i, bool deletegraph=true)
 remove the i-th graph More...
 
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 More...
 
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 More...
 
void deregisterMouseWheelAction (Qt::KeyboardModifiers modifier)
 deletes all mouse-wheel actions registered for a given modifier More...
 
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 More...
 
double getAbsoluteXMax () const
 returns the absolute x-axis max More...
 
double getAbsoluteXMin () const
 returns the absolute x-axis min More...
 
double getAbsoluteYMax () const
 returns the absolute y-axis max More...
 
double getAbsoluteYMin () const
 returns the absolute y-axis min More...
 
QAction * getActMouseLeftAsDefault () const
 action that activates the default action, set in plotterStyle! More...
 
QAction * getActMouseLeftAsPanView () const
 action that activates the pan view tool (override!)
More...
 
QAction * getActMouseLeftAsRuler () const
 action that activates the ruler tool (override!) More...
 
QAction * getActMouseLeftAsToolTip () const
 action that activates the tooltip tool (override!)
More...
 
QAction * getActMouseLeftAsZoomRect () const
 action that activates the zoom rectangle tool (override!) More...
 
const JKQTBasePlottergetConstplotter () const
 returns the class internally used for plotting More...
 
JKQTPContextMenuModes getContextMenuMode () const
 returns the currently set mode for the context menu More...
 
const JKQTPlotterStylegetCurrentPlotterStyle () const
 current style properties for this JKQTPlotter More...
 
JKQTPDatastoregetDatastore ()
 returns a pointer to the datastore used by this object More...
 
JKQTPPlotElementgetGraph (size_t i)
 returns the i -th graph (of type JKQTPPlotElement) in this plotter instance More...
 
size_t getGraphCount ()
 returns the number of graphs More...
 
double getKeyFontSize () const
 font size for key labels [in points] More...
 
double getMagnification () const
 returns the current magnification factor More...
 
int getMaxTooltipDistance () const
 maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed More...
 
double getMouseContextX () const
 x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) More...
 
double getMouseContextY () const
 y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) More...
 
int getMouseLastClickX () const
 x-position of the last mouse-click (in screen pixels) More...
 
int getMouseLastClickY () const
 y-position of the last mouse-click (in screen pixels) More...
 
int getNextStyle ()
 gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles More...
 
JKQTBasePlotter::JKQTPPen getPlotStyle (int i) const
 returns a QPen object for the i-th plot style More...
 
JKQTBasePlottergetPlotter () const
 returns the class internally used for plotting More...
 
QMenu * getSpecialContextMenu () const
 returns the currently set special context menu object More...
 
int getToolbarIconSize ()
 get the width/height of the icons in the toolbar in pt More...
 
int getUserActionCatchSensitivity () const
 sensitivity (i.e. max. distance to see as one point) for user actions More...
 
QBrush getUserActionMarkerBrush () const
 brush for location markers of user actions on the plot More...
 
int getUserActionMarkerDiameter () const
 size (diameter) of markers drawn by user actions More...
 
QPen getUserActionMarkerPen () const
 pen for location markers of user actions on the plot More...
 
JKQTPUserActionMarkerType getUserActionMarkerType () const
 type of the location markers of user actions on the plot More...
 
QBrush getUserActionOpaqueBrush () const
 brush for user actions that cover parts of the plot (typically opaque, like e.g. tooltips) More...
 
QPen getUserActionOpaquePen () const
 pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips) More...
 
QBrush getUserActionOverlayBrush () const
 brush for user actions (typically semi-transparent, like e.g. zoom-rectangles) More...
 
QPen getUserActionOverlayPen () const
 pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles) More...
 
JKQTPHorizontalAxisgetXAxis ()
 returns the coordinate axis object for the x-axis More...
 
const JKQTPHorizontalAxisgetXAxis () const
 returns the coordinate axis object for the x-axis as a const pointer More...
 
double getXMax () const
 returns the current x-axis max More...
 
double getXMin () const
 returns the current x-axis min More...
 
JKQTPVerticalAxisgetYAxis ()
 returns the coordinate axis object for the y-axis More...
 
const JKQTPVerticalAxisgetYAxis () const
 returns the coordinate axis object for the y-axis as a const pointer More...
 
double getYMax () const
 returns the current y-axis max More...
 
double getYMin () const
 returns the current y-axis min More...
 
bool isEmittingSignalsEnabled ()
 returns whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate() More...
 
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. More...
 
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) More...
 
bool isToolbarAlwaysOn () const
 returns whether the toolbar is always visible or only when the mouse moves to the upper left area More...
 
bool isToolbarEnabled () const
 returns whether the toolbar is enabled More...
 
void loadCurrentPlotterStyle (const QSettings &settings, const QString &group="plot/", bool alsoLoadBaseStyle=true)
 replace the current style properties for this JKQTBasePlotter with properties loaded from settings More...
 
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 More...
 
QSize minimumSizeHint () const
 returns the minimum size of the widget More...
 
size_t moveGraphBottom (JKQTPPlotElement *gr)
 move the given graph to the top, or add it, if it is not yet contained More...
 
size_t moveGraphTop (JKQTPPlotElement *gr)
 move the given graph to the top, or add it, if it is not yet contained More...
 
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 More...
 
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 More...
 
void registerMouseWheelAction (Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action)
 specifies the action to perform on a mouse wheel event when a given modifier is pressed More...
 
void resetMasterSynchronization (JKQTBasePlotter::SynchronizationDirection synchronizeDirection=JKQTBasePlotter::sdXYAxes)
 switches any synchronization off, that has been created by synchronizeToMaster() More...
 
void saveCurrentPlotterStyle (QSettings &settings, const QString &group="plot/", bool alsoSaveBaseStyle=true) const
 store the current style properties for this JKQTBasePlotter with properties loaded from settings More...
 
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. More...
 
void setCurrentPlotterStyle (const JKQTPlotterStyle &style)
 replace the current style properties for this JKQTBasePlotter More...
 
void setCurrentPlotterStyle (const JKQTPlotterStyle &style, const JKQTBasePlotterStyle &baseStyle)
 replace the current style properties for this JKQTBasePlotter More...
 
void setEmittingSignalsEnabled (bool sig)
 specifies whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate() More...
 
void setGridPrinting (bool enabled)
 enables grid-printing for this plot More...
 
void setGridPrintingCurrentPos (size_t x, size_t y)
 set the x- and y-positions of this JKQTPlotter in the grid-printing grid More...
 
void setGridPrintingCurrentX (size_t x)
 set the x-position of this JKQTPlotter in the grid-printing grid More...
 
void setGridPrintingCurrentY (size_t y)
 set the y-position of this JKQTPlotter in the grid-printing grid More...
 
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) More...
 
void setSpecialContextMenu (QMenu *menu)
 sets a QMenu object to be used as special context menu More...
 
void setToolbarIconSize (int value)
 set the width/height of the icons in the toolbar in pt More...
 
QSize sizeHint () const
 returns the size of the widget More...
 
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) More...
 
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) More...
 
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) More...
 
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. More...
 
void useExternalDatastore (JKQTPDatastore *newStore)
 tells the plotter object to use the given external datastore. More...
 
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. More...
 

Protected Slots

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

Protected Member Functions

void fillInternalStructForToolTipOfClosestDataPoint (double x0, double y0, bool emitEvent=true)
 fills the inertnal mouseDragMarkers structure with data to display tooltips close to (x0, y0) More...
 
JKQTPMouseDoubleClickActionsHashMapIterator findMatchingMouseDoubleClickAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers) const
 searches JKQTPlotterStyle::registeredMouseDoubleClickActions for a matching action More...
 
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 More...
 
JKQTPMouseWheelActionsHashMapIterator findMatchingMouseWheelAction (Qt::KeyboardModifiers modifiers) const
 searches JKQTPlotterStyle::registeredMouseWheelActions for a matching action More...
 
void fixBasePlotterSettings ()
 modifies the settings of plotter to match those of this object More...
 
int getPlotYOffset ()
 calculate the y-axis shift of the plot, so there is space for the potentially displayed mouse position label More...
 
void initContextMenu ()
 fills the member contextMenu with all default and additionally registered actions, also calls modifyContextMenu() More...
 
void keyReleaseEvent (QKeyEvent *event)
 react on key presses. More...
 
void leaveEvent (QEvent *event)
 called, when the mouse leaves the widget, hides the toolbar (if visible) More...
 
void modifyContextMenu (QMenu *menu)
 you may overwrite this method to modify the given context menu before it is displayed. More...
 
void mouseDoubleClickEvent (QMouseEvent *event)
 event handler for a double click More...
 
void mouseMoveEvent (QMouseEvent *event)
 event handler for a mouse move More...
 
void mousePressEvent (QMouseEvent *event)
 event handler for a mouse down event More...
 
void mouseReleaseEvent (QMouseEvent *event)
 event handler for a mouse release event More...
 
void paintEvent (QPaintEvent *event)
 this simply paints the stored image to the widget's surface More...
 
void paintUserAction ()
 paint the user action (rectangle, ellipse, ... More...
 
void resetContextMenu (bool createnew=true)
 destroys the internal contextMenu and optionally creates a new one More...
 
void resetCurrentMouseDragAction ()
 resets the currently activated mouse drag action, e.g. called by mouseReleaseEvent() More...
 
void resetOverrideMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
 removes a previously set override mouse drag action for the given button/modifiers combination More...
 
void resizeEvent (QResizeEvent *event)
 resizes the internal representation (image) of the graphs More...
 
void setOverrideMouseDragAction (Qt::MouseButton button, Qt::KeyboardModifiers modifiers, JKQTPMouseDragActions action)
 sets an override mouse drag action for the given button/modifiers combination More...
 
void updateCursor ()
 set the current mouse cursor shappe according to currentMouseDragAction More...
 
void updateToolbar ()
 update settings of the toolbar More...
 
void wheelEvent (QWheelEvent *event)
 event handler for a turn of the mouse wheel More...
 

Protected Attributes

QActionGroup * actgrpMouseLeft
 action group, that groups the actMouseLeft... actions More...
 
QAction * actMouseLeftAsDefault
 action that activates the default action, set in plotterStyle! More...
 
QAction * actMouseLeftAsPanView
 action that activates the pan view tool (override!)
More...
 
QAction * actMouseLeftAsRuler
 action that activates the ruler tool (override!) More...
 
QAction * actMouseLeftAsToolTip
 action that activates the tooltip tool (override!)
More...
 
QAction * actMouseLeftAsZoomRect
 action that activates the zoom rectangle tool (override!) More...
 
QMenu * contextMenu
 the context menu object used by this JKQTPlotter More...
 
JKQTPContextMenuModes contextMenuMode
 current mode for the default context menu (i.e. the right-click context menu) More...
 
QList< QMenu * > contextSubMenus
 internal storage for sub-menu entries of the internal contextMenu object, based on the actions returned by JKQTBasePlotter::getLstAdditionalPlotterActions() More...
 
MouseDragAction currentMouseDragAction
 the currently executed MouseDragAction More...
 
bool doDrawing
 indicates whether the plot is updated automatically at the moment More...
 
QImage image
 this stores the currently displayed plot More...
 
QImage imageNoOverlays
 this stores the currently displayed plot More...
 
double magnification
 magnification factor for the display of the plot More...
 
QPointer< JKQTPlottermasterPlotterX
 the master plotter, this plotter is connected to in x-direction. More...
 
QPointer< JKQTPlottermasterPlotterY
 the master plotter, this plotter is connected to in y-direction. More...
 
QMenu * menuSpecialContextMenu
 use this QMenu instance instead of the standard context menu of this widget More...
 
QSize minSize
 current minimal size of the JKQTPlotter widget to properly display the plot More...
 
double mouseContextX
 x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) More...
 
double mouseContextY
 y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) More...
 
bool mouseDragingRectangle
 this is set true if we are drawing a zoom rectangle More...
 
QList< MouseDragMarkermouseDragMarkers
 internal list of markers to be drawn by paintUserAction() More...
 
double mouseDragRectXEnd
 when draging the mouse this contains the x-coordinate the mouse is currently pointing to More...
 
int mouseDragRectXEndPixel
 when draging the mouse this contains the x-coordinate the mouse is currently pointing to (in pixels) More...
 
double mouseDragRectXStart
 when draging the mouse this contains the x-coordinate the user clicked on (in plot coordinates) More...
 
int mouseDragRectXStartPixel
 when draging the mouse this contains the x-coordinate the user clicked on (in pixels) More...
 
double mouseDragRectYEnd
 when zooming by moving the mouse this contains the y-coordinate the mouse is currently pointing to More...
 
int mouseDragRectYEndPixel
 when draging the mouse this contains the y-coordinate the mouse is currently pointing to (in pixels) More...
 
double mouseDragRectYStart
 when draging the mouse this contains the y-coordinate the user clicked on (in plot coordinates) More...
 
int mouseDragRectYStartPixel
 when zooming by moving the mouse this contains the y-coordinate the user clicked on (in pixels) More...
 
int mouseLastClickX
 x-position of the last mouse-click (in screen pixels) More...
 
int mouseLastClickY
 y-position of the last mouse-click (in screen pixels) More...
 
double mousePosX
 x-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates) More...
 
double mousePosY
 y-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates) More...
 
QImage oldImage
 this can be used when drawing a zoom rectangle to store an unchanged copy of the currently displayed image. More...
 
JKQTBasePlotterplotter
 JKQTBasePlotter used to plot. More...
 
JKQTPlotterStyle plotterStyle
 current style properties for this JKQTPlotter More...
 
JKQTPMouseDragActionsHashMap registeredOverrideMouseDragActionModes
 list of override mouse drag action modes, that override the settings ing plotterStyle.registeredMouseDragActionModes More...
 
QTimer resizeTimer
 timer used while the graph is resized to delay the redrawing with new size (in the meantime, an intermediate graphic is displayed) More...
 
JKVanishQToolBartoolbar
 toolbar class used for user input More...
 

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);

The result should look something like this:

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

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).

Naming conventions:

  • 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)

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.

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).

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));
    }

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)));
  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:

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 hweel 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.

Signaling When Mouse Moves

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() ).

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

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()

size_t JKQTPlotter::addGraph ( JKQTPPlotElement gr)
inline

add a new graph, returns it's position in the graphs list

Parameters
grgraph object (of type JKQTPPlotElement) to be added. Note: The JKQTPlotter takes ownership of graph gr .
Returns
ID of the added graph object gr in the internal list of graphs
See also
JKQTBasePlotter::addGraph()

◆ 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
See also
JKQTBasePlotter::addGraphs()

◆ 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

◆ 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
See also
JKQTBasePlotter::clearGraphs()

◆ clearGridPrintingPlotters()

void JKQTPlotter::clearGridPrintingPlotters ( )

◆ containsGraph()

bool JKQTPlotter::containsGraph ( JKQTPPlotElement gr)
inline

returns true, if the given graph is present

See also
JKQTBasePlotter::containsGraph()

◆ 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:
//...
// 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 displayed data to cpliboard

◆ copyDataMatlab

void JKQTPlotter::copyDataMatlab ( )
inlineslot

copy displayed data to cpliboard in Matlab syntax

◆ 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 given graph, if it is contained

See also
JKQTBasePlotter::deleteGraph()

◆ deleteGraph() [2/2]

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

remove the i-th graph

See also
JKQTBasePlotter::deleteGraph()

◆ 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

◆ 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

◆ 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 
) 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

◆ findMatchingMouseWheelAction()

JKQTPMouseWheelActionsHashMapIterator JKQTPlotter::findMatchingMouseWheelAction ( Qt::KeyboardModifiers  modifiers) 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

◆ getAbsoluteXMin()

double JKQTPlotter::getAbsoluteXMin ( ) const
inline

returns the absolute x-axis min

◆ getAbsoluteYMax()

double JKQTPlotter::getAbsoluteYMax ( ) const
inline

returns the absolute y-axis max

◆ getAbsoluteYMin()

double JKQTPlotter::getAbsoluteYMin ( ) const
inline

returns the absolute y-axis min

◆ getActMouseLeftAsDefault()

QAction* JKQTPlotter::getActMouseLeftAsDefault ( ) const

action that activates the default action, set in plotterStyle!

◆ getActMouseLeftAsPanView()

QAction* JKQTPlotter::getActMouseLeftAsPanView ( ) const

action that activates the pan view tool (override!)

◆ getActMouseLeftAsRuler()

QAction* JKQTPlotter::getActMouseLeftAsRuler ( ) const

action that activates the ruler tool (override!)

◆ getActMouseLeftAsToolTip()

QAction* JKQTPlotter::getActMouseLeftAsToolTip ( ) const

action that activates the tooltip tool (override!)

◆ getActMouseLeftAsZoomRect()

QAction* JKQTPlotter::getActMouseLeftAsZoomRect ( ) const

action that activates the zoom rectangle tool (override!)

◆ getConstplotter()

const JKQTBasePlotter* JKQTPlotter::getConstplotter ( ) const
inline

returns the class internally used for plotting

◆ getContextMenuMode()

JKQTPContextMenuModes JKQTPlotter::getContextMenuMode ( ) const

◆ getCurrentPlotterStyle()

const JKQTPlotterStyle& JKQTPlotter::getCurrentPlotterStyle ( ) const

◆ getDatastore()

JKQTPDatastore* JKQTPlotter::getDatastore ( )
inline

returns a pointer to the datastore used by this object

◆ getGraph()

JKQTPPlotElement* JKQTPlotter::getGraph ( size_t  i)
inline

returns the i -th graph (of type JKQTPPlotElement) in this plotter instance

See also
JKQTBasePlotter::getGraph()

◆ getGraphCount()

size_t JKQTPlotter::getGraphCount ( )
inline

returns the number of graphs

See also
JKQTBasePlotter::getGraphCount()

◆ getKeyFontSize()

double JKQTPlotter::getKeyFontSize ( ) const
inline

font size for key labels [in points]

◆ getMagnification()

double JKQTPlotter::getMagnification ( ) const
inline

returns the current magnification factor

◆ 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()

JKQTBasePlotter* JKQTPlotter::getPlotter ( ) const
inline

returns the class internally used for plotting

◆ getPlotYOffset()

int JKQTPlotter::getPlotYOffset ( )
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 ( )

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]

JKQTPHorizontalAxis* JKQTPlotter::getXAxis ( )
inline

returns the coordinate axis object for the x-axis

See also
JKQTBasePlotter::getXAxis()

◆ getXAxis() [2/2]

const JKQTPHorizontalAxis* JKQTPlotter::getXAxis ( ) const
inline

returns the coordinate axis object for the x-axis as a const pointer

See also
JKQTBasePlotter::getXAxis()

◆ getXMax()

double JKQTPlotter::getXMax ( ) const
inline

returns the current x-axis max

See also
JKQTBasePlotter::getYAxis()

◆ getXMin()

double JKQTPlotter::getXMin ( ) const
inline

returns the current x-axis min

See also
JKQTBasePlotter::getYAxis()

◆ getYAxis() [1/2]

JKQTPVerticalAxis* JKQTPlotter::getYAxis ( )
inline

returns the coordinate axis object for the y-axis

See also
JKQTBasePlotter::getYAxis()

◆ getYAxis() [2/2]

const JKQTPVerticalAxis* JKQTPlotter::getYAxis ( ) const
inline

returns the coordinate axis object for the y-axis as a const pointer

See also
JKQTBasePlotter::getYAxis()

◆ getYMax()

double JKQTPlotter::getYMax ( ) const
inline

returns the current y-axis max

See also
JKQTBasePlotter::getYAxis()

◆ getYMin()

double JKQTPlotter::getYMin ( ) const
inline

returns the current y-axis min

See also
JKQTBasePlotter::getYAxis()

◆ 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 ( )
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, Signaling When Mouse Moves
setMousePositionShown(), JKQTPlotterStyle::displayMousePosition, Signaling When Mouse Moves

◆ 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()

◆ 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)
protected

react on key presses.

These shortcuts are defined:

  • ESC stops current zooming/drawing action

◆ leaveEvent()

void JKQTPlotter::leaveEvent ( QEvent *  event)
protected

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

◆ loadCurrentPlotterStyle()

void JKQTPlotter::loadCurrentPlotterStyle ( const QSettings &  settings,
const QString &  group = "plot/",
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(), JKQTPlotter 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

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

◆ mouseDoubleClickEvent()

void JKQTPlotter::mouseDoubleClickEvent ( QMouseEvent *  event)
protected

event handler for a double click

See also
registerMouseDoubleClickAction(), deregisterMouseDoubleClickAction()

◆ mouseMoveEvent()

void JKQTPlotter::mouseMoveEvent ( QMouseEvent *  event)
protected

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 .
See also
mousePosX, mousePosY

◆ mousePressEvent()

void JKQTPlotter::mousePressEvent ( QMouseEvent *  event)
protected

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)
protected

event handler for a mouse release event

this finishes the action, started by mousePressEvent()

◆ moveGraphBottom()

size_t JKQTPlotter::moveGraphBottom ( JKQTPPlotElement gr)
inline

move the given graph to the top, or add it, if it is not yet contained

Parameters
grgraph object (of type JKQTPPlotElement) to be moved (needs to be containing to the JKQTPlotter already!)
Returns
ID of the added graph object gr in the internal list of graphs
See also
JKQTBasePlotter::moveGraphBottom()

◆ moveGraphTop()

size_t JKQTPlotter::moveGraphTop ( JKQTPPlotElement gr)
inline

move the given graph to the top, or add it, if it is not yet contained

Parameters
grgraph object (of type JKQTPPlotElement) to be moved (needs to be containing to the JKQTPlotter already!)
Returns
ID of the added graph object gr in the internal list of graphs
See also
JKQTBasePlotter::moveGraphTop()

◆ 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)
protected

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

◆ 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

◆ redrawOverlays

void JKQTPlotter::redrawOverlays ( )
slot

replot overlays only (use redrawPlot() to replot the plot and the overlays)

You can use this function, if you only changed the overlays but not the graphs in this plotter. Then only the overlas are redrawn and the old (saved) image of the graphs and the coordinate syste, is used as a base. This is significantly faster than redrawing the whole plot.

◆ 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

◆ 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)
protected

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

◆ saveCurrentPlotterStyle()

void JKQTPlotter::saveCurrentPlotterStyle ( QSettings &  settings,
const QString &  group = "plot/",
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(), JKQTPlotter 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, ...)

The 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.

If format is "slk" the output will be in SYLK format, if format is "csv" or "dat" the output will be comma separated values and if format is "txt" the output will be tab separated values.

◆ saveImage

void 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, ...)

◆ 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

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(), JKQTBasePlotter::setAbsoluteX()

◆ 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.

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(), zoomToFit(), JKQTBasePlotter::setAbsoluteXY()

◆ setAbsoluteY

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

sets absolute minimum and maximum y-value to plot

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(), JKQTBasePlotter::setAbsoluteY()

◆ 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()

◆ setGrid

void JKQTPlotter::setGrid ( bool  val)
inlineslot

sets whether to plot grid lines or not

Grid visible
Grid invisible

◆ setGridColor

void JKQTPlotter::setGridColor ( QColor  color)
inlineslot

sets the color of all Major grid lines

◆ 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()

◆ setMouseLeftActionAsToolTip

void JKQTPlotter::setMouseLeftActionAsToolTip ( )
protectedslot

action that activates the tooltip tool

See also
setMouseLeftActionAsRuler(), resetMouseLeftAction()

◆ setMouseLeftActionAsZoomRect

void JKQTPlotter::setMouseLeftActionAsZoomRect ( )
protectedslot

action that activates the zoom rectangle tool

See also
resetMouseLeftAction(), setMouseLeftActionAsToolTip()

◆ 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, Signaling When Mouse Moves
isMousePositionShown(), JKQTPlotterStyle::displayMousePosition, Signaling When Mouse Moves

◆ 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 x- and y-axis

Parameters
showXYindicates whether to show the zero-axis associated with the x- and y-axis

◆ 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
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 JKQTBasePlotter::setEmittingSignalsEnabled() ).

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

◆ setXY

void JKQTPlotter::setXY ( double  xminn,
double  xmaxx,
double  yminn,
double  ymaxx 
)
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
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 JKQTBasePlotter::setEmittingSignalsEnabled() ).

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

◆ 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
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 JKQTBasePlotter::setEmittingSignalsEnabled() ).

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

◆ sizeHint()

QSize JKQTPlotter::sizeHint ( ) const

returns the size of the widget

◆ 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)
protected

event handler for a turn of the mouse wheel

Executes the user action defined for the mouse wheel.

See also
registerMouseWheelAction(), deregisterMouseWheelAction(), registeredMouseWheelActions

◆ zoom

void JKQTPlotter::zoom ( double  nxmin,
double  nxmax,
double  nymin,
double  nymax 
)
inlineslot

sets x/ymin and x/ymax to the supplied values and replots the graph (zoom operation!)

◆ 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 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!)

◆ actMouseLeftAsToolTip

QAction* JKQTPlotter::actMouseLeftAsToolTip
protected

action that activates the tooltip tool (override!)

◆ actMouseLeftAsZoomRect

QAction* JKQTPlotter::actMouseLeftAsZoomRect
protected

action that activates the zoom rectangle 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

◆ doDrawing

bool JKQTPlotter::doDrawing
protected

indicates whether the plot is updated automatically at the moment

See also
setPlotUpdateEnabled(), isPlotUpdateEnabled()

◆ image

QImage JKQTPlotter::image
protected

this stores the currently displayed plot

◆ imageNoOverlays

QImage JKQTPlotter::imageNoOverlays
protected

this stores the currently displayed plot

◆ 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.

◆ 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

QImage 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

◆ 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()

◆ toolbar

JKVanishQToolBar* JKQTPlotter::toolbar
protected

toolbar class used for user input


The documentation for this class was generated from the following file:
JKQTPlotter::getDatastore
JKQTPDatastore * getDatastore()
returns a pointer to the datastore used by this object
Definition: jkqtplotter.h:651
jkqtpmdaZoomByRectangle
draw a rectangle and when finish zoom to that rectangle
Definition: jkqtptools.h:95
JKQTPlotter::addGraph
size_t addGraph(JKQTPPlotElement *gr)
add a new graph, returns it's position in the graphs list
Definition: jkqtplotter.h:784
JKQTPPlotElement::setTitle
virtual void setTitle(const QString &__value)
sets the title of the plot (for display in key!).
JKQTPlotter::getSpecialContextMenu
QMenu * getSpecialContextMenu() const
returns the currently set special context menu object
jkqtpmdaPanPlotOnMove
the user can drag the current plot window while keeping the left mouse-button pushed down (=panning),...
Definition: jkqtptools.h:93
JKQTPlotter::contextMenu
QMenu * contextMenu
the context menu object used by this JKQTPlotter
Definition: jkqtplotter.h:1611
JKQTPlotter::setMousePositionShown
void setMousePositionShown(bool __value)
specifies whether to display the current position of the mouse in the top border of the plot (this ma...
jkqtpdcaClickMovesViewport
a double-click centers the x/y-range around the clicked position
Definition: jkqtptools.h:127
JKQTPlotter::JKQTPlotter
JKQTPlotter(bool datastore_internal, QWidget *parent=nullptr, JKQTPDatastore *datast=nullptr)
class constructor
TestUserInteraction::contextMenuOpened
void contextMenuOpened(double x, double y, QMenu *contextMenu)
JKQTPlotter::getPlotter
JKQTBasePlotter * getPlotter() const
returns the class internally used for plotting
Definition: jkqtplotter.h:463
JKQTPlotter::contextMenuOpened
void contextMenuOpened(double x, double y, QMenu *contextMenu)
emitted whenever a context menu is opened. You can modify the menu via the parameter contextMenu!
JKQTPlotter::isMousePositionShown
bool isMousePositionShown() const
specifies whether to display the current position of the mouse in the top border of the plot (this ma...
JKQTPlotter::registerMouseDoubleClickAction
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 giv...
JKQTPXYGraph::setXColumn
void setXColumn(int __value)
the column that contains the x-component of the datapoints
JKQTPXYGraph::setYColumn
void setYColumn(int __value)
the column that contains the y-component of the datapoints
JKQTPlotter::zoomToFit
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:1025
JKQTPXYLineGraph
This implements xy line plots. This also alows to draw symbols at the data points.
Definition: jkqtpscatter.h:56
JKQTBasePlotter::getActionSavePDF
QAction * getActionSavePDF() const
QAction which triggers the saving as PDF.
JKQTPlotter::setXY
void setXY(double xminn, double xmaxx, double yminn, double ymaxx)
sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)
Definition: jkqtplotter.h:1230
jkqtpmwaZoomByWheel
use the mouse-wheel for zooming
Definition: jkqtptools.h:147
JKQTBasePlotter::getActionPrint
QAction * getActionPrint() const
QAction which triggers the printing.
JKQTPlotter
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition: jkqtplotter.h:432
JKQTBasePlotter::getActionSavePlot
QAction * getActionSavePlot() const
QAction which triggers saving of the plot as an image.
JKQTPlotter::registerMouseDragAction
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...
JKQTPlotter::registerMouseWheelAction
void registerMouseWheelAction(Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action)
specifies the action to perform on a mouse wheel event when a given modifier is pressed
JKQTBasePlotter::getActionSaveData
QAction * getActionSaveData() const
QAction which triggers saving of the data used for the plot.
JKQTPDatastore::addCopiedColumn
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:806