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
JKQTFastPlotter Class Reference

a speed optimized plotter class More...

#include <jkqtfastplotter.h>

Inheritance diagram for JKQTFastPlotter:
Collaboration diagram for JKQTFastPlotter:

Public Slots

void copyImage ()
 copy the current plot image to the clipboard More...
 
void redrawPlot ()
 replot everything (slowest possible plotting) More...
 
void redrawPlotImmediate ()
 replot everything (slowest possible plotting) and forces a repaint calling QWidget::repaint() More...
 
void setXMax (double value)
 set xMax More...
 
void setXMin (double value)
 set xMin More...
 
void setYMax (double value)
 set yMax More...
 
void setYMin (double value)
 set yMin More...
 
void updateData ()
 replot only the data More...
 
void updateDataImmediate ()
 replot only the data, forces a redraw by calling QWidget::repaint()
More...
 

Signals

void clicked (double x, double y)
 emitted whenever the mouse is clicked inside the plot More...
 
void clicked (double x, double y, Qt::KeyboardModifiers modifiers)
 emitted whenever the mouse is clicked inside the plot More...
 
void doubleClicked (double x, double y)
 emitted whenever the mouse is double-clicked inside the plot More...
 
void doubleClicked (double x, double y, Qt::KeyboardModifiers modifiers)
 emitted whenever the mouse is double-clicked inside the plot More...
 
void mouseDragFinished (double x_start, double y_start, double x_end, double y_end, Qt::KeyboardModifiers modifiers)
 emitted after the mouse has been dragged with the left button clicked More...
 
void mouseDragged (double x_start, double y_start, double x_end, double y_end, Qt::KeyboardModifiers modifiers)
 emitted when the mouse has been dragged with the left button clicked More...
 
void mouseMoved (double x, double y)
 emitted whenever the mouse is clicked inside the plot More...
 
void plotterSizesChanged ()
 emitted whenever the graph sizes (borders, plotWidth, plotHeight) change More...
 
void replotting ()
 emitted whenever the graph is replotted More...
 

Public Member Functions

 JKQTFastPlotter (QWidget *parent=nullptr)
 class constructor More...
 
void addPlot (JKQTFPPlot *g)
 add a new graph More...
 
void clearPlots (bool remove=false)
 clear all plots in the graph More...
 
void deletePlot (int id, bool remove=false)
 remove given graph More...
 
void deletePlot (JKQTFPPlot *g, bool remove=false)
 remove given graph More...
 
bool doesMaintainAspectRatio () const
 indicates whether to maintain a specific aspect ratio More...
 
void draw (QPainter *painter, QColor background, QSize *size)
 draw the contents onto any QPainter, starting at (0,0), returns the size of the whole plot in size, if supplied with the suppliedbackground color More...
 
void draw (QPainter *painter, QSize *size=nullptr)
 draw the contents onto any QPainter, starting at (0,0), returns the size of the whole plot in size, if supplied with the default background color More...
 
double getAspectRatio () const
 aspect ratio of the plot, only used when maintainAspectRation is true More...
 
QColor getBackgroundColor () const
 color of the background More...
 
bool getDragLine () const
 
QPen getDragShapePen () const
 
bool getDrawGrid () const
 indicates whether to draw a grid More...
 
bool getDrawSystemBox () const
 indicates whether to draw a system box More...
 
bool getDrawZeroAxes () const
 indicates whether to draw axes at x=0/y=0 More...
 
QColor getGridColor () const
 color of the coordinate grid More...
 
Qt::PenStyle getGridStyle () const
 style of the coordinate grid More...
 
double getGridWidth () const
 width of the coordinate grid (in pixel) More...
 
int getInternalPlotBorderBottom () const
 internally calculated: free space between widget bottom border and plot bottom border More...
 
int getInternalPlotBorderLeft () const
 internally calculated: free space between widget left border and plot left border More...
 
int getInternalPlotBorderRight () const
 internally calculated: free space between widget right border and plot left border More...
 
int getInternalPlotBorderTop () const
 internally calculated: free space between widget top border and plot bottom border More...
 
QString getLabelFontName () const
 font name of the axis labels More...
 
double getLabelFontSize () const
 font size (in points) of the axis labels More...
 
QColor getPlotBackgroundColor () const
 color of the plot's background More...
 
int getPlotBorderBottom () const
 free space between widget bottom border and plot bottom border
More...
 
int getPlotBorderLeft () const
 free space between widget left border and plot left border
More...
 
int getPlotBorderRight () const
 free space between widget right border and plot left border More...
 
int getPlotBorderTop () const
 free space between widget top border and plot bottom border More...
 
int getPlotHeight () const
 plot height in pt inside the widget (calculated by calcPlotScaling() from plotBorderTop, plotBorderBottom and widgetHeight) More...
 
int getPlotNum (JKQTFPPlot *g)
 return the internal number (0..N-1) of the given plot, or -1 More...
 
int getPlotWidth () const
 plot width in pt inside the widget (calculated by calcPlotScaling() from plotBorderLeft, plotBorderRight and widgetWidth) More...
 
JKQTFastPlottergetSynchronizeX () const
 synchronize x-axis settings to this plotter More...
 
JKQTFastPlottergetSynchronizeY () const
 synchronize y-axis settings to this plotter More...
 
QColor getSystemColor () const
 color of the coordinate system More...
 
double getSystemWidth () const
 width of the coordinate (in pixel) More...
 
QString getTickFontName () const
 font name of the tick labels More...
 
double getTickFontSize () const
 font size (in points) of the tick labels More...
 
double getTickLength () const
 length of an axis tick (pixels) More...
 
QString getXAxisLabel () const
 label of x axis More...
 
bool getXAxisLabelVisible () const
 plot x axis label More...
 
bool getXAxisLog () const
 is x axis logarithmic? More...
 
double getXMax () const
 maximum value of x axis More...
 
double getXMin () const
 minimum value of x axis More...
 
double getXTickDistance () const
 distance between two labels on x axis More...
 
double getXZeroTick () const
 a label position from which axis label plotting is started for the x axis More...
 
QString getYAxisLabel () const
 label of y axis More...
 
bool getYAxisLabelVisible () const
 plot y axis label More...
 
bool getYAxisLog () const
 is x axis logarithmic? More...
 
double getYMax () const
 maximum value of y axis More...
 
double getYMin () const
 minimum value of y axis More...
 
double getYTickDistance () const
 distance between two labels on y axis More...
 
double getYZeroTick () const
 a label position from which axis label plotting is started for the y axis More...
 
bool isPlotUpdateEnabled () const
 if false the plotting won't be performed (may be used to set more than one parameter without replot More...
 
double p2x (long x)
 return x coordinate coordinate from x-pixel More...
 
double p2y (long y)
 return y coordinate coordinate from y-pixel More...
 
void setAspectRatio (double __value)
 aspect ratio of the plot, only used when maintainAspectRation is true More...
 
void setBackgroundColor (const QColor &__value)
 color of the background More...
 
void setDragLine (bool __value)
 
void setDragShapePen (const QPen &__value)
 
void setDrawGrid (bool __value)
 indicates whether to draw a grid More...
 
void setDrawSystemBox (bool __value)
 indicates whether to draw a system box More...
 
void setDrawZeroAxes (bool __value)
 indicates whether to draw axes at x=0/y=0 More...
 
void setGridColor (const QColor &__value)
 color of the coordinate grid More...
 
void setGridStyle (Qt::PenStyle __value)
 style of the coordinate grid More...
 
void setGridWidth (double __value)
 width of the coordinate grid (in pixel) More...
 
void setLabelFontName (const QString &__value)
 font name of the axis labels More...
 
void setLabelFontSize (double __value)
 font size (in points) of the axis labels More...
 
void setMaintainAspectRatio (bool __value)
 indicates whether to maintain a specific aspect ratio More...
 
void setPlotBackgroundColor (const QColor &__value)
 color of the plot's background More...
 
void setPlotBorderBottom (int __value)
 free space between widget bottom border and plot bottom border
More...
 
void setPlotBorderLeft (int __value)
 free space between widget left border and plot left border
More...
 
void setPlotBorderRight (int __value)
 free space between widget right border and plot left border More...
 
void setPlotBorderTop (int __value)
 free space between widget top border and plot bottom border More...
 
void setPlotUpdateEnabled (bool __value)
 if false the plotting won't be performed (may be used to set more than one parameter without replot More...
 
void setSynchronizeX (JKQTFastPlotter *&__value)
 synchronize x-axis settings to this plotter More...
 
void setSynchronizeY (JKQTFastPlotter *&__value)
 synchronize y-axis settings to this plotter More...
 
void setSystemColor (const QColor &__value)
 color of the coordinate system More...
 
void setSystemWidth (double __value)
 width of the coordinate (in pixel) More...
 
void setTickFontName (const QString &__value)
 font name of the tick labels More...
 
void setTickFontSize (double __value)
 font size (in points) of the tick labels More...
 
void setTickLength (double __value)
 length of an axis tick (pixels) More...
 
void setXAxisLabel (const QString &__value)
 label of x axis More...
 
void setXAxisLabelVisible (bool __value)
 plot x axis label More...
 
void setXRange (double min, double max, bool logarithmic=false)
 set the properties of the x axis More...
 
void setXTickDistance (double __value)
 distance between two labels on x axis More...
 
void setXYRange (double xmin, double xmax, double ymin, double ymax, bool xlogarithmic=false, bool ylogarithmic=false)
 set the properties of both axes More...
 
void setXZeroTick (double __value)
 a label position from which axis label plotting is started for the x axis More...
 
void setYAxisLabel (const QString &__value)
 label of y axis More...
 
void setYAxisLabelVisible (bool __value)
 plot y axis label More...
 
void setYRange (double min, double max, bool logarithmic=false)
 set the properties of the y axis More...
 
void setYTickDistance (double __value)
 distance between two labels on y axis More...
 
void setYZeroTick (double __value)
 a label position from which axis label plotting is started for the y axis More...
 
double x2p (double x)
 return x-pixel coordinate from x coordinate More...
 
double y2p (double y)
 return y-pixel coordinate from y coordinate More...
 

Static Public Attributes

static const double ABS_MIN_LINEWIDTH
 smallest allowed line width for JKQTFastPlotter More...
 
static const size_t LUTSIZE
 size of the lookup tables used by JKQTFPimagePlot_array2image() More...
 

Protected Member Functions

void calcPlotScaling ()
 recalculate the scaling of the plot More...
 
QSize minimumSizeHint () const override
 
virtual void mouseDoubleClickEvent (QMouseEvent *event) override
 event handler for a double click More...
 
virtual void mouseMoveEvent (QMouseEvent *event) override
 event handler for a mouse move More...
 
virtual void mousePressEvent (QMouseEvent *event) override
 event handler for a mouse button press More...
 
virtual void mouseReleaseEvent (QMouseEvent *event) override
 event handler for a mouse button is released More...
 
virtual void paintEvent (QPaintEvent *event) override
 this simply paints the stored image to the widget's surface More...
 
void plotGraphs (QPainter &painter)
 paint the graphs More...
 
void plotSystem (QPainter &painter)
 paint the coordinate system More...
 
virtual void resizeEvent (QResizeEvent *event) override
 resizes the internal representation (image) of the graphs More...
 

Protected Attributes

QAction * actCopyImage
 
double aspectRatio
 aspect ratio of the plot, only used when maintainAspectRation is true More...
 
QColor backgroundColor
 color of the background More...
 
QColor default_backgroundColor
 default value for property backgroundColor. More...
 
bool default_drawGrid
 default value for property drawGrid. More...
 
bool default_drawSystemBox
 default value for property drawSystemBox. More...
 
bool default_drawZeroAxes
 default value for property drawZeroAxes. More...
 
QColor default_gridColor
 default value for property gridColor. More...
 
Qt::PenStyle default_gridStyle
 default value for property gridStyle. More...
 
double default_gridWidth
 default value for property gridWidth. More...
 
QString default_labelFontName
 default value for property labelFontName. More...
 
double default_labelFontSize
 default value for property labelFontSize. More...
 
QColor default_plotBackgroundColor
 default value for property plotBackgroundColor. More...
 
int default_plotBorderBottom
 default value for property plotBorderBottom. More...
 
int default_plotBorderLeft
 default value for property plotBorderLeft. More...
 
int default_plotBorderRight
 default value for property plotBorderRight. More...
 
int default_plotBorderTop
 default value for property plotBorderTop. More...
 
QColor default_systemColor
 default value for property systemColor. More...
 
double default_systemWidth
 default value for property systemWidth. More...
 
QString default_tickFontName
 default value for property tickFontName. More...
 
double default_tickFontSize
 default value for property tickFontSize. More...
 
double default_tickLength
 default value for property tickLength. More...
 
bool doDrawing
 if false the plotting won't be performed (may be used to set more than one parameter without replot More...
 
bool doFullRepaint
 indicates whether to do full repaint (system and data) at the next repaint (any of the repaint meothods) More...
 
bool dragging
 
bool dragLine
 
QPen dragShapePen
 
bool drawGrid
 indicates whether to draw a grid More...
 
bool drawSystemBox
 indicates whether to draw a system box More...
 
bool drawZeroAxes
 indicates whether to draw axes at x=0/y=0 More...
 
QColor gridColor
 color of the coordinate grid More...
 
Qt::PenStyle gridStyle
 style of the coordinate grid More...
 
double gridWidth
 width of the coordinate grid (in pixel) More...
 
QImage image
 this stores the currently displayed plot More...
 
int internalPlotBorderBottom
 internally calculated: free space between widget bottom border and plot bottom border More...
 
int internalPlotBorderLeft
 internally calculated: free space between widget left border and plot left border More...
 
int internalPlotBorderRight
 internally calculated: free space between widget right border and plot left border More...
 
int internalPlotBorderTop
 internally calculated: free space between widget top border and plot bottom border More...
 
QString labelFontName
 font name of the axis labels More...
 
double labelFontSize
 font size (in points) of the axis labels More...
 
bool maintainAspectRatio
 indicates whether to maintain a specific aspect ratio More...
 
QPoint mouseDragEnd
 
QPoint mouseDragStart
 
QMutex mutexRepaint
 mutex to lock global widget repaint More...
 
QMutex mutexRepaintData
 mutex to lock data repaint More...
 
QMutex mutexRepaintSystem
 mutex to lock system repaint More...
 
QImage oldImage
 this can be used when drawing a zoom rectangle to store an unchanged copy of the currently displayed image. More...
 
QColor plotBackgroundColor
 color of the plot's background More...
 
int plotBorderBottom
 free space between widget bottom border and plot bottom border
More...
 
int plotBorderLeft
 free space between widget left border and plot left border
More...
 
int plotBorderRight
 free space between widget right border and plot left border More...
 
int plotBorderTop
 free space between widget top border and plot bottom border More...
 
int plotHeight
 plot height in pt inside the widget (calculated by calcPlotScaling() from plotBorderTop, plotBorderBottom and widgetHeight) More...
 
QVector< JKQTFPPlot * > plots
 list of plots in this graph More...
 
int plotWidth
 plot width in pt inside the widget (calculated by calcPlotScaling() from plotBorderLeft, plotBorderRight and widgetWidth) More...
 
JKQTFastPlottersynchronizeX
 synchronize x-axis settings to this plotter More...
 
JKQTFastPlottersynchronizeY
 synchronize y-axis settings to this plotter More...
 
QColor systemColor
 color of the coordinate system More...
 
QImage systemImage
 this stores the currently displayed coordinate system More...
 
double systemWidth
 width of the coordinate (in pixel) More...
 
QString tickFontName
 font name of the tick labels More...
 
double tickFontSize
 font size (in points) of the tick labels More...
 
double tickLength
 length of an axis tick (pixels) More...
 
QString xAxisLabel
 label of x axis More...
 
bool xAxisLabelVisible
 plot x axis label More...
 
bool xAxisLog
 is x axis logarithmic? More...
 
double xMax
 maximum value of x axis More...
 
double xMin
 minimum value of x axis More...
 
double xOffset
 x axis offset (calculated internally)
More...
 
double xScale
 x axis scaling factor (calculated internally)
More...
 
double xTickDistance
 distance between two labels on x axis More...
 
double xWidth
 width of plot on x axis (calculated internally)
More...
 
double xZeroTick
 a label position from which axis label plotting is started for the x axis More...
 
QString yAxisLabel
 label of y axis More...
 
bool yAxisLabelVisible
 plot y axis label More...
 
bool yAxisLog
 is x axis logarithmic? More...
 
double yMax
 maximum value of y axis More...
 
double yMin
 minimum value of y axis More...
 
double yOffset
 y axis offset (calculated internally)
More...
 
double yScale
 y axis scaling factor (calculated internally)
More...
 
double yTickDistance
 distance between two labels on y axis More...
 
double yWidth
 width of plot on y axis (calculated internally)
More...
 
double yZeroTick
 a label position from which axis label plotting is started for the y axis More...
 

Detailed Description

a speed optimized plotter class

This plotter class is (in contrast to JKQTPlotter) optimized for speed. It allows to plot function graphs/data in a simple manner. The focus of design was not on a nice output (athough this is not unimportant), but on the speed of the output. So the class may be used to di quick plotting of data, i.e. in fast image sequence applications.

These measures were taken to increase speed:

  • The coordinate system is drawn onto an internal image which is only updated, when the size of the widget or a property of the coordinate system changes. When only the data changes, just the data plot has to be updated.
  • The class uses an internal buffer with the complete image, so a repaint does not always trigger a complete repaint of all elements, but just measns painting the internal image to the screen. This also allows to plot selections ... over the plot, without having to replot the plots.
  • The definition of the coordinate system as well as the definition the system ticks ... is reduced to the absolute minimum.
  • The method setPlotUpdateEnabled() allows to prevent replotting of the class contents, e.g. when you want to set a multitude of parameters without triggering a replot every time.

The class supports these features:

  • coordinate axes may be linear or logarithmic.
  • ticks and tick labels are drawn by a simple algorithm: The user has to supply two values: zeroTick is a tick value that exists in any case (i.e. 0) and tickDistance which contains the distance between two ticks (only applicable to linear axes). Then the class starts to draw at zeroTick and move on to zeroTick+tickDistance and zeroTick-tickDistance until min / max of the axis is reached. For logarithmic axes the class uses zeroTick*10 and zeroTick/10
  • plot may contain a grid (x and y grid may be switched on/off separately).
  • plots are represented by descendents of JKQTFPPlot and the plotting code is completely contained therein (and should be speed optimized).
  • it is possible to keep a specified aspect ratio
  • it is possible to couple different plots in a way, that they are plottetd with the same width/height both in pixel and world coordinates by using plotterSizesChanged() and synchronizeX() / synchronizeY().

Constructor & Destructor Documentation

◆ JKQTFastPlotter()

JKQTFastPlotter::JKQTFastPlotter ( QWidget *  parent = nullptr)

class constructor

Member Function Documentation

◆ addPlot()

void JKQTFastPlotter::addPlot ( JKQTFPPlot g)

add a new graph

◆ calcPlotScaling()

void JKQTFastPlotter::calcPlotScaling ( )
protected

recalculate the scaling of the plot

◆ clearPlots()

void JKQTFastPlotter::clearPlots ( bool  remove = false)

clear all plots in the graph

Parameters
removeif true the object will also be deleted from memory, not just from the list

◆ clicked [1/2]

void JKQTFastPlotter::clicked ( double  x,
double  y 
)
signal

emitted whenever the mouse is clicked inside the plot

◆ clicked [2/2]

void JKQTFastPlotter::clicked ( double  x,
double  y,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted whenever the mouse is clicked inside the plot

◆ copyImage

void JKQTFastPlotter::copyImage ( )
slot

copy the current plot image to the clipboard

◆ deletePlot() [1/2]

void JKQTFastPlotter::deletePlot ( int  id,
bool  remove = false 
)

remove given graph

Parameters
idspecifies the graph to delete
removeif true the object will also be deleted from memory, not just from the list

◆ deletePlot() [2/2]

void JKQTFastPlotter::deletePlot ( JKQTFPPlot g,
bool  remove = false 
)

remove given graph

Parameters
gspecifies the graph to delete
removeif true the object will also be deleted from memory, not just from the list

◆ doesMaintainAspectRatio()

bool JKQTFastPlotter::doesMaintainAspectRatio ( ) const
inline

indicates whether to maintain a specific aspect ratio

◆ doubleClicked [1/2]

void JKQTFastPlotter::doubleClicked ( double  x,
double  y 
)
signal

emitted whenever the mouse is double-clicked inside the plot

◆ doubleClicked [2/2]

void JKQTFastPlotter::doubleClicked ( double  x,
double  y,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted whenever the mouse is double-clicked inside the plot

◆ draw() [1/2]

void JKQTFastPlotter::draw ( QPainter *  painter,
QColor  background,
QSize *  size 
)

draw the contents onto any QPainter, starting at (0,0), returns the size of the whole plot in size, if supplied with the suppliedbackground color

◆ draw() [2/2]

void JKQTFastPlotter::draw ( QPainter *  painter,
QSize *  size = nullptr 
)

draw the contents onto any QPainter, starting at (0,0), returns the size of the whole plot in size, if supplied with the default background color

◆ getAspectRatio()

double JKQTFastPlotter::getAspectRatio ( ) const
inline

aspect ratio of the plot, only used when maintainAspectRation is true

The aspect ratio is defined as width/height of the plot in pt. So if you want to have a plot spanning x=0..20 and y=0..10 where each 1x1 square should be as wide as high you will have to set aspectRatio to 2 .

Note
Note that aspect ratios only make sense for linear-linear plots. This will be ignored if any one axis is logarithmic.

◆ getBackgroundColor()

QColor JKQTFastPlotter::getBackgroundColor ( ) const
inline

color of the background

◆ getDragLine()

bool JKQTFastPlotter::getDragLine ( ) const
inline

◆ getDragShapePen()

QPen JKQTFastPlotter::getDragShapePen ( ) const
inline

◆ getDrawGrid()

bool JKQTFastPlotter::getDrawGrid ( ) const
inline

indicates whether to draw a grid

◆ getDrawSystemBox()

bool JKQTFastPlotter::getDrawSystemBox ( ) const
inline

indicates whether to draw a system box

◆ getDrawZeroAxes()

bool JKQTFastPlotter::getDrawZeroAxes ( ) const
inline

indicates whether to draw axes at x=0/y=0

◆ getGridColor()

QColor JKQTFastPlotter::getGridColor ( ) const
inline

color of the coordinate grid

◆ getGridStyle()

Qt::PenStyle JKQTFastPlotter::getGridStyle ( ) const
inline

style of the coordinate grid

◆ getGridWidth()

double JKQTFastPlotter::getGridWidth ( ) const
inline

width of the coordinate grid (in pixel)

◆ getInternalPlotBorderBottom()

int JKQTFastPlotter::getInternalPlotBorderBottom ( ) const
inline

internally calculated: free space between widget bottom border and plot bottom border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ getInternalPlotBorderLeft()

int JKQTFastPlotter::getInternalPlotBorderLeft ( ) const
inline

internally calculated: free space between widget left border and plot left border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ getInternalPlotBorderRight()

int JKQTFastPlotter::getInternalPlotBorderRight ( ) const
inline

internally calculated: free space between widget right border and plot left border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ getInternalPlotBorderTop()

int JKQTFastPlotter::getInternalPlotBorderTop ( ) const
inline

internally calculated: free space between widget top border and plot bottom border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ getLabelFontName()

QString JKQTFastPlotter::getLabelFontName ( ) const
inline

font name of the axis labels

◆ getLabelFontSize()

double JKQTFastPlotter::getLabelFontSize ( ) const
inline

font size (in points) of the axis labels

◆ getPlotBackgroundColor()

QColor JKQTFastPlotter::getPlotBackgroundColor ( ) const
inline

color of the plot's background

Note
the background is not drawn if this color is set to QColor(Qt::transparent) !

◆ getPlotBorderBottom()

int JKQTFastPlotter::getPlotBorderBottom ( ) const
inline

free space between widget bottom border and plot bottom border

◆ getPlotBorderLeft()

int JKQTFastPlotter::getPlotBorderLeft ( ) const
inline

free space between widget left border and plot left border

◆ getPlotBorderRight()

int JKQTFastPlotter::getPlotBorderRight ( ) const
inline

free space between widget right border and plot left border

◆ getPlotBorderTop()

int JKQTFastPlotter::getPlotBorderTop ( ) const
inline

free space between widget top border and plot bottom border

◆ getPlotHeight()

int JKQTFastPlotter::getPlotHeight ( ) const
inline

plot height in pt inside the widget (calculated by calcPlotScaling() from plotBorderTop, plotBorderBottom and widgetHeight)

◆ getPlotNum()

int JKQTFastPlotter::getPlotNum ( JKQTFPPlot g)

return the internal number (0..N-1) of the given plot, or -1

◆ getPlotWidth()

int JKQTFastPlotter::getPlotWidth ( ) const
inline

plot width in pt inside the widget (calculated by calcPlotScaling() from plotBorderLeft, plotBorderRight and widgetWidth)

◆ getSynchronizeX()

JKQTFastPlotter* JKQTFastPlotter::getSynchronizeX ( ) const
inline

synchronize x-axis settings to this plotter

◆ getSynchronizeY()

JKQTFastPlotter* JKQTFastPlotter::getSynchronizeY ( ) const
inline

synchronize y-axis settings to this plotter

◆ getSystemColor()

QColor JKQTFastPlotter::getSystemColor ( ) const
inline

color of the coordinate system

◆ getSystemWidth()

double JKQTFastPlotter::getSystemWidth ( ) const
inline

width of the coordinate (in pixel)

◆ getTickFontName()

QString JKQTFastPlotter::getTickFontName ( ) const
inline

font name of the tick labels

◆ getTickFontSize()

double JKQTFastPlotter::getTickFontSize ( ) const
inline

font size (in points) of the tick labels

◆ getTickLength()

double JKQTFastPlotter::getTickLength ( ) const
inline

length of an axis tick (pixels)

◆ getXAxisLabel()

QString JKQTFastPlotter::getXAxisLabel ( ) const
inline

label of x axis

◆ getXAxisLabelVisible()

bool JKQTFastPlotter::getXAxisLabelVisible ( ) const
inline

plot x axis label

◆ getXAxisLog()

bool JKQTFastPlotter::getXAxisLog ( ) const
inline

is x axis logarithmic?

◆ getXMax()

double JKQTFastPlotter::getXMax ( ) const
inline

maximum value of x axis

◆ getXMin()

double JKQTFastPlotter::getXMin ( ) const
inline

minimum value of x axis

◆ getXTickDistance()

double JKQTFastPlotter::getXTickDistance ( ) const
inline

distance between two labels on x axis

◆ getXZeroTick()

double JKQTFastPlotter::getXZeroTick ( ) const
inline

a label position from which axis label plotting is started for the x axis

◆ getYAxisLabel()

QString JKQTFastPlotter::getYAxisLabel ( ) const
inline

label of y axis

◆ getYAxisLabelVisible()

bool JKQTFastPlotter::getYAxisLabelVisible ( ) const
inline

plot y axis label

◆ getYAxisLog()

bool JKQTFastPlotter::getYAxisLog ( ) const
inline

is x axis logarithmic?

◆ getYMax()

double JKQTFastPlotter::getYMax ( ) const
inline

maximum value of y axis

◆ getYMin()

double JKQTFastPlotter::getYMin ( ) const
inline

minimum value of y axis

◆ getYTickDistance()

double JKQTFastPlotter::getYTickDistance ( ) const
inline

distance between two labels on y axis

◆ getYZeroTick()

double JKQTFastPlotter::getYZeroTick ( ) const
inline

a label position from which axis label plotting is started for the y axis

◆ isPlotUpdateEnabled()

bool JKQTFastPlotter::isPlotUpdateEnabled ( ) const
inline

if false the plotting won't be performed (may be used to set more than one parameter without replot

◆ minimumSizeHint()

QSize JKQTFastPlotter::minimumSizeHint ( ) const
overrideprotected

◆ mouseDoubleClickEvent()

virtual void JKQTFastPlotter::mouseDoubleClickEvent ( QMouseEvent *  event)
overrideprotectedvirtual

event handler for a double click

◆ mouseDragFinished

void JKQTFastPlotter::mouseDragFinished ( double  x_start,
double  y_start,
double  x_end,
double  y_end,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted after the mouse has been dragged with the left button clicked

◆ mouseDragged

void JKQTFastPlotter::mouseDragged ( double  x_start,
double  y_start,
double  x_end,
double  y_end,
Qt::KeyboardModifiers  modifiers 
)
signal

emitted when the mouse has been dragged with the left button clicked

◆ mouseMoved

void JKQTFastPlotter::mouseMoved ( double  x,
double  y 
)
signal

emitted whenever the mouse is clicked inside the plot

◆ mouseMoveEvent()

virtual void JKQTFastPlotter::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

event handler for a mouse move

◆ mousePressEvent()

virtual void JKQTFastPlotter::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

event handler for a mouse button press

◆ mouseReleaseEvent()

virtual void JKQTFastPlotter::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

event handler for a mouse button is released

◆ p2x()

double JKQTFastPlotter::p2x ( long  x)
inline

return x coordinate coordinate from x-pixel

◆ p2y()

double JKQTFastPlotter::p2y ( long  y)
inline

return y coordinate coordinate from y-pixel

◆ paintEvent()

virtual void JKQTFastPlotter::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

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

◆ plotGraphs()

void JKQTFastPlotter::plotGraphs ( QPainter &  painter)
protected

paint the graphs

◆ plotSystem()

void JKQTFastPlotter::plotSystem ( QPainter &  painter)
protected

paint the coordinate system

◆ plotterSizesChanged

void JKQTFastPlotter::plotterSizesChanged ( )
signal

emitted whenever the graph sizes (borders, plotWidth, plotHeight) change

◆ redrawPlot

void JKQTFastPlotter::redrawPlot ( )
slot

replot everything (slowest possible plotting)

◆ redrawPlotImmediate

void JKQTFastPlotter::redrawPlotImmediate ( )
slot

replot everything (slowest possible plotting) and forces a repaint calling QWidget::repaint()

◆ replotting

void JKQTFastPlotter::replotting ( )
signal

emitted whenever the graph is replotted

◆ resizeEvent()

virtual void JKQTFastPlotter::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

resizes the internal representation (image) of the graphs

◆ setAspectRatio()

void JKQTFastPlotter::setAspectRatio ( double  __value)
inline

aspect ratio of the plot, only used when maintainAspectRation is true

The aspect ratio is defined as width/height of the plot in pt. So if you want to have a plot spanning x=0..20 and y=0..10 where each 1x1 square should be as wide as high you will have to set aspectRatio to 2 .

Note
Note that aspect ratios only make sense for linear-linear plots. This will be ignored if any one axis is logarithmic.

◆ setBackgroundColor()

void JKQTFastPlotter::setBackgroundColor ( const QColor &  __value)
inline

color of the background

◆ setDragLine()

void JKQTFastPlotter::setDragLine ( bool  __value)
inline

◆ setDragShapePen()

void JKQTFastPlotter::setDragShapePen ( const QPen &  __value)
inline

◆ setDrawGrid()

void JKQTFastPlotter::setDrawGrid ( bool  __value)
inline

indicates whether to draw a grid

◆ setDrawSystemBox()

void JKQTFastPlotter::setDrawSystemBox ( bool  __value)
inline

indicates whether to draw a system box

◆ setDrawZeroAxes()

void JKQTFastPlotter::setDrawZeroAxes ( bool  __value)
inline

indicates whether to draw axes at x=0/y=0

◆ setGridColor()

void JKQTFastPlotter::setGridColor ( const QColor &  __value)
inline

color of the coordinate grid

◆ setGridStyle()

void JKQTFastPlotter::setGridStyle ( Qt::PenStyle  __value)
inline

style of the coordinate grid

◆ setGridWidth()

void JKQTFastPlotter::setGridWidth ( double  __value)
inline

width of the coordinate grid (in pixel)

◆ setLabelFontName()

void JKQTFastPlotter::setLabelFontName ( const QString &  __value)
inline

font name of the axis labels

◆ setLabelFontSize()

void JKQTFastPlotter::setLabelFontSize ( double  __value)
inline

font size (in points) of the axis labels

◆ setMaintainAspectRatio()

void JKQTFastPlotter::setMaintainAspectRatio ( bool  __value)
inline

indicates whether to maintain a specific aspect ratio

◆ setPlotBackgroundColor()

void JKQTFastPlotter::setPlotBackgroundColor ( const QColor &  __value)
inline

color of the plot's background

Note
the background is not drawn if this color is set to QColor(Qt::transparent) !

◆ setPlotBorderBottom()

void JKQTFastPlotter::setPlotBorderBottom ( int  __value)
inline

free space between widget bottom border and plot bottom border

◆ setPlotBorderLeft()

void JKQTFastPlotter::setPlotBorderLeft ( int  __value)
inline

free space between widget left border and plot left border

◆ setPlotBorderRight()

void JKQTFastPlotter::setPlotBorderRight ( int  __value)
inline

free space between widget right border and plot left border

◆ setPlotBorderTop()

void JKQTFastPlotter::setPlotBorderTop ( int  __value)
inline

free space between widget top border and plot bottom border

◆ setPlotUpdateEnabled()

void JKQTFastPlotter::setPlotUpdateEnabled ( bool  __value)
inline

if false the plotting won't be performed (may be used to set more than one parameter without replot

◆ setSynchronizeX()

void JKQTFastPlotter::setSynchronizeX ( JKQTFastPlotter *&  __value)
inline

synchronize x-axis settings to this plotter

◆ setSynchronizeY()

void JKQTFastPlotter::setSynchronizeY ( JKQTFastPlotter *&  __value)
inline

synchronize y-axis settings to this plotter

◆ setSystemColor()

void JKQTFastPlotter::setSystemColor ( const QColor &  __value)
inline

color of the coordinate system

◆ setSystemWidth()

void JKQTFastPlotter::setSystemWidth ( double  __value)
inline

width of the coordinate (in pixel)

◆ setTickFontName()

void JKQTFastPlotter::setTickFontName ( const QString &  __value)
inline

font name of the tick labels

◆ setTickFontSize()

void JKQTFastPlotter::setTickFontSize ( double  __value)
inline

font size (in points) of the tick labels

◆ setTickLength()

void JKQTFastPlotter::setTickLength ( double  __value)
inline

length of an axis tick (pixels)

◆ setXAxisLabel()

void JKQTFastPlotter::setXAxisLabel ( const QString &  __value)
inline

label of x axis

◆ setXAxisLabelVisible()

void JKQTFastPlotter::setXAxisLabelVisible ( bool  __value)
inline

plot x axis label

◆ setXMax

void JKQTFastPlotter::setXMax ( double  value)
inlineslot

set xMax

◆ setXMin

void JKQTFastPlotter::setXMin ( double  value)
inlineslot

set xMin

◆ setXRange()

void JKQTFastPlotter::setXRange ( double  min,
double  max,
bool  logarithmic = false 
)

set the properties of the x axis

◆ setXTickDistance()

void JKQTFastPlotter::setXTickDistance ( double  __value)
inline

distance between two labels on x axis

◆ setXYRange()

void JKQTFastPlotter::setXYRange ( double  xmin,
double  xmax,
double  ymin,
double  ymax,
bool  xlogarithmic = false,
bool  ylogarithmic = false 
)

set the properties of both axes

◆ setXZeroTick()

void JKQTFastPlotter::setXZeroTick ( double  __value)
inline

a label position from which axis label plotting is started for the x axis

◆ setYAxisLabel()

void JKQTFastPlotter::setYAxisLabel ( const QString &  __value)
inline

label of y axis

◆ setYAxisLabelVisible()

void JKQTFastPlotter::setYAxisLabelVisible ( bool  __value)
inline

plot y axis label

◆ setYMax

void JKQTFastPlotter::setYMax ( double  value)
inlineslot

set yMax

◆ setYMin

void JKQTFastPlotter::setYMin ( double  value)
inlineslot

set yMin

◆ setYRange()

void JKQTFastPlotter::setYRange ( double  min,
double  max,
bool  logarithmic = false 
)

set the properties of the y axis

◆ setYTickDistance()

void JKQTFastPlotter::setYTickDistance ( double  __value)
inline

distance between two labels on y axis

◆ setYZeroTick()

void JKQTFastPlotter::setYZeroTick ( double  __value)
inline

a label position from which axis label plotting is started for the y axis

◆ updateData

void JKQTFastPlotter::updateData ( )
slot

replot only the data

This internally calls QWidget::update(), so no immediate repaint() is forced! If you want an immediate update, call updateDataImmediate() instead!

◆ updateDataImmediate

void JKQTFastPlotter::updateDataImmediate ( )
slot

replot only the data, forces a redraw by calling QWidget::repaint()

◆ x2p()

double JKQTFastPlotter::x2p ( double  x)
inline

return x-pixel coordinate from x coordinate

◆ y2p()

double JKQTFastPlotter::y2p ( double  y)
inline

return y-pixel coordinate from y coordinate

Member Data Documentation

◆ ABS_MIN_LINEWIDTH

const double JKQTFastPlotter::ABS_MIN_LINEWIDTH
static

smallest allowed line width for JKQTFastPlotter

◆ actCopyImage

QAction* JKQTFastPlotter::actCopyImage
protected

◆ aspectRatio

double JKQTFastPlotter::aspectRatio
protected

aspect ratio of the plot, only used when maintainAspectRation is true

The aspect ratio is defined as width/height of the plot in pt. So if you want to have a plot spanning x=0..20 and y=0..10 where each 1x1 square should be as wide as high you will have to set aspectRatio to 2 .

Note
Note that aspect ratios only make sense for linear-linear plots. This will be ignored if any one axis is logarithmic.

◆ backgroundColor

QColor JKQTFastPlotter::backgroundColor
protected

color of the background

◆ default_backgroundColor

QColor JKQTFastPlotter::default_backgroundColor
protected

default value for property backgroundColor.

See also
backgroundColor for more information

◆ default_drawGrid

bool JKQTFastPlotter::default_drawGrid
protected

default value for property drawGrid.

See also
drawGrid for more information

◆ default_drawSystemBox

bool JKQTFastPlotter::default_drawSystemBox
protected

default value for property drawSystemBox.

See also
drawSystemBox for more information

◆ default_drawZeroAxes

bool JKQTFastPlotter::default_drawZeroAxes
protected

default value for property drawZeroAxes.

See also
drawZeroAxes for more information

◆ default_gridColor

QColor JKQTFastPlotter::default_gridColor
protected

default value for property gridColor.

See also
gridColor for more information

◆ default_gridStyle

Qt::PenStyle JKQTFastPlotter::default_gridStyle
protected

default value for property gridStyle.

See also
gridStyle for more information

◆ default_gridWidth

double JKQTFastPlotter::default_gridWidth
protected

default value for property gridWidth.

See also
gridWidth for more information

◆ default_labelFontName

QString JKQTFastPlotter::default_labelFontName
protected

default value for property labelFontName.

See also
labelFontName for more information

◆ default_labelFontSize

double JKQTFastPlotter::default_labelFontSize
protected

default value for property labelFontSize.

See also
labelFontSize for more information

◆ default_plotBackgroundColor

QColor JKQTFastPlotter::default_plotBackgroundColor
protected

default value for property plotBackgroundColor.

See also
plotBackgroundColor for more information

◆ default_plotBorderBottom

int JKQTFastPlotter::default_plotBorderBottom
protected

default value for property plotBorderBottom.

See also
plotBorderBottom for more information

◆ default_plotBorderLeft

int JKQTFastPlotter::default_plotBorderLeft
protected

default value for property plotBorderLeft.

See also
plotBorderLeft for more information

◆ default_plotBorderRight

int JKQTFastPlotter::default_plotBorderRight
protected

default value for property plotBorderRight.

See also
plotBorderRight for more information

◆ default_plotBorderTop

int JKQTFastPlotter::default_plotBorderTop
protected

default value for property plotBorderTop.

See also
plotBorderTop for more information

◆ default_systemColor

QColor JKQTFastPlotter::default_systemColor
protected

default value for property systemColor.

See also
systemColor for more information

◆ default_systemWidth

double JKQTFastPlotter::default_systemWidth
protected

default value for property systemWidth.

See also
systemWidth for more information

◆ default_tickFontName

QString JKQTFastPlotter::default_tickFontName
protected

default value for property tickFontName.

See also
tickFontName for more information

◆ default_tickFontSize

double JKQTFastPlotter::default_tickFontSize
protected

default value for property tickFontSize.

See also
tickFontSize for more information

◆ default_tickLength

double JKQTFastPlotter::default_tickLength
protected

default value for property tickLength.

See also
tickLength for more information

◆ doDrawing

bool JKQTFastPlotter::doDrawing
protected

if false the plotting won't be performed (may be used to set more than one parameter without replot

◆ doFullRepaint

bool JKQTFastPlotter::doFullRepaint
protected

indicates whether to do full repaint (system and data) at the next repaint (any of the repaint meothods)

◆ dragging

bool JKQTFastPlotter::dragging
protected

◆ dragLine

bool JKQTFastPlotter::dragLine
protected

◆ dragShapePen

QPen JKQTFastPlotter::dragShapePen
protected

◆ drawGrid

bool JKQTFastPlotter::drawGrid
protected

indicates whether to draw a grid

◆ drawSystemBox

bool JKQTFastPlotter::drawSystemBox
protected

indicates whether to draw a system box

◆ drawZeroAxes

bool JKQTFastPlotter::drawZeroAxes
protected

indicates whether to draw axes at x=0/y=0

◆ gridColor

QColor JKQTFastPlotter::gridColor
protected

color of the coordinate grid

◆ gridStyle

Qt::PenStyle JKQTFastPlotter::gridStyle
protected

style of the coordinate grid

◆ gridWidth

double JKQTFastPlotter::gridWidth
protected

width of the coordinate grid (in pixel)

◆ image

QImage JKQTFastPlotter::image
protected

this stores the currently displayed plot

◆ internalPlotBorderBottom

int JKQTFastPlotter::internalPlotBorderBottom
protected

internally calculated: free space between widget bottom border and plot bottom border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ internalPlotBorderLeft

int JKQTFastPlotter::internalPlotBorderLeft
protected

internally calculated: free space between widget left border and plot left border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ internalPlotBorderRight

int JKQTFastPlotter::internalPlotBorderRight
protected

internally calculated: free space between widget right border and plot left border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ internalPlotBorderTop

int JKQTFastPlotter::internalPlotBorderTop
protected

internally calculated: free space between widget top border and plot bottom border

Note
This is the actual border used for plotting, as it may be different from what the user supplied. Note also that this is at least as huge as the suer supplied border value!

◆ labelFontName

QString JKQTFastPlotter::labelFontName
protected

font name of the axis labels

◆ labelFontSize

double JKQTFastPlotter::labelFontSize
protected

font size (in points) of the axis labels

◆ LUTSIZE

const size_t JKQTFastPlotter::LUTSIZE
static

size of the lookup tables used by JKQTFPimagePlot_array2image()

◆ maintainAspectRatio

bool JKQTFastPlotter::maintainAspectRatio
protected

indicates whether to maintain a specific aspect ratio

◆ mouseDragEnd

QPoint JKQTFastPlotter::mouseDragEnd
protected

◆ mouseDragStart

QPoint JKQTFastPlotter::mouseDragStart
protected

◆ mutexRepaint

QMutex JKQTFastPlotter::mutexRepaint
protected

mutex to lock global widget repaint

◆ mutexRepaintData

QMutex JKQTFastPlotter::mutexRepaintData
protected

mutex to lock data repaint

◆ mutexRepaintSystem

QMutex JKQTFastPlotter::mutexRepaintSystem
protected

mutex to lock system repaint

◆ oldImage

QImage JKQTFastPlotter::oldImage
protected

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

◆ plotBackgroundColor

QColor JKQTFastPlotter::plotBackgroundColor
protected

color of the plot's background

Note
the background is not drawn if this color is set to QColor(Qt::transparent) !

◆ plotBorderBottom

int JKQTFastPlotter::plotBorderBottom
protected

free space between widget bottom border and plot bottom border

◆ plotBorderLeft

int JKQTFastPlotter::plotBorderLeft
protected

free space between widget left border and plot left border

◆ plotBorderRight

int JKQTFastPlotter::plotBorderRight
protected

free space between widget right border and plot left border

◆ plotBorderTop

int JKQTFastPlotter::plotBorderTop
protected

free space between widget top border and plot bottom border

◆ plotHeight

int JKQTFastPlotter::plotHeight
protected

plot height in pt inside the widget (calculated by calcPlotScaling() from plotBorderTop, plotBorderBottom and widgetHeight)

◆ plots

QVector<JKQTFPPlot*> JKQTFastPlotter::plots
protected

list of plots in this graph

◆ plotWidth

int JKQTFastPlotter::plotWidth
protected

plot width in pt inside the widget (calculated by calcPlotScaling() from plotBorderLeft, plotBorderRight and widgetWidth)

◆ synchronizeX

JKQTFastPlotter* JKQTFastPlotter::synchronizeX
protected

synchronize x-axis settings to this plotter

◆ synchronizeY

JKQTFastPlotter* JKQTFastPlotter::synchronizeY
protected

synchronize y-axis settings to this plotter

◆ systemColor

QColor JKQTFastPlotter::systemColor
protected

color of the coordinate system

◆ systemImage

QImage JKQTFastPlotter::systemImage
protected

this stores the currently displayed coordinate system

◆ systemWidth

double JKQTFastPlotter::systemWidth
protected

width of the coordinate (in pixel)

◆ tickFontName

QString JKQTFastPlotter::tickFontName
protected

font name of the tick labels

◆ tickFontSize

double JKQTFastPlotter::tickFontSize
protected

font size (in points) of the tick labels

◆ tickLength

double JKQTFastPlotter::tickLength
protected

length of an axis tick (pixels)

◆ xAxisLabel

QString JKQTFastPlotter::xAxisLabel
protected

label of x axis

◆ xAxisLabelVisible

bool JKQTFastPlotter::xAxisLabelVisible
protected

plot x axis label

◆ xAxisLog

bool JKQTFastPlotter::xAxisLog
protected

is x axis logarithmic?

◆ xMax

double JKQTFastPlotter::xMax
protected

maximum value of x axis

◆ xMin

double JKQTFastPlotter::xMin
protected

minimum value of x axis

◆ xOffset

double JKQTFastPlotter::xOffset
protected

x axis offset (calculated internally)

◆ xScale

double JKQTFastPlotter::xScale
protected

x axis scaling factor (calculated internally)

◆ xTickDistance

double JKQTFastPlotter::xTickDistance
protected

distance between two labels on x axis

◆ xWidth

double JKQTFastPlotter::xWidth
protected

width of plot on x axis (calculated internally)

◆ xZeroTick

double JKQTFastPlotter::xZeroTick
protected

a label position from which axis label plotting is started for the x axis

◆ yAxisLabel

QString JKQTFastPlotter::yAxisLabel
protected

label of y axis

◆ yAxisLabelVisible

bool JKQTFastPlotter::yAxisLabelVisible
protected

plot y axis label

◆ yAxisLog

bool JKQTFastPlotter::yAxisLog
protected

is x axis logarithmic?

◆ yMax

double JKQTFastPlotter::yMax
protected

maximum value of y axis

◆ yMin

double JKQTFastPlotter::yMin
protected

minimum value of y axis

◆ yOffset

double JKQTFastPlotter::yOffset
protected

y axis offset (calculated internally)

◆ yScale

double JKQTFastPlotter::yScale
protected

y axis scaling factor (calculated internally)

◆ yTickDistance

double JKQTFastPlotter::yTickDistance
protected

distance between two labels on y axis

◆ yWidth

double JKQTFastPlotter::yWidth
protected

width of plot on y axis (calculated internally)

◆ yZeroTick

double JKQTFastPlotter::yZeroTick
protected

a label position from which axis label plotting is started for the y axis


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