2015-07-11 18:56:02 +08:00
/*
2022-07-19 19:40:43 +08:00
Copyright ( c ) 2008 - 2022 Jan W . Krieger ( < jan @ jkrieger . de > )
2015-07-11 18:56:02 +08:00
2015-07-12 22:34:27 +08:00
2015-07-11 18:56:02 +08:00
This software is free software : you can redistribute it and / or modify
it under the terms of the GNU Lesser General Public License ( LGPL ) as published by
2019-02-08 00:24:46 +08:00
the Free Software Foundation , either version 2.1 of the License , or
2015-07-11 18:56:02 +08:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU Lesser General Public License ( LGPL ) for more details .
You should have received a copy of the GNU Lesser General Public License ( LGPL )
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
2022-04-25 04:07:39 +08:00
# ifndef JKQTPBASEPLOTTER_H
# define JKQTPBASEPLOTTER_H
2022-07-19 05:33:20 +08:00
# include "jkqtplotter/jkqtplotter_configmacros.h"
2019-05-30 04:40:02 +08:00
# include "jkqtplotter/jkqtptools.h"
2018-11-26 03:25:44 +08:00
# include "jkqtplotter/jkqtpdatastorage.h"
2019-02-08 00:24:46 +08:00
# include "jkqtplotter/jkqtpbaseplotterstyle.h"
2018-11-26 03:25:44 +08:00
# include "jkqtmathtext/jkqtmathtext.h"
# include "jkqtplotter/jkqtpbaseelements.h"
2019-05-30 04:40:02 +08:00
# include "jkqtcommon/jkqtpenhancedpainter.h"
2019-06-20 21:18:58 +08:00
# include "jkqtplotter/gui/jkqtpenhancedspinboxes.h"
2015-07-11 18:56:02 +08:00
# include <QObject>
# include <QAction>
# include <QActionGroup>
# include <QVector>
# include <QSettings>
# include <QColor>
# include <QMap>
# include <QVector>
# include <QPair>
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
# include <QPrinter>
# include <QtPrintSupport / QPrintPreviewWidget>
# endif
2015-07-11 18:56:02 +08:00
# include <QDoubleSpinBox>
# include <QLabel>
# include <QPointer>
# include <QListWidget>
# include <QComboBox>
# include <vector>
# include <cmath>
# include <iostream>
2022-04-25 04:07:39 +08:00
# include "jkqtplotter/jkqtplotter_imexport.h"
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
class JKQTPGraphsModel ; // forward
class JKQTPGraph ; // forward
class JKQTPPlotElement ; // forward
2015-07-11 18:56:02 +08:00
2019-01-26 03:16:04 +08:00
/** \brief initialized Qt-ressources necessary for JKQTBasePlotter
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt */
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT void initJKQTBasePlotterResources ( ) ;
2018-12-03 01:30:12 +08:00
2019-01-26 03:16:04 +08:00
/** \brief virtual base-class for exporter classes that can be used to save data inot a file
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt */
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPSaveDataAdapter {
2019-01-26 03:16:04 +08:00
public :
virtual ~ JKQTPSaveDataAdapter ( ) ;
virtual QString getFilter ( ) const = 0 ;
virtual void saveJKQTPData ( const QString & filename , const QList < QVector < double > > & data , const QStringList & columnNames ) const = 0 ;
} ;
/** \brief Service from this class to implement a special QPaintDevice as a plugin, that can be registered to JKQTBasePlotter/JKQTPlotter
* and then be used to export graphics , use registerPaintDeviceAdapter ( ) to register such a plass
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt */
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPPaintDeviceAdapter {
2019-01-26 03:16:04 +08:00
public :
virtual ~ JKQTPPaintDeviceAdapter ( ) { }
virtual QString getFilter ( ) const = 0 ;
virtual QString getFormatName ( ) const = 0 ;
virtual QString getFormatID ( ) const = 0 ;
virtual QStringList getFileExtension ( ) const = 0 ;
virtual bool getSetAbsolutePaperSize ( ) const = 0 ;
virtual double getPrintSizeXInMM ( ) const = 0 ;
virtual double getPrintSizeYInMM ( ) const = 0 ;
virtual bool isPrinter ( ) const = 0 ;
/** \brief create a paint device with a given size in pt */
virtual QPaintDevice * createPaintdevice ( const QString & filename , int widthPix , int heightPix ) const = 0 ;
/** \brief create a paint device with a given size in millimeters ... the default implementation call createPaintdevice(), assuming the standard logical resolution of the desktop!!!) */
virtual QPaintDevice * createPaintdeviceMM ( const QString & filename , double widthMM , double heightMM ) const ;
} ;
2015-07-11 18:56:02 +08:00
2019-01-27 03:12:54 +08:00
/** \brief base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
2019-01-19 16:40:52 +08:00
* \ ingroup jkqtpplotterclasses
2015-07-11 18:56:02 +08:00
*
* This class implements basic functionalities for the plotter classes . Those are :
2019-01-20 17:49:29 +08:00
* - # data storage using a JKQTPDatastore object
2015-07-11 18:56:02 +08:00
* - # coordinate transforms
* - # a set of properties for the graphs ( colors , widthes . . . ) and also a system ( see getNextStyle ( ) to automatically
* choose a drawing style for different graphs .
* - # drawing the coordinate axes , grids . . . ( logarithmic and linear )
* - # saveing and printing the resulting plots
* .
*
2019-01-20 23:15:10 +08:00
* This class is NOT a widget , if you need a plotting widget , use JKQTPlotter . This class may be used to
2019-01-27 03:12:54 +08:00
* plot using a JKQTPEnhancedPainter .
2015-07-11 18:56:02 +08:00
*
2019-02-03 21:04:48 +08:00
* \ see JKQTPlotter a QWidget class that displays a JKQTBasePlotter plot on a Qt Window .
*
*
* \ tableofcontents
*
2015-07-11 18:56:02 +08:00
*
* \ section jkqtplotter_base_datastore Data Storage
* As already mentioned this class does not provide means to draw graphs , but it contains a basic mechanism to associate
2019-01-20 17:49:29 +08:00
* data with it . This is imeplemented , using a JKQTPDatastore object together with some convenience access methods . No further
2019-01-20 23:15:10 +08:00
* data access is implemented and child classes are NOT forced to use this datastore . Hide it if you want . JKQTPlotter shows
2015-07-11 18:56:02 +08:00
* how to use it . This class implement a graph management , where graphs simply point to a set of columns inside the datastore
* that contain the actual plot data !
*
2022-07-24 20:50:28 +08:00
* If you call the JKQTBasePlotter : : JKQTBasePlotter ( ) constructor with no arguments , it will create an internal
2019-01-26 20:00:40 +08:00
* datastore object and you can start adding data by using getDatastore ( ) . If you have an external JKQTPDatastore object you can
2015-07-11 18:56:02 +08:00
* give it as parameter to the constructor or use one of the other methods :
2019-01-26 03:16:04 +08:00
* - useExternalDatastore ( ) : \ copybrief JKQTBasePlotter : : useExternalDatastore ( )
* - useAsInternalDatastore ( ) : \ copybrief JKQTBasePlotter : : useAsInternalDatastore ( )
* - useInternalDatastore ( ) : \ copybrief JKQTBasePlotter : : useInternalDatastore ( )
* - forceInternalDatastore ( ) : \ copybrief JKQTBasePlotter : : forceInternalDatastore ( )
2015-07-11 18:56:02 +08:00
* .
*
*
*
2019-01-12 23:01:55 +08:00
* \ section jkqtplotter_base_systems_baseplotter Coordinate Systems and Transformations
2019-01-20 17:49:29 +08:00
* These topics are discussed in the help for JKQTPCoordinateAxis . There is a set of coordinate transform
2015-07-11 18:56:02 +08:00
* methods ( x2p ( ) , y2p ( ) , p2x ( ) , p2y ( ) which only call the respective methods in xAxis and yAxis objects .
*
*
2019-01-13 01:53:16 +08:00
* \ section jkqtplotter_base_grids_baseplotter Axis Ticks and Grids
2015-07-11 18:56:02 +08:00
* - The plotting of coordinate axes and grids , as well as coordinate transforms is done by
2019-01-20 17:49:29 +08:00
* JKQTPCoordinateAxis descendents ( see documentation there )
2015-07-11 18:56:02 +08:00
* .
2019-01-26 03:16:04 +08:00
* If you want to set the axis properties , use getXAxis ( ) or getYAxis ( ) to get a pointer to the axis objects which then
2015-07-11 18:56:02 +08:00
* may be used to set the axis properties .
*
*
2019-01-29 05:14:27 +08:00
* \ section jkqtbaseplotter_appearance_and_style Appearance & Styling of the Graph
2015-07-11 18:56:02 +08:00
*
*
2019-02-08 00:24:46 +08:00
* \ subsection jkqtplotter_base_plotsize Plot Sizes & Borders
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* JKQTBasePlotter itself is no QWidget . It is merely tool to represent , manage and draw a graph onto any durface .
* JKQTPlotter then uses an internal JKQTBasePlotter instance to provide a QWidget .
*
* Still the JKQTBasePlotter needs a way to represent the location of the graph , the graph axes etc . inside
* a drawing rectangle ( of size widgetWidth * widgetHeight ) . The plot borders are then offsets to the plot
* indise that rectangele . This image illustrated the principle :
*
* \ image html plot_widget_orientation . png
*
* When the plot is actually drawn , it may happen , that additional elements need to be positioned between the
* actual coordinate rectangle and the widget worder ( e . g . axis labels , ticks , color bars etc . ) . Therefore
* this objects manages a set of internally calculated variables that also incorporate those dynamic elements .
* These are e . g . internalPlotBorderLeft , internalPlotBorderTop , internalPlotBorderRight , . . . Their names all
* start with \ c internal . . . .
2015-07-11 18:56:02 +08:00
*
*
2019-01-29 05:14:27 +08:00
* \ subsection jkqtplotter_base_aspectratios Aspect Ratios
* First note that this functionality is only available and activated if both axes are linear !
*
* You can set two different aspect ratios :
* - The ratio of plotWidth / plotHeight ( setAspectRatio ( ) , setMaintainAspectRatio ( ) ) will keep the plots pixel - width and height at a certain value .
2020-09-12 05:19:31 +08:00
* \ f [ \ mbox { aspectRatio } = \ frac { \ mbox { plotWidth } } { \ mbox { plotHeight } } \ f ]
2019-01-29 05:14:27 +08:00
* - The ratio of ( xmax - xmin ) / ( ymax - ymin ) ( setAxisAspectRatio ( ) , setMaintainAxisAspectRatio ( ) ) will keep the displayed axis ranges in a certain ratio .
2020-09-12 05:19:31 +08:00
* \ f [ \ mbox { axisAspectRatio } = \ frac { \ left | x_ \ text { max } - x_ \ text { min } \ right | } { \ left | y_ \ text { max } - y_ \ text { min } \ right | } \ f ]
2019-01-29 05:14:27 +08:00
* .
* So to achieve different effects , use these combinations :
* - you have a 200 x100 range where each 1 x1 - pixel should have an aspect ratio of 4 :
* \ code
* setAspectRatio ( 200.0 / 100.0 ) ;
* setAxisAspectRatio ( 4.0 * getAspectRatio ( ) ) ;
* \ endcode
* .
*
*
2019-02-08 00:24:46 +08:00
* \ subsection jkqtplotter_base_key Graph Keys ( Legends )
* This class provides means to plot a key together with the functions . The plotting is only partially implemented in this base class , and has to be
* implemented by child classes , as no graph management , that could provide a title for a specific graph , is implemented here . Key Plotting is
* performed in the plotKey ( ) method . This method basically draws a frame and background and then calls plotKeyContent ( ) to draw the actual contents .
* The size of the key is determined by a call to getKeyExtent ( ) , while it ' s position and plotting style is determined by the \ c key_ . . . parameters .
* If getKeyExtent ( ) returns 0 for height or width , no key is plotted . The \ c key_ . . . parameters are designed to be rather common for any usual kind
* of key , so any implementation of key should be able to use them to parametrize the output . Note however that additional parameters might be defined
* in child classes .
*
* \ image html plot_key . png
*
* As it may be convenient to position the key completely outside the graph this class may change the plotBorders to make the key fit outside
* SO if you use a keyPosition \ b outside the graph you should NOT keep any space for the key in the margins , as the program will change them to
* accomodate the size of the key . If you select an \ b inside key position the key will be plotted OVER the graph , i . e . the margins won ' t be changed
* Note that the margin change is internal and not visible in the class interface !
*
2019-05-30 17:19:56 +08:00
* There is also a possibility to determine the size of the key automatically , so all text fits in . This is activted by the property keyAutosize ( \ copybrief JKQTPKeyStyle : : autosize ) . If this
2019-02-08 00:24:46 +08:00
* is \ c true the function getKeyExtent ( ) has to check the width of every key item and take it into account when calculating the width and height of the
* key content . By default this feature is switched ON .
*
*
2019-01-29 05:14:27 +08:00
* \ section jkqtbaseplotter_dataexport_print Printing , Saving & Exporting
*
* \ subsection jkqtplotter_base_saveprint Saving and Printing Graphs
2015-07-11 18:56:02 +08:00
* This class implement a set of function to save and print the graphs :
* - print ( ) prints the graph on a QPrinter object
* - saveAsPixelImage ( ) saves the plot into a pixel image file ( PNG , TIFF , . . . formats , as supported by Qt )
* - saveAsPDF ( ) saves the graph as a PDF file ( using the Qt printing engine )
* - saveAsSVG ( ) saves the graph as a SVG file ( using the Qt SVG library )
2019-01-29 05:14:27 +08:00
* - saveImage ( ) saves the graph
* .
* You can also copy the contents of the plot into the clipboard :
* - copyPixelImage ( )
* .
*
* \ subsection jkqtplotter_base_dataexport Exporting Graph Data
* This class implement a set of function to save the data of the graphs :
* - saveData ( ) saves the data of the plot
2015-07-11 18:56:02 +08:00
* - saveAsCSV ( ) saves the data of the plot as comma separated values
* - saveAsSYLK ( ) saves the data of the plot as SYLK spreadsheet
* - saveAsDIF ( ) saves the data of the plot as data interchange format file
2019-01-29 05:14:27 +08:00
* - saveAsMatlab ( ) saves the data of the plot as a CSV file suitable for Matlab
* - saveAsSemicolonSV ( ) saves the data of the plot as a Semicolon Separated Values ( SSV )
* - saveAsTabSV ( ) saves the data of the plot as a Tabulator Separated Values ( CSV ) file
* - saveAsGerExcelCSV ( ) saves the data of the plot as a Text file ( SSV ) suitable for german excel , i . e . with comma as decimal separator
* .
* You can also copy the graphs ' data into the clipboard :
* - copyData ( )
* - copyDataMatlab ( )
2015-07-11 18:56:02 +08:00
* .
*
2019-01-29 05:14:27 +08:00
*
2019-02-03 21:04:48 +08:00
* \ section JKQTBASEPLOTTER_SYNCMULTIPLOT Synchronizing Several Plots
*
* Often a single plot is not sufficient , but several plots need to be aligned with respect to each other :
*
* \ image html test_multiplot . png
*
* This can be achieved by putting several JKQTPlotter instances into a
* < a href = " http://doc.qt.io/qt-5/layout.html " > Qt Layout < / a > . Then you can fill each plot differently and
* set the x - / y - range of each plot by hand . This method works for simple cases , but has several drawbacks :
* - Due to the independent and automatic layouting of each plot , the axes do not need to be aligned properly < br >
* \ image html jkqtbaseplotter_synchronization_unequalaxes . png
* - When you print the plot , the printing does not know about the layout and the other plots in it . Therefor
* it will only print the plot itself . < br >
* \ image html jkqtbaseplotter_synchronization_nogridprint . png " Printing with grid-printing-mode deactivated " < br >
* \ image html jkqtbaseplotter_synchronization_withgridprint . png " Printing with grid-printing-mode activated "
* - when you zoom / pan in one of the plots ( e . g . using the mouse ) , the other plots will not adapt their
* axes to match the new area , but especially in cases as in the image above it would be beneficial ,
* that tha x - axis of the plot at the bottom follows the x - axis of the plot above etc . < br >
* \ image html jkqtbaseplotter_synchronization_nonsyncedxrange . png
* .
*
*
* To overcome these limitations , JKQTPlotter ( and JKQTBasePlotter ) offer an API with which you can declare relations between
* different plots ( one of them is made the master ) and you can synchronize the axes of two plots , when
* zooming ( also when calling e . g . zoomToFit ( ) or setXY ( ) ) . This API is :
* - \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_SYNC
* - \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT
* .
*
* \ subsection JKQTBASEPLOTTER_SYNCMULTIPLOT_SYNC Synchronizing Axis Range & Plot Width
*
* You can synchronize the plot width and axis range between two JKQTPlotter instaces using :
* - synchronizeToMaster ( ) / JKQTBasePlotter : : synchronizeToMaster ( ) synchronizes the parent JKQTPlotter with another JKQTPlotter . With two boolean - parameters
* you can specify the axes to be synchronized . E . g . in the case above , you would call :
* \ code
* // synchronize width/x-axis of plotResid to width/x-axis of plotMain
* plotResid - > synchronizeToMaster ( plotMain , JKQTBasePlotter : : sdXAxis , true , true , true ) ;
*
* // synchronize y-axis of width/plotResidHist to y-axis of width/plotResid
* plotResidHist - > synchronizeToMaster ( plotResid , JKQTBasePlotter : : sdYAxis , true , true , true ) ;
* \ endcode
* This will synchronize the x - axes of the top ( \ c plotMain ) and bottom - left plot ( \ c plotResid ) ,
* as well as the y - axes of the bottom - left ( \ c plotResid ) and bottom - right plot ( \ c plotResidHist ) .
* After this call they will have the same size in screen pixels and always span the same range
* in plot coordinates .
* - synchronizeXToMaster ( ) / JKQTBasePlotter : : synchronizeXToMaster ( ) like synchronizeToMaster ( ) / JKQTBasePlotter : : synchronizeToMaster ( ) ,
* but synchronizes only the x - axes
* - synchronizeYToMaster ( ) / JKQTBasePlotter : : synchronizeYToMaster ( ) like synchronizeToMaster ( ) / JKQTBasePlotter : : synchronizeToMaster ( ) ,
* but synchronizes only the y - axes
* - resetMasterSynchronization ( ) / JKQTBasePlotter : : resetMasterSynchronization ( ) deletes all synchronizations
* from the JKQTPlotter
* .
*
* \ see See \ ref JKQTPlotterMultiPlotLayout for an extensive example of the functionality .
*
*
* \ subsection JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT Grid Printing / Desclaring Relations between Plots
*
* Usually each JKQTPlotter / JKQTBasePlotter prints or exports only itself . But in many cases you might want to
* add several plots that form a grid layout and also want to export them as one image / print them on one page .
* To do this , JKQTPlotter / JKQTBasePlotter offers the < b > " grid printing " mode < / b > . In this mode , you can declare
* relations between different JKQTPlotters / JKQTBasePlotters by putting them in a rectangular grid ( like in a
* < a reh = " http://doc.qt.io/qt-5/qgridlayout.html " > QGridLayout < / a > ) . then any export / print action will draw all ( explicitly )
* decalred graphs .
*
* \ image html jkqtplotter_gridprint . png
*
* The grid printing API is composed of these functions :
* - setGridPrinting ( ) enables grid printing for this JKQTPlotter . If set to \ c true , and you print afterwards ,
* the printout ( or export ) will not only contain the plot itself , but also additional plots that were
* declared using addGridPrintingPlotter ( ) ( see below ) .
* - addGridPrintingPlotter ( ) add a new plotter \ a plotterOther for grid printing mode , at location \ a x / \ a y
* E . g . in the example shown above , you could call :
* \ code
* plotMain - > setGridPrinting ( true ) ;
* plotMain - > addGridPrintingPlotter ( 0 , 1 , plotResid ) ;
* plotMain - > addGridPrintingPlotter ( 1 , 1 , plotResidHist ) ;
* \ endcode
* - setGridPrintingCurrentX ( ) / setGridPrintingCurrentY ( ) / setGridPrintingCurrentPos ( )
* sets the location of the calling plot inside the grid . < i > By default each plot assumes to be at ( 0 , 0 ) . < / i >
* - clearGridPrintingPlotters ( ) clear all additional plotters for grid printing mode
* .
*
* \ see See \ ref JKQTPlotterMultiPlotLayout for an extensive example of the functionality .
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
2015-07-11 18:56:02 +08:00
*
* \ section jkqtplotter_base_userprops User Properties
* There is a subset of options that describe how the user interacted with the plotter ( export / print scaling factors etc , save directories ,
* other export settings , . . . ) . These are not stored / loaded using saveSettings ( ) and loadSettings ( ) , but using saveUserSettings ( ) and loadUserSettings ( ) .
2019-01-26 20:00:40 +08:00
* These methods MAY ( strictly optional and turned off by default ) be called by saveSettings ( ) and loadSettings ( ) , if the property userSettigsFilename ( \ copybrief userSettigsFilename ) is
2015-07-11 18:56:02 +08:00
* set ( not - empty ) . In this case the suer settings are stored / loaded also everytime they are changed by the user or programmatically .
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter : public QObject {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
typedef QMap < QString , QList < QPointer < QAction > > > AdditionalActionsMap ;
typedef QMapIterator < QString , QList < QPointer < QAction > > > AdditionalActionsMapIterator ;
2019-02-08 00:24:46 +08:00
/** \brief set a global preset/default value for the userSettigsFilename and userSettigsPrefix properties of JKQTBasePlotter
*
* These presets are application global and will be used ONLY on initialization of a JKQTBasePlotter . You can overwrite them
* on a local - basis for each JKQTBasePrinter separately . The changed values from this function call will only take effect for
* newly created plotters AFTER the function call !
*/
static void setDefaultJKQTBasePrinterUserSettings ( QString userSettigsFilename , const QString & userSettigsPrefix ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief register a user-defined QPaintDevice (with factory JKQTPPaintDeviceAdapter) as a plugin to JKQTBasePlotter/JKQTPlotter,
* which will use it to export graphics */
static void registerPaintDeviceAdapter ( JKQTPPaintDeviceAdapter * adapter ) ;
/** \brief de-register a JKQTPPaintDeviceAdapter from JKQTBasePlotter/JKQTPlotter */
static void deregisterPaintDeviceAdapter ( JKQTPPaintDeviceAdapter * adapter ) ;
2018-11-18 18:59:30 +08:00
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief register a JKQTPSaveDataAdapter with JKQTPlotter/JKQTBasePlotter that can be used to export data from the internal datastore into a file */
static bool registerSaveDataAdapter ( JKQTPSaveDataAdapter * adapter ) ;
/** \brief de-register a JKQTPSaveDataAdapter from JKQTPlotter/JKQTBasePlotter */
static bool deregisterSaveDataAdapter ( JKQTPSaveDataAdapter * adapter ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief class constructor
*
* if \ a datastore_internal is \ c true then the constructor will create an internal datastore object . The datastore
* will be managed ( freed ) by this class . If \ a datastore_internal is \ c false the class will use tha datastore provided
* in \ a datast as an external datastore . You can modify this later by using useInternalDatastore ( ) and useExternalDatastore ( ) .
*/
explicit JKQTBasePlotter ( bool datastore_internal , QObject * parent = nullptr , JKQTPDatastore * datast = nullptr ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
JKQTBasePlotter ( ) = delete ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief class destructor */
virtual ~ JKQTBasePlotter ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns a pointer to the datastore used by this object */
inline JKQTPDatastore * getDatastore ( ) { return datastore ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns model representing all Plots in this plotter and showing their visible/invisible state */
inline JKQTPGraphsModel * getPlotsModel ( ) { return m_plotsModel ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns a pointer to the datastore used by this object */
inline const JKQTPDatastore * getDatastore ( ) const { return datastore ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns model representing all Plots in this plotter and showing their visible/invisible state */
inline const JKQTPGraphsModel * getPlotsModel ( ) const { return m_plotsModel ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief 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 .
*/
void useExternalDatastore ( JKQTPDatastore * newStore ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief tells the plotter object to use the given external datastore and treat it as an internal one (i.e. free it
* when the plotter object ist destroyed .
*/
void useAsInternalDatastore ( JKQTPDatastore * newStore ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief tells the plotter object to use an internal datastore. A new internal datastore object is generated only if
* the current datastore is not internal .
*/
void useInternalDatastore ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief 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 */
void forceInternalDatastore ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate() */
bool isEmittingSignalsEnabled ( ) const ;
/** \brief specifies whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate() */
void setEmittingSignalsEnabled ( bool enabled ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief loads all the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object */
void loadSettings ( const QSettings & settings , const QString & group = QString ( " plots/ " ) ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
*
* This method only saves those properties that differ from their default value .
*/
void saveSettings ( QSettings & settings , const QString & group = QString ( " plots/ " ) ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief current style properties for this JKQTBasePlotter
*
* \ see JKQTPSetSystemDefaultBaseStyle ( ) , JKQTPSetSystemDefaultBaseStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
const JKQTBasePlotterStyle & getCurrentPlotterStyle ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief replace the current style properties for this JKQTBasePlotter
*
* \ see JKQTPSetSystemDefaultBaseStyle ( ) , JKQTPSetSystemDefaultBaseStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
void setCurrentPlotterStyle ( const JKQTBasePlotterStyle & style ) ;
/** \brief replace the current style properties for this JKQTBasePlotter with properties loaded from \a settings
*
* \ param settings the QSettings object to read from
* \ param group group in \ a settings to read from
*
* \ see JKQTPSetSystemDefaultBaseStyle ( ) , JKQTPSetSystemDefaultBaseStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
2022-04-21 19:51:50 +08:00
void loadCurrentPlotterStyle ( const QSettings & settings , const QString & group = " plots/ " ) ;
2019-02-08 00:24:46 +08:00
/** \brief store the current style properties for this JKQTBasePlotter with properties loaded from \a settings
*
* \ param settings the QSettings object to write to
* \ param group group in \ a settings to write to
*
* \ see JKQTPSetSystemDefaultBaseStyle ( ) , JKQTPSetSystemDefaultBaseStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
2022-04-21 19:51:50 +08:00
void saveCurrentPlotterStyle ( QSettings & settings , const QString & group = " plots/ " ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief loads the plot user properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object */
void loadUserSettings ( const QSettings & settings , const QString & group = QString ( " plots_user/ " ) ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief saves the plot user properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object. */
void saveUserSettings ( QSettings & settings , const QString & group = QString ( " plots_user/ " ) ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief gets the width of the plot widget */
int getWidth ( ) ;
2019-01-26 19:28:44 +08:00
2019-02-08 00:24:46 +08:00
/** \brief gets the width of the plot widget */
int getHeight ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the current x-axis min */
double getXMin ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the current x-axis max */
double getXMax ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the current y-axis min */
double getYMin ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the current y-axis max */
double getYMax ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the given size in Didot points (0.376 mm) to pixels (with given dots per inch) */
inline double didot2px ( double pt , double dpi ) const {
return dpi / 25.4 * 0.376 * pt ;
}
/** \brief returns the given size in Didot points (0.376 mm) to pixels (with dpi from painter) */
inline double didot2px ( double pt , JKQTPEnhancedPainter & painter ) const {
return didot2px ( pt , painter . device ( ) - > logicalDpiX ( ) ) ;
}
/** \brief returns the given size in Didot points (0.376 mm) to pixels (with dpi from painter) */
inline double didot2px ( JKQTPEnhancedPainter & painter , double pt ) const {
return didot2px ( pt , painter . device ( ) - > logicalDpiX ( ) ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the given size in DTP points points (1/72inch = 0.353mm) to pixels (with given dots per inch) */
inline double pt2px ( double pt , double dpi ) const {
return dpi * pt / 72.0 ;
}
/** \brief returns the given size in DTP points points (1/72inch = 0.353mm) to pixels (with given dots per inch) */
inline double pt2px ( double pt , JKQTPEnhancedPainter & painter ) const {
return pt2px ( pt , painter . device ( ) - > logicalDpiX ( ) ) ;
}
/** \brief returns the given size in DTP points points (1/72inch = 0.353mm) to pixels (with given dots per inch) */
inline double pt2px ( JKQTPEnhancedPainter & painter , double pt ) const {
return pt2px ( pt , painter . device ( ) - > logicalDpiX ( ) ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the given size in millimeters to pixels (with given dots per inch) */
inline double mm2px ( double mm , double dpi ) const {
return dpi * mm / 25.4 ;
}
/** \brief returns the given size in millimeters to pixels (with given dots per inch) */
inline double mm2px ( double mm , JKQTPEnhancedPainter & painter ) const {
return mm2px ( mm , painter . device ( ) - > logicalDpiX ( ) ) ;
}
/** \brief returns the given size in millimeters to pixels (with given dots per inch) */
inline double mm2px ( JKQTPEnhancedPainter & painter , double mm ) const {
return mm2px ( mm , painter . device ( ) - > logicalDpiX ( ) ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the absolute x-axis min */
double getAbsoluteXMin ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the absolute x-axis max */
double getAbsoluteXMax ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the absolute y-axis min */
double getAbsoluteYMin ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the absolute y-axis max */
double getAbsoluteYMax ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief add a new plotter for grid printing mode */
void addGridPrintingPlotter ( size_t x , size_t y , JKQTBasePlotter * plotter ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief clear all additional plotters for grid printing mode */
void clearGridPrintingPlotters ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief return x-pixel coordinate from time coordinate */
inline double x2p ( double x ) const {
return xAxis - > x2p ( x ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief return y-pixel coordinate from y coordinate */
inline double y2p ( double y ) const {
return yAxis - > x2p ( y ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief return time coordinate coordinate from x-pixel */
inline double p2x ( double x ) const {
return xAxis - > p2x ( x ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief return y coordinate coordinate from y-pixel */
inline double p2y ( double y ) const {
return yAxis - > p2x ( y ) ;
}
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles */
int getNextStyle ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief represents a pen, when plotting in JKQTPlotter/JKQTBasePlotter
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see getPlotStyle ( )
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPPen {
2019-02-08 00:24:46 +08:00
protected :
QColor m_color ;
QColor m_fillColor ;
2019-04-22 19:27:50 +08:00
QColor m_symbolFillColor ;
2019-02-08 00:24:46 +08:00
QColor m_errorColor ;
QColor m_errorFillColor ;
double m_width ;
double m_errorWidth ;
double m_symbolLineWidth ;
Qt : : PenStyle m_style ;
double m_symbolSize ;
Qt : : BrushStyle m_fillStyle ;
Qt : : BrushStyle m_errorFillStyle ;
JKQTPGraphSymbols m_symbol ;
public :
JKQTPPen ( ) ;
void setSymbolSize ( double w ) ;
void setSymbolLineWidthF ( double w ) ;
void setWidthF ( double w ) ;
void setWidth ( double w ) ;
2019-05-06 01:31:20 +08:00
void setErrorLineWidth ( double w ) ;
2019-02-08 00:24:46 +08:00
double width ( ) const ;
double widthF ( ) const ;
double errorWidthF ( ) const ;
double symbolLineWidthF ( ) const ;
double symbolSize ( ) const ;
QColor color ( ) const ;
QColor errorColor ( ) const ;
QColor errorFillColor ( ) const ;
void setColor ( const QColor & col ) ;
Qt : : PenStyle style ( ) const ;
Qt : : PenStyle errorStyle ( ) const ;
void setStyle ( Qt : : PenStyle s ) ;
QColor fillColor ( ) const ;
void setFillColor ( const QColor & col ) ;
void setErrorFillColor ( const QColor & col ) ;
2019-05-06 01:31:20 +08:00
void setErrorLineColor ( const QColor & col ) ;
2019-02-08 00:24:46 +08:00
void setFillStyle ( Qt : : BrushStyle s ) ;
void setErrorFillStyle ( Qt : : BrushStyle s ) ;
Qt : : BrushStyle fillStyle ( ) const ;
Qt : : BrushStyle errorFillStyle ( ) const ;
JKQTPGraphSymbols symbol ( ) const ;
2019-04-22 19:27:50 +08:00
void setSymbolType ( JKQTPGraphSymbols symbol ) ;
void setSymbolFillColor ( QColor c ) ;
QColor symbolFillColor ( ) const ;
2019-02-08 00:24:46 +08:00
} ;
2015-07-11 18:56:02 +08:00
2020-09-26 21:58:58 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns a QPen object for the i-th plot style */
2020-09-26 21:58:58 +08:00
JKQTPPen getPlotStyle ( int i , JKQTPPlotStyleType type = JKQTPPlotStyleType : : Default ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter
\ param painter JKQTPEnhancedPainter to which the plot should be drawn
\ param rect rectangle to plot into
*/
2020-09-09 17:26:04 +08:00
void draw ( JKQTPEnhancedPainter & painter , const QRect & rect ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter
\ param painter JKQTPEnhancedPainter to which the plot should be drawn
\ param pos where to plot the painter ( left - top corner )
*/
2020-09-09 17:26:04 +08:00
void draw ( JKQTPEnhancedPainter & painter , const QPoint & pos = QPoint ( 0 , 0 ) ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter
\ param painter JKQTPEnhancedPainter to which the plot should be drawn
\ param rect rectangle to plot into
*/
2020-09-09 17:26:04 +08:00
void drawNonGrid ( JKQTPEnhancedPainter & painter , const QRect & rect ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter
\ param painter JKQTPEnhancedPainter to which the plot should be drawn
\ param pos where to plot the painter ( left - top corner )
*/
2020-09-09 17:26:04 +08:00
void drawNonGrid ( JKQTPEnhancedPainter & painter , const QPoint & pos = QPoint ( 0 , 0 ) ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief emit plotUpdated() */
void redrawPlot ( ) { if ( emitPlotSignals ) emit plotUpdated ( ) ; }
2015-07-11 18:56:02 +08:00
2020-09-09 17:26:04 +08:00
/** \brief controls, whether the signals plotUpdated() are emitted */
2019-02-08 00:24:46 +08:00
void setEmittingPlotSignalsEnabled ( bool __value ) ;
2020-09-09 17:26:04 +08:00
/** \brief returns, whether the signals plotUpdated() are emitted */
2019-02-08 00:24:46 +08:00
bool isEmittingPlotSignalsEnabled ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBorderTop */
int getPlotBorderTop ( ) const ;
/** \copydoc JKQTBasePlotterStyle::plotBorderLeft */
int getPlotBorderLeft ( ) const ;
/** \copydoc JKQTBasePlotterStyle::plotBorderBottom */
int getPlotBorderBottom ( ) const ;
/** \copydoc JKQTBasePlotterStyle::plotBorderRight */
int getPlotBorderRight ( ) const ;
2020-09-12 05:19:31 +08:00
/** \brief returns whether the maintaining of the data aspect ratio is enabled or disabled \see aspectRatio */
2019-02-08 00:24:46 +08:00
bool doesMaintainAspectRatio ( ) const ;
2020-09-12 05:19:31 +08:00
/** \brief returns the data aspect ratio, enforced with setMaintainApsectRatio(true) \see aspectRatio */
2019-02-08 00:24:46 +08:00
double getAspectRatio ( ) const ;
2020-09-12 05:19:31 +08:00
/** \brief returns whether the maintaining of the axis aspect ratio is enabled or disabled \see axisAspectRatio */
2019-02-08 00:24:46 +08:00
bool doesMaintainAxisAspectRatio ( ) const ;
2020-09-12 05:19:31 +08:00
/** \brief returns the axis aspect ratio, enforced with setMaintainAxisApsectRatio(true) \see axisAspectRatio */
2019-02-08 00:24:46 +08:00
double getAxisAspectRatio ( ) const ;
/** \copydoc JKQTBasePlotterStyle::useAntiAliasingForSystem */
bool isUsingAntiAliasingForSystem ( ) const ;
2022-04-24 19:23:59 +08:00
/** \copydoc JKQTGraphsBaseStyle::useAntiAliasingForGraphs */
2019-02-08 00:24:46 +08:00
bool isUsingAntiAliasingForGraphs ( ) const ;
/** \copydoc JKQTBasePlotterStyle::useAntiAliasingForText */
bool isUsingAntiAliasingForText ( ) const ;
2019-04-25 01:33:51 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
2019-02-08 00:24:46 +08:00
QColor getBackgroundColor ( ) const ;
2019-04-25 01:33:51 +08:00
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
2019-02-08 00:24:46 +08:00
QColor getExportBackgroundColor ( ) const ;
2019-04-25 01:33:51 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
2019-02-08 00:24:46 +08:00
QColor getPlotBackgroundColor ( ) const ;
2019-04-25 01:33:51 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
QBrush getBackgroundBrush ( ) const ;
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
QBrush getExportBackgroundBrush ( ) const ;
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
QBrush getPlotBackgroundBrush ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::fontSize */
2019-02-08 00:24:46 +08:00
double getKeyFontSize ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::itemWidth */
2019-02-08 00:24:46 +08:00
double getKeyItemWidth ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::itemHeight */
2019-02-08 00:24:46 +08:00
double getKeyItemHeight ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::ySeparation */
2019-02-08 00:24:46 +08:00
double getKeyYSeparation ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::sampleLineLength */
2019-02-08 00:24:46 +08:00
double getKeyLineLength ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::xMargin */
2019-02-08 00:24:46 +08:00
double getKeyXMargin ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::yMargin */
2019-02-08 00:24:46 +08:00
double getKeyYMargin ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::xSeparation */
2019-02-08 00:24:46 +08:00
double getKeyXSeparation ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::xOffset */
2019-02-08 00:24:46 +08:00
double getKeyXOffset ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::yOffset */
2019-02-08 00:24:46 +08:00
double getKeyYOffset ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::visible */
2019-02-08 00:24:46 +08:00
bool getShowKey ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameVisible */
2019-02-08 00:24:46 +08:00
bool getShowKeyFrame ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameColor */
2019-02-08 00:24:46 +08:00
QColor getKeyFrameColor ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-02-08 00:24:46 +08:00
QColor getKeyBackgroundColor ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-04-25 01:33:51 +08:00
QBrush getKeyBackgroundBrush ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::textColor */
2019-02-08 00:24:46 +08:00
QColor getKeyTextColor ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameWidth */
2019-02-08 00:24:46 +08:00
double getKeyFrameWidth ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameRounding */
2019-02-08 00:24:46 +08:00
double getKeyFrameRounding ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::autosize */
2019-02-08 00:24:46 +08:00
bool getKeyAutosize ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::position */
2019-02-08 00:24:46 +08:00
JKQTPKeyPosition getKeyPosition ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::layout */
2019-02-08 00:24:46 +08:00
JKQTPKeyLayout getKeyLayout ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::defaultTextColor */
2019-02-08 00:24:46 +08:00
QColor getDefaultTextColor ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::defaultFontSize */
2019-02-08 00:24:46 +08:00
double getDefaultTextSize ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::defaultFontName */
2019-02-08 00:24:46 +08:00
QString getDefaultTextFontName ( ) const ;
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...)
2022-06-03 05:05:58 +08:00
*
*
* \ image html debugShowRegionBoxes . png
2019-02-08 00:24:46 +08:00
*
* \ see JKQTBasePlotterStyle : : debugShowRegionBoxes , enableDebugShowRegionBoxes ( )
*/
bool isDebugShowRegionBoxesEnabled ( ) const ;
2022-06-03 05:05:58 +08:00
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the extent of text
*
* \ image html debugShowTextBoxes . png
*
* \ see JKQTBasePlotterStyle : : debugShowTextBoxes , enableDebugShowTextBoxes ( )
*/
bool isDebugShowTextBoxesEnabled ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameVisible */
2019-02-08 00:24:46 +08:00
bool isPlotFrameVisible ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameColor */
2019-02-08 00:24:46 +08:00
QColor getPlotFrameColor ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameWidth */
2019-02-08 00:24:46 +08:00
double getPlotFrameWidth ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameRounding */
2019-02-08 00:24:46 +08:00
double getPlotFrameRounding ( ) const ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotLabelFontSize */
2019-02-08 00:24:46 +08:00
double getPlotLabelFontSize ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotLabelFontName */
2019-02-08 00:24:46 +08:00
QString getplotLabelFontName ( ) const ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc plotLabel */
2019-02-08 00:24:46 +08:00
QString getPlotLabel ( ) const ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc gridPrinting */
2019-02-08 00:24:46 +08:00
void setGridPrinting ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc gridPrinting */
2019-02-08 00:24:46 +08:00
bool getGridPrinting ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc gridPrintingCurrentX */
2019-02-08 00:24:46 +08:00
void setGridPrintingCurrentX ( size_t __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc gridPrintingCurrentX */
2019-02-08 00:24:46 +08:00
size_t getGridPrintingCurrentX ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc gridPrintingCurrentY */
2019-02-08 00:24:46 +08:00
void setGridPrintingCurrentY ( size_t __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc gridPrintingCurrentY */
2019-02-08 00:24:46 +08:00
size_t getGridPrintingCurrentY ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid
*
2019-05-30 17:19:56 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentX ( ) , setGridPrintingCurrentY ( )
2019-02-08 00:24:46 +08:00
*/
void setGridPrintingCurrentPos ( size_t x , size_t y ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the current directory in which to open SaveAs ... dialogs */
QString getCurrentSaveDirectory ( ) const ;
/** \brief return the last file format to use in SaveAs ... dialogs */
QString getCurrentFileFormat ( ) const ;
/** \brief returns the decimal separator used when exporting data to text files */
QString getCSVdecimalSeparator ( ) const ;
/** \brief set the string used to introduce comments in text output when exporting data */
QString getCSVcommentInitializer ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderTop */
2019-02-08 00:24:46 +08:00
inline double getInternalPlotBorderTop ( ) const { return this - > internalPlotBorderTop ; }
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderLeft */
2019-02-08 00:24:46 +08:00
inline double getInternalPlotBorderLeft ( ) const { return this - > internalPlotBorderLeft ; }
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderBottom */
2019-02-08 00:24:46 +08:00
inline double getInternalPlotBorderBottom ( ) const { return this - > internalPlotBorderBottom ; }
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotBorderRight */
2019-02-08 00:24:46 +08:00
inline double getInternalPlotBorderRight ( ) const { return this - > internalPlotBorderRight ; }
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotWidth */
2019-02-08 00:24:46 +08:00
inline int getPlotWidth ( ) const { return this - > internalPlotWidth ; }
2020-09-21 19:47:54 +08:00
/** \copydoc internalPlotHeight */
2019-02-08 00:24:46 +08:00
inline int getPlotHeight ( ) const { return this - > internalPlotHeight ; }
/** \brief returns the internal JKQTMathText, used to render text with LaTeX markup */
JKQTMathText * getMathText ( ) ;
/** \brief returns the internal JKQTMathText, used to render text with LaTeX markup */
const JKQTMathText * getMathText ( ) const ;
/** \brief returns the x-axis objet of the plot */
JKQTPHorizontalAxis * getXAxis ( ) ;
/** \brief returns the y-axis objet of the plot */
JKQTPVerticalAxis * getYAxis ( ) ;
/** \brief returns the x-axis objet of the plot */
const JKQTPHorizontalAxis * getXAxis ( ) const ;
/** \brief returns the y-axis objet of the plot */
const JKQTPVerticalAxis * getYAxis ( ) const ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc actSavePlot */
2019-02-08 00:24:46 +08:00
QAction * getActionSavePlot ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actSaveData */
2019-02-08 00:24:46 +08:00
QAction * getActionSaveData ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actCopyData */
2019-02-08 00:24:46 +08:00
QAction * getActionCopyData ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actCopyPixelImage */
2019-02-08 00:24:46 +08:00
QAction * getActionCopyPixelImage ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actCopyMatlab */
2019-02-08 00:24:46 +08:00
QAction * getActionCopyMatlab ( ) const ;
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
/** \copydoc actSavePDF */
2019-02-08 00:24:46 +08:00
QAction * getActionSavePDF ( ) const ;
2022-07-19 05:33:20 +08:00
/** \copydoc actSaveSVG */
2019-02-08 00:24:46 +08:00
QAction * getActionSaveSVG ( ) const ;
2022-07-19 05:33:20 +08:00
/** \copydoc actPrint */
2019-02-08 00:24:46 +08:00
QAction * getActionPrint ( ) const ;
2022-07-19 05:33:20 +08:00
# endif
/** \copydoc actSavePix */
QAction * getActionSavePix ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actSaveCSV */
2019-02-08 00:24:46 +08:00
QAction * getActionSaveCSV ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actZoomAll */
2019-02-08 00:24:46 +08:00
QAction * getActionZoomAll ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actZoomIn */
2019-02-08 00:24:46 +08:00
QAction * getActionZoomIn ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actZoomOut */
2019-02-08 00:24:46 +08:00
QAction * getActionZoomOut ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc actShowPlotData */
2019-02-08 00:24:46 +08:00
QAction * getActionShowPlotData ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc lstAdditionalPlotterActions */
2019-02-08 00:24:46 +08:00
AdditionalActionsMap getLstAdditionalPlotterActions ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief this function registers additional actions to lstAdditionalPlotterActions, which are displayed in the context-menu */
void registerAdditionalAction ( const QString & key , QAction * act ) ;
/** \brief this function deregisters an additional action, previously added with registerAdditionalAction()
*
* \ see registerAdditionalAction ( )
*/
void deregisterAdditionalAction ( QAction * act ) ;
2015-07-11 18:56:02 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc masterSynchronizeWidth */
2019-02-08 00:24:46 +08:00
bool getMasterSynchronizeWidth ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc masterSynchronizeHeight */
2019-02-08 00:24:46 +08:00
bool getMasterSynchronizeHeight ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc fontSizePrintMultiplier */
2019-02-08 00:24:46 +08:00
void setFontSizePrintMultiplier ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc fontSizePrintMultiplier */
2019-02-08 00:24:46 +08:00
double getFontSizePrintMultiplier ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidthPrintMultiplier */
2019-02-08 00:24:46 +08:00
void setLineWidthPrintMultiplier ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidthPrintMultiplier */
2019-02-08 00:24:46 +08:00
double getLineWidthPrintMultiplier ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc fontSizeMultiplier */
2019-02-08 00:24:46 +08:00
double getFontSizeMultiplier ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidthMultiplier */
2019-02-08 00:24:46 +08:00
double getLineWidthMultiplier ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns description of i'th graph */
JKQTPPlotElement * getGraph ( size_t i ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the number of graphs */
size_t getGraphCount ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief remove the i-th graph */
void deleteGraph ( size_t i , bool deletegraph = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief remove the given graph, if it is contained */
void deleteGraph ( JKQTPPlotElement * gr , bool deletegraph = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief remove all plots
*
* \ param deleteGraphs if set \ c true ( default ) the graph objects will also be deleted
*/
void clearGraphs ( bool deleteGraphs = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief set all graphs in the plotter invisible
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see setAllGraphsVisible ( ) , setGraphVisible ( ) , JKQTPPlotElement : : setVisible ( ) */
void setAllGraphsInvisible ( ) ;
/** \brief set all graphs in the plotter visible
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see setAllGraphsInvisible ( ) , setGraphVisible ( ) , JKQTPPlotElement : : setVisible ( ) */
void setAllGraphsVisible ( ) ;
/** \brief switch visibility of the \a i -th graph to \a visible
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see setAllGraphsInvisible ( ) , setAllGraphsVisible ( ) , JKQTPPlotElement : : setVisible ( ) */
void setGraphVisible ( int i , bool visible = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief add a new graph, returns it's position in the graphs list, if the graph is already in the plot, this returns the index in the list */
size_t addGraph ( JKQTPPlotElement * gr ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns \c true, if the given graph is in this plot */
bool containsGraph ( JKQTPPlotElement * gr ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief move the given graph to the top, or add it, if it is not yet contained */
size_t moveGraphTop ( JKQTPPlotElement * gr ) ;
/** \brief move the given graph to the top, or add it, if it is not yet contained */
size_t moveGraphBottom ( JKQTPPlotElement * gr ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief add a new graphs from a QVector<JKQTPPlotElement*>, QList<JKQTPPlotElement*>, std::vector<JKQTPPlotElement*> ... or any standard-iterateable container with JKQTPPlotElement*-items
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ tparam TJKQTPGraphContainer a container type with default C + + - sytle iterator interface
* ( i . e . methods \ c begin ( ) and \ c end ( ) and an iterator , which may be
* moved to the next element with the operator \ c + + .
* \ param gr Container of type TJKQTPGraphContainer , which contains the graphs \ b Note : The JKQTPlotter takes ownership of graphs in \ a gr .
* \ param [ out ] graphIDsOut optional output parameter , the vector will contain the IDs of each graph added to theis plot
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
template < class TJKQTPGraphContainer >
inline void addGraphs ( const TJKQTPGraphContainer & gr , QVector < size_t > * graphIDsOut = nullptr ) {
for ( auto it = gr . begin ( ) ; it ! = gr . end ( ) ; + + it ) {
const size_t g = addGraph ( * it ) ;
if ( graphIDsOut ) graphIDsOut - > push_back ( g ) ;
}
2015-07-11 18:56:02 +08:00
}
2019-02-08 00:24:46 +08:00
/** \brief get the maximum and minimum x-value over all graphs in the plot
* \ param [ out ] minx smallest x value
* \ param [ out ] maxx largest x value
* \ param [ out ] smallestGreaterZero smallest data point which is > 0 ( needed for scaling of logarithmic axes )
*
* The result is given in the two parameters which are call - by - reference parameters !
*/
void getGraphsXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) ;
/** \brief get the maximum and minimum y-value over all graphs in the plot
* \ param [ out ] miny smallest y value
* \ param [ out ] maxy largest y value
* \ param [ out ] smallestGreaterZero smallest data point which is > 0 ( needed for scaling of logarithmic axes )
*
* The result is given in the two parameters which are call - by - reference parameters !
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void getGraphsYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief denotes, which axes to synchronize in synchronizeToMaster() */
enum SynchronizationDirection {
sdXAxis , /**< \brief x-axis only */
sdYAxis , /**< \brief y-axis only */
sdXYAxes /**< \brief x- and y-axis */
} ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief synchronize the plot borders (and zooming) with a given plotter (master --> slave/this)
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
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
\ code plotter2 - > synchronizeToMaster ( plotter1 , sdXAxis , true ) \ endcode of the lower plotter \ c plotter2 .
Now whenever the size of plotter1 changes , also plotter2 is redrawn with the changed
borders .
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
\ param master the plotter widget to synchronize to
\ param synchronizeDirection direction in which to synchronize
\ param synchronizeAxisLength do you want the axis length to be synchronized ?
\ param synchronizeZoomingMasterToSlave if set , also zooming in the master leads to a modification of the linked axes in the slave
\ param synchronizeZoomingSlaveToMaster if set , also zooming in the slave leads to a modification of the linked axes in the master
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
\ see synchronizeXToMaster ( ) , synchronizeYToMaster ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
*/
void synchronizeToMaster ( JKQTBasePlotter * master , SynchronizationDirection synchronizeDirection , bool synchronizeAxisLength = true , bool synchronizeZoomingMasterToSlave = true , bool synchronizeZoomingSlaveToMaster = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief synchronize the plot x-axis width (and x-zooming) with a given master plotter (master --> slave/this)
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
\ param master the plotter widget to synchronize to
\ param synchronizeAxisLength do you want the axis length to be synchronized ?
\ param synchronizeZoomingMasterToSlave if set , also zooming in the master leads to a modification of the linked axes in the slave
\ param synchronizeZoomingSlaveToMaster if set , also zooming in the slave leads to a modification of the linked axes in the master
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
\ note This is a short - cut to synchronizeToMaster ( ) with \ c synchronizeDirection = csXAxis
\ see synchronizeToMaster ( ) , synchronizeYToMaster ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
*/
void synchronizeXToMaster ( JKQTBasePlotter * master , bool synchronizeAxisLength = true , bool synchronizeZoomingMasterToSlave = true , bool synchronizeZoomingSlaveToMaster = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/*! \brief synchronize the plot y-axis height (and y-zooming) with a given master plotter (master --> slave/this)
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
\ param master the plotter widget to synchronize to
\ param synchronizeAxisLength do you want the axis length to be synchronized ?
\ param synchronizeZoomingMasterToSlave if set , also zooming in the master leads to a modification of the linked axes in the slave
\ param synchronizeZoomingSlaveToMaster if set , also zooming in the slave leads to a modification of the linked axes in the master
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
\ note This is a short - cut to synchronizeToMaster ( ) with \ c synchronizeDirection = csXAxis
\ see synchronizeToMaster ( ) , synchronizeXToMaster ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
*/
void synchronizeYToMaster ( JKQTBasePlotter * master , bool synchronizeAxisLength = true , bool synchronizeZoomingMasterToSlave = true , bool synchronizeZoomingSlaveToMaster = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief switches any synchronization off, that has been created by synchronizeToMaster() */
void resetMasterSynchronization ( SynchronizationDirection synchronizeDirection = sdXYAxes ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a Comma Separated Values (CSV) file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
* \ param decimalSeparator decimal separator for outpu
* \ param commentInitializer line - start for comment lines
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void saveAsCSV ( const QString & filename , const QString & decimalSeparator , const QString & commentInitializer ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a Semicolon Separated Values (SSV) file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
* \ param decimalSeparator decimal separator for outpu
* \ param commentInitializer line - start for comment lines
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void saveAsSemicolonSV ( const QString & filename , const QString & decimalSeparator , const QString & commentInitializer ) ; /** \brief save the current plot data as a Tabulator Separated Values (CSV) file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
* \ param decimalSeparator decimal separator for outpu
* \ param commentInitializer line - start for comment lines
*/
void saveAsTabSV ( const QString & filename , const QString & decimalSeparator , const QString & commentInitializer ) ;
/** \brief internal tool class for text sizes
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
* \ internal */
2019-06-22 20:21:32 +08:00
struct JKQTPLOTTER_LIB_EXPORT textSizeData {
2019-02-08 00:24:46 +08:00
explicit textSizeData ( ) ;
double ascent , descent , width , strikeoutPos ;
} ;
/** \brief internal tool class for text-sizess in a plot key
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
* \ internal */
2019-06-22 20:21:32 +08:00
struct JKQTPLOTTER_LIB_EXPORT textSizeKey {
2019-02-08 00:24:46 +08:00
explicit textSizeKey ( const QFont & f , const QString & text , QPaintDevice * pd ) ;
explicit textSizeKey ( const QString & fontName , double fontSize , const QString & text , QPaintDevice * pd ) ;
QString text ;
QFont f ;
int ldpiX , ldpiY , pdpiX , pdpiY ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
bool operator = = ( const textSizeKey & other ) const ;
} ;
/** \brief calculates a textSizeData for the given string \a text if it would be drawn on \a painter with font \a fm
* \ internal
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
textSizeData getTextSizeDetail ( const QFont & fm , const QString & text , QPainter & painter ) ;
/** \brief calculates a textSizeData for the given string \a text if it would be drawn on \a painter with font \a fontName
* \ internal
*/
textSizeData getTextSizeDetail ( const QString & fontName , double fontSize , const QString & text , QPainter & painter ) ;
/** \brief calculates a text-size details for the given string \a text if it would be drawn on \a painter with font \a fontName and font size \a fontSize
* \ internal
*/
void getTextSizeDetail ( const QString & fontName , double fontSize , const QString & text , QPainter & painter , double & width , double & ascent , double & descent , double & strikeoutPos ) ;
/** \brief calculates a text-size details for the given string \a text if it would be drawn on \a painter with font \a fm
* \ internal
*/
void getTextSizeDetail ( const QFont & fm , const QString & text , QPainter & painter , double & width , double & ascent , double & descent , double & strikeoutPos ) ;
/** \brief calculates a size of the given string \a text if it would be drawn on \a painter with font \a fm
* \ internal
*/
QSizeF getTextSizeSize ( const QFont & fm , const QString & text , QPainter & painter ) ;
/** \brief calculates a size of the given string \a text if it would be drawn on \a painter with font \a fontName and font size \a fontSize
* \ internal
*/
QSizeF getTextSizeSize ( const QString & fontName , double fontSize , const QString & text , QPainter & painter ) ;
2015-07-11 18:56:02 +08:00
2020-09-12 05:19:31 +08:00
/** \brief takes a new axis range \a xminn ... \a xmaxx and \a yminn ... \a ymaxx and corrects the values to match the currently set axisAspectRatio
*
* This function is used by setXY ( ) , setX ( ) , setY ( ) .
*
* \ see axisAspectRatio , setXY ( ) , setX ( ) , setY ( )
*/
void correctXYRangeForAspectRatio ( double & xminn , double & xmaxx , double & yminn , double & ymaxx ) const ;
2019-02-08 00:24:46 +08:00
signals :
/** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse) */
void zoomChangedLocally ( double newxmin , double newxmax , double newymin , double newymax , JKQTBasePlotter * sender ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief emitted when the plot has to be updated */
void plotUpdated ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief emitted when the plot scaling had to be recalculated */
void plotScalingRecalculated ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief emitted before the plot scaling has been recalculated */
void beforePlotScalingRecalculate ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
public slots :
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the width of the plot widget
*
* \ image html plot_widget_orientation . png
*
* \ see setWidgetSize ( ) , \ ref jkqtplotter_base_plotsize
*/
void setWidgetWidth ( int wid ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief resize the plot
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
void setWidgetSize ( int width , int height ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the width of the plot widget
*
* \ image html plot_widget_orientation . png
*
* \ see setWidgetSize ( ) , \ ref jkqtplotter_base_plotsize
*/
void setWidgetHeight ( int heigh ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the borders of the plot
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
void setPlotBorder ( int left , int right , int top , int bottom ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the left border of the plot
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
void setPlotBorderLeft ( int left ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the right border of the plot
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
void setPlotBorderRight ( int right ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the top border of the plot
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void setPlotBorderTop ( int top ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets the bottom border of the plot
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
void setPlotBorderBottom ( int bottom ) ;
/** \brief sets the x-range of the plot (minimum and maximum x-value on the x-axis)
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute 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 setEmittingSignalsEnabled ( ) ) .
*
* \ see setY ( ) , setXY ( ) , zoomToFit ( ) , setAbsoluteXY ( ) , JKQTPlotter : : setY ( )
*/
void setX ( double xminn , double xmaxx ) ;
/** \brief sets the y-range of the plot (minimum and maximum y-value on the y-axis)
*
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute 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 setEmittingSignalsEnabled ( ) ) .
*
* \ see setX ( ) , setXY ( ) , zoomToFit ( ) , setAbsoluteXY ( ) , JKQTPlotter : : setX ( )
*/
void setY ( double yminn , double ymaxx ) ;
/** \brief sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute maximum of x - axis
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute 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 setEmittingSignalsEnabled ( ) ) .
*
* \ see setX ( ) , setX ( ) , zoomToFit ( ) , setAbsoluteXY ( ) , JKQTPlotter : : setXY ( )
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void setXY ( double xminn , double xmaxx , double yminn , double ymaxx ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets absolutely limiting x-range of the plot
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute 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 setAbsoluteXY ( ) , setAbsoluteY ( ) , JKQTPlotter : : setAbsoluteX ( )
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void setAbsoluteX ( double xminn , double xmaxx ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets absolute minimum and maximum y-value to plot
*
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute 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 setAbsoluteXY ( ) , setAbsoluteX ( ) , JKQTPlotter : : setAbsoluteY ( )
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void setAbsoluteY ( double yminn , double ymaxx ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief 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 .
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute maximum of x - axis
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute 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 setAbsoluteX ( ) , setAbsoluteY ( ) , zoomToFit ( ) , JKQTPlotter : : setAbsoluteXY ( )
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void setAbsoluteXY ( double xminn , double xmaxx , double yminn , double ymaxx ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets x/ymin and x/ymax to the supplied values and replots the graph (zoom operation!) */
void zoom ( double nxmin , double nxmax , double nymin , double nymax ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets whether to plot grid lines or not */
void setGrid ( bool val ) ;
2015-07-11 18:56:02 +08:00
2019-06-16 19:27:02 +08:00
/** \brief sets the color of all Major grid lines
* */
void setGridColor ( QColor color ) ;
/** \brief sets the color of all minor grid lines
* */
void setMinorGridColor ( QColor color ) ;
/** \brief sets the width of all Major grid lines
* */
void setGridWidth ( double __value ) ;
/** \brief sets the width of all minor grid lines
* */
void setMinorGridWidth ( double __value ) ;
/** \brief sets the style of all Major grid lines
* */
void setGridStyle ( Qt : : PenStyle __value ) ;
/** \brief sets the style of all minor grid lines
* */
void setMinorGridStyle ( Qt : : PenStyle __value ) ;
2019-06-12 19:00:28 +08:00
/** \brief switches the visibility of the zero-axes associated with the x- and y-axis
*
* \ param showX indicates whether to show the zero - axis associated with the x - axis ( i . e . x = = 0 or the vertical zero - axis )
* \ param showY indicates whether to show the zero - axis associated with the y - axis ( i . e . y = = 0 or the horizontal zero - axis )
* */
void setShowZeroAxes ( bool showX , bool showY ) ;
/** \brief switches the visibility of the zero-axes associated with the x- and y-axis
*
* \ param showXY indicates whether to show the zero - axis associated with the x - and y - axis
* */
void setShowZeroAxes ( bool showXY ) ;
2019-02-08 00:24:46 +08:00
/** \brief save the current plot as a pixel image image (PNG ...), if filename is empty a file selection dialog is displayed */
void saveAsPixelImage ( const QString & filename = QString ( " " ) , bool displayPreview = true , const QByteArray & outputFormat = QByteArray ( ) ) ;
2019-01-10 04:23:24 +08:00
2019-02-08 00:24:46 +08:00
/** \brief copy the current plot as a pixel image to the clipboard */
void copyPixelImage ( ) ;
2019-01-10 04:23:24 +08:00
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
/** \brief save the current plot as a SVG file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed
*
* \ note Exporting to SVG requires QPrinter - support , if it is not available on your platform , this function will not be available either !
*/
2019-02-08 00:24:46 +08:00
void saveAsSVG ( const QString & filename = QString ( " " ) , bool displayPreview = true ) ;
2019-01-10 04:23:24 +08:00
2022-07-19 05:33:20 +08:00
/** \brief save the current plot as a PDF file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed
*
* \ note Exporting to PDF requires QPrinter - support , if it is not available on your platform , this function will not be available either !
*/
2019-02-08 00:24:46 +08:00
void saveAsPDF ( const QString & filename = QString ( " " ) , bool displayPreview = true ) ;
2022-07-19 05:33:20 +08:00
# endif
2019-01-10 04:23:24 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot as an image file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed.
* The image format is extracted from the file extension ( jpeg , tiff , png , pdf , . . . ) */
void saveImage ( const QString & filename = QString ( " " ) , bool displayPreview = true ) ;
2019-01-10 04:23:24 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the data used for the current plot. The file format is extracted from the file extension (csv, ...)
*
* The parameter \ a format specifies the export format . if it is empty the format will be choosen according to the file extension , or
* if \ a filename is also empty the format will be choosen according to what is selected in the file selection dialog .
*
* If \ a format is \ c " slk " the output will be in SYLK format , if \ a format is \ c " csv " or \ a " dat " the output will be comma separated values
* and if \ a format is \ c " txt " the output will be tab separated values .
*/
void saveData ( const QString & filename = QString ( " " ) , const QString & jkqtp_format = QString ( " " ) ) ;
/** \brief copy the data used for the current plot to the clipboard
*
* copies data as tab separated data with the system - decimal point .
*/
void copyData ( ) ;
/** \brief copy the data used for the current plot to the clipboard in Matlab format
*/
void copyDataMatlab ( ) ;
/** \brief save the current plot data as a Comma Separated Values (CSV) file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*
* \ note this function uses CSVdecimalSeparator as decimal separator and CSVcommentInitializer to initialize content lines
*/
void saveAsCSV ( const QString & filename = QString ( " " ) ) ;
2019-01-10 04:23:24 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a Semicolon Separated Values (SSV) file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*
* \ note this function uses CSVdecimalSeparator as decimal separator and CSVcommentInitializer to initialize content lines
*/
void saveAsSemicolonSV ( const QString & filename = QString ( " " ) ) ;
2019-01-29 05:14:27 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a Tabulator Separated Values (CSV) file
2019-01-29 05:14:27 +08:00
*
2019-02-08 00:24:46 +08:00
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*
* \ note this function uses CSVdecimalSeparator as decimal separator and CSVcommentInitializer to initialize content lines
2019-01-29 05:14:27 +08:00
*/
2019-02-08 00:24:46 +08:00
void saveAsTabSV ( const QString & filename = QString ( " " ) ) ;
2019-01-29 05:14:27 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a DIF file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*/
void saveAsDIF ( const QString & filename = QString ( " " ) ) ;
2019-01-29 05:14:27 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a SYLK spreadsheet file
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*/
void saveAsSYLK ( const QString & filename = QString ( " " ) ) ;
2019-01-29 05:14:27 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a Matlab Script
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*/
void saveAsMatlab ( const QString & filename = QString ( " " ) ) ;
2019-01-10 04:23:24 +08:00
2019-02-08 00:24:46 +08:00
/** \brief save the current plot data as a Semicolon Separated Values (CSV) file for german Excel, i.e. with comma as decimal separator
*
* \ param filename the file to save to , if \ a filename is empty , a file open dialog will be shown
*/
void saveAsGerExcelCSV ( const QString & filename = QString ( " " ) ) ;
2015-07-11 18:56:02 +08:00
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
/** \brief print the current plot, if printer is \c nullptr a printer selection dialog is displayed
*
* \ note This function is only available on platforms with QPrinter support !
*/
2019-02-08 00:24:46 +08:00
void print ( QPrinter * printer = nullptr , bool displayPreview = true ) ;
2022-07-19 05:33:20 +08:00
# endif
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief this method zooms the graph so that all plotted datapoints are visible.
*
* \ param zoomX if set \ c true ( default ) zooms the x axis
* \ param zoomY if set \ c true ( default ) zooms the y axis
* \ param includeX0 if this is \ c true zoomToFit ( ) will ensure that \ f $ x = 0 \ f $ is visible in the plot ( only for non - logx plots , default : false )
* \ param includeY0 if this is \ c true zoomToFit ( ) will ensure that \ f $ y = 0 \ f $ is visible in the plot ( only for non - logy plots , default : false )
* \ param scaleX the plot will have a width of \ f $ \ mbox { Xscale } \ cdot \ Delta x \ f $ where \ f $ \ Delta x \ f $ is the actual x - axis data range
* For logx plots we actually use this on the logarithmized data ! ( default : 1.05 )
* \ param scaleY the plot will have a height of \ f $ \ mbox { Yscale } \ cdot \ Delta < \ f $ where \ f $ \ Delta < \ f $ is the actual < - axis data range
* For log < plots we actually use this on the logarithmized data ! ( default : 1.05 )
*
*/
void zoomToFit ( bool zoomX = true , bool zoomY = true , bool includeX0 = false , bool includeY0 = false , double scaleX = 1.05 , double scaleY = 1.05 ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief zooms into the graph (the same as turning the mouse wheel) by the given factor */
void zoomIn ( double factor = 2.0 ) ;
/** \brief zooms out of the graph (the same as turning the mouse wheel) by the given factor */
void zoomOut ( double factor = 2.0 ) ;
2015-07-11 18:56:02 +08:00
2020-09-12 05:19:31 +08:00
/** \brief en-/disables the maintaining of the data aspect ratio \see aspectRatio */
2019-02-08 00:24:46 +08:00
void setMaintainAspectRatio ( bool value ) ;
2015-07-11 18:56:02 +08:00
2020-09-12 05:19:31 +08:00
/** \brief en-/disables the maintaining of the axis aspect ratio \see axisAspectRatio */
2019-02-08 00:24:46 +08:00
void setMaintainAxisAspectRatio ( bool value ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief set filename and prefix, used by loadUserSettings() and saveUserSettings()
*
* \ see loadUserSettings ( ) , saveUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
void setUserSettigsFilename ( const QString & filename , const QString & prefix ) ;
/** \brief set filename, used by loadUserSettings() and saveUserSettings()
*
* \ see loadUserSettings ( ) , saveUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
void setUserSettigsFilename ( const QString & filename ) ;
/** \brief set prefix, used by loadUserSettings() and saveUserSettings()
*
* \ see loadUserSettings ( ) , saveUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
void setUserSettigsPrefix ( const QString & prefix ) ;
/** \brief return the filename, used by loadUserSettings() and saveUserSettings()
*
* \ see loadUserSettings ( ) , saveUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
QString getUserSettigsFilename ( ) const ;
/** \brief return the prefix, used by loadUserSettings() and saveUserSettings()
*
* \ see loadUserSettings ( ) , saveUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
QString getUserSettigsPrefix ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief loads the plot user properties from the file sepcified by setUserSettigsFilename() and the prefix specified by setUserSettigsPrefix()
*
* \ see saveUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
void loadUserSettings ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief saves the plot user properties to the file sepcified by setUserSettigsFilename() and the prefix specified by setUserSettigsPrefix()
*
* \ see loadUserSettings ( ) , setUserSettigsPrefix ( ) , getUserSettigsFilename ( ) , getUserSettigsPrefix ( )
*/
void saveUserSettings ( ) const ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief set all graphs invisible, except i */
void setOnlyGraphVisible ( int i ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief set all graphs invisible, except graph start, start+n, start+2*n, ... */
void setOnlyNthGraphsVisible ( int start , int n ) ;
2015-07-11 18:56:02 +08:00
2020-09-12 05:19:31 +08:00
/** \brief sets the data aspect ratio, enforced with setMaintainApsectRatio(true) \see aspectRatio */
2019-02-08 00:24:46 +08:00
void setAspectRatio ( double __value ) ;
2020-09-12 05:19:31 +08:00
/** \brief sets the axis aspect ratio, enforced with setMaintainAxisApsectRatio(true) \see axisAspectRatio */
2019-02-08 00:24:46 +08:00
void setAxisAspectRatio ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::useAntiAliasingForSystem */
2019-02-08 00:24:46 +08:00
void setUseAntiAliasingForSystem ( bool __value ) ;
2022-04-24 19:23:59 +08:00
/** \copydoc JKQTGraphsBaseStyle::useAntiAliasingForGraphs */
2019-02-08 00:24:46 +08:00
void setUseAntiAliasingForGraphs ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::useAntiAliasingForText */
2019-02-08 00:24:46 +08:00
void setUseAntiAliasingForText ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
2019-02-08 00:24:46 +08:00
void setBackgroundColor ( const QColor & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
2019-02-08 00:24:46 +08:00
void setExportBackgroundColor ( const QColor & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
2019-02-08 00:24:46 +08:00
void setPlotBackgroundColor ( const QColor & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setBackgroundBrush ( const QBrush & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setExportBackgroundBrush ( const QBrush & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setPlotBackgroundBrush ( const QBrush & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setBackgroundGradient ( const QGradient & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setExportBackgroundGradient ( const QGradient & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setPlotBackgroundGradient ( const QGradient & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setBackgroundTexture ( const QPixmap & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setExportBackgroundTexture ( const QPixmap & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setPlotBackgroundTexture ( const QPixmap & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::widgetBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setBackgroundTexture ( const QImage & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::exportBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setExportBackgroundTexture ( const QImage & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotBackgroundBrush */
2019-04-25 01:33:51 +08:00
void setPlotBackgroundTexture ( const QImage & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::textColor */
2019-02-08 00:24:46 +08:00
void setKeyTextColor ( const QColor & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameWidth */
2019-02-08 00:24:46 +08:00
void setPlotFrameWidth ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameRounding */
2019-02-08 00:24:46 +08:00
void setPlotFrameRounding ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameColor */
2019-02-08 00:24:46 +08:00
void setPlotFrameColor ( QColor col ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotFrameVisible */
2019-02-08 00:24:46 +08:00
void setPlotFrameVisible ( bool enabled ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::fontSize */
2019-02-08 00:24:46 +08:00
void setKeyFontSize ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::itemWidth */
2019-02-08 00:24:46 +08:00
void setKeyItemWidth ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::itemHeight */
2019-02-08 00:24:46 +08:00
void setKeyItemHeight ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::ySeparation */
2019-02-08 00:24:46 +08:00
void setKeyYSeparation ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::sampleLineLength */
2019-02-08 00:24:46 +08:00
void setKeyLineLength ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::xMargin */
2019-02-08 00:24:46 +08:00
void setKeyXMargin ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::yMargin */
2019-02-08 00:24:46 +08:00
void setKeyYMargin ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::xSeparation */
2019-02-08 00:24:46 +08:00
void setKeyXSeparation ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::yOffset */
2019-02-08 00:24:46 +08:00
void setKeyXOffset ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::xOffset */
2019-02-08 00:24:46 +08:00
void setKeyYOffset ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::visible */
2019-02-08 00:24:46 +08:00
void setShowKey ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameVisible */
2019-02-08 00:24:46 +08:00
void setShowKeyFrame ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameColor */
2019-02-08 00:24:46 +08:00
void setKeyFrameColor ( const QColor & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-04-25 01:33:51 +08:00
void setKeyBackgroundColor ( const QColor & __value , Qt : : BrushStyle __style ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-04-25 01:33:51 +08:00
void setKeyBackgroundBrush ( const QBrush & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-04-25 01:33:51 +08:00
void setKeyBackgroundGradient ( const QGradient & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-04-25 01:33:51 +08:00
void setKeyBackgroundTexture ( const QImage & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::backgroundBrush */
2019-04-25 01:33:51 +08:00
void setKeyBackgroundTexture ( const QPixmap & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameWidth */
2019-02-08 00:24:46 +08:00
void setKeyFrameWidth ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::frameRounding */
2019-02-08 00:24:46 +08:00
void setKeyFrameRounding ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::autosize */
2019-02-08 00:24:46 +08:00
void setKeyAutosize ( bool __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::position */
2019-02-08 00:24:46 +08:00
void setKeyPosition ( const JKQTPKeyPosition & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTPKeyStyle::layout */
2019-02-08 00:24:46 +08:00
void setKeyLayout ( const JKQTPKeyLayout & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotLabelFontSize */
2019-02-08 00:24:46 +08:00
void setPlotLabelFontSize ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::plotLabelFontName */
2019-02-08 00:24:46 +08:00
void setplotLabelFontName ( const QString & __value ) ;
/** \brief set the plot label text */
void setPlotLabel ( const QString & __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::defaultTextColor */
2019-02-08 00:24:46 +08:00
void setDefaultTextColor ( QColor __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::defaultFontSize */
2019-06-21 21:46:53 +08:00
void setDefaultTextSize ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc JKQTBasePlotterStyle::defaultFontName */
2019-02-08 00:24:46 +08:00
void setDefaultTextFontName ( const QString & __value ) ;
/** \brief sets the current directory in which to open SaveAs ... dialogs */
void setCurrentSaveDirectory ( const QString & __value ) ;
/** \brief set the file format to use in SaveAs ... dialogs */
void setCurrentFileFormat ( const QString & __value ) ;
/** \brief set the decimal separator used when exporting data to text files */
void setCSVdecimalSeparator ( const QString & __value ) ;
/** \brief set the string used to introduce comments in text output when exporting data */
void setCSVcommentInitializer ( const QString & __value ) ;
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...)
2022-06-03 05:05:58 +08:00
*
* \ image html debugShowRegionBoxes . png
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see JKQTBasePlotterStyle : : debugShowRegionBoxes , isDebugShowRegionBoxesEnabled ( )
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void enableDebugShowRegionBoxes ( bool enabled = true ) ;
2022-06-03 05:05:58 +08:00
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the extent of text in the plot
*
* \ image html debugShowTextBoxes . png
*
* \ see JKQTBasePlotterStyle : : debugShowTextBoxes , isDebugShowRegionTextEnabled ( )
*/
void enableDebugShowTextBoxes ( bool enabled = true ) ;
2019-02-08 00:24:46 +08:00
protected :
/** \brief this is a cache for JKQTBasePlotter::textSizeData calculated with JKQTBasePlotter::getTextSizeDetail() */
static QHash < JKQTBasePlotter : : textSizeKey , JKQTBasePlotter : : textSizeData > s_TextSizeDataCache ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
2019-05-18 02:46:52 +08:00
/** \brief paints the plot onto the given JKQTPEnhancedPainter object
*
* \ param painter JKQTPEnhancedPainter to draw on
*/
2020-09-09 17:26:04 +08:00
void drawPlot ( JKQTPEnhancedPainter & painter ) ;
2019-02-08 00:24:46 +08:00
/** \brief simply calls paintPlot() if grid printing mode is deactivated and prints the graph grid otherwise
* \ a pageRect is used to determine the size of the page to draw on . If this does not coincide with
* the widget extents this function calculates a scaling factor so the graphs fit onto the page . This
* is especially usefull when printing !
2019-05-18 02:46:52 +08:00
*
* \ param painter JKQTPEnhancedPainter to draw on
* \ param pageRect size of the page
* \ param scaleIfTooLarge scale image if it is too large for pageRect
* \ param scaleIfTooSmall scale image if it is smaller than pageRect
2015-07-11 18:56:02 +08:00
*/
2020-09-09 17:26:04 +08:00
void gridPaint ( JKQTPEnhancedPainter & painter , QSizeF pageRect , bool scaleIfTooLarge = true , bool scaleIfTooSmall = true ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief This method goes through all registered plotters and calculates the width of every column and
* height of every row as the max over the row / column . The reults are stored in the private datamembers
* gridPrintingRows and gridPrintingColumns . gridPrintingSize will contain the size of all graphs together
* afterwards . */
void gridPrintingCalc ( ) ;
/** \brief plot the grid */
void drawSystemGrid ( JKQTPEnhancedPainter & painter ) ;
/** \brief plot the x coordinate axis (incl. labels) */
void drawSystemXAxis ( JKQTPEnhancedPainter & painter ) ;
/** \brief plot the x coordinate axis (incl. labels) */
void drawSystemYAxis ( JKQTPEnhancedPainter & painter ) ;
/** \brief plot the graphs */
void drawGraphs ( JKQTPEnhancedPainter & painter ) ;
/** \brief plot a key */
void drawKey ( JKQTPEnhancedPainter & painter ) ;
/** \brief plot the key contents
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* This function does not do anything and has to be overwritten in child classes if they want to plot a key .
* The implementation should draw the contents of the key , not its frame as this is done in plotKey ( ) .
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ param painter draw the key on this painter
* \ param x left - most coordinate of the key [ pixels ]
* \ param y top - most coordinate of the key [ pixels ]
* \ param width width of the key [ pixels ]
* \ param height height of the key [ pixels ]
*
* So any implementation should only draw inside the rectangle < code > [ x . . x + width , y . . y + hieght ] < / code >
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
void drawKeyContents ( JKQTPEnhancedPainter & painter , double x , double y , double width , double height ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the size of the key (as call-by-reference parameters
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* Any implementation of key plotting has to overwrite this function and use it to return the size of the key that would be
* plotted by plotKeyContents ( ) . This class will use the return values to plot the frame of the key and also supply them to
* plotKeyContents ( ) . If height or width are returned 0 , no key is plotted
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* The implementation in here returns zero size !
*/
void getKeyExtent ( JKQTPEnhancedPainter & painter , double * width , double * height , double * text_width = nullptr , double * text_height = nullptr , int * columns_count = nullptr , int * lines_count = nullptr ) ;
2022-07-19 05:33:20 +08:00
2019-02-08 00:24:46 +08:00
/** \brief show the print preview window for a given print \a p */
bool printpreviewNew ( QPaintDevice * paintDevice , bool setAbsolutePaperSize = false , double printsizeX_inMM = - 1.0 , double printsizeY_inMM = - 1.0 , bool displayPreview = true ) ;
/** \brief show the export preview window for a given page size \a pageSize, either in pixels (\a unitIsMM \c ==false ) or in millimeters (\a unitIsMM \c ==true ) */
bool exportpreview ( QSizeF pageSize , bool unitIsMM = false ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc fontSizeMultiplier */
2019-02-08 00:24:46 +08:00
void setFontSizeMultiplier ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc lineWidthMultiplier */
2019-02-08 00:24:46 +08:00
void setLineWidthMultiplier ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc printMagnification */
2019-02-08 00:24:46 +08:00
void setPrintMagnification ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc printMagnification */
2019-02-08 00:24:46 +08:00
double getPrintMagnification ( ) const ;
2020-09-21 19:47:54 +08:00
/** \copydoc paintMagnification */
2019-02-08 00:24:46 +08:00
void setPaintMagnification ( double __value ) ;
2020-09-21 19:47:54 +08:00
/** \copydoc paintMagnification */
2019-02-08 00:24:46 +08:00
double getPaintMagnification ( ) const ;
protected slots :
/** \brief internal function for print/export preview
* \ internal
*/
void updatePreviewLabel ( ) ;
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
2019-02-08 00:24:46 +08:00
/** \brief internal function for print preview
* \ internal
*/
void printpreviewPaintRequested ( QPrinter * printer ) ;
/** \brief internal function for print preview
* \ internal
*/
2022-07-19 05:33:20 +08:00
void printpreviewPaintRequestedNewPrinter ( QPrinter * printer ) ;
# endif
2019-02-08 00:24:46 +08:00
/** \brief internal function for print preview
* \ internal
*/
2022-07-19 05:33:20 +08:00
void printpreviewPaintRequestedNewPaintDevice ( QPaintDevice * paintDevice ) ;
2019-02-08 00:24:46 +08:00
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetZoom ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetSizeX ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetSizeY ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetSizeXNew ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetSizeYNew ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetMagnification ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetMagnificationNew ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetAspectRatio ( bool checked ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetKeepAbsFontsize ( bool checked ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewToggleMagnification ( bool checked ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetLineWidthMultiplier ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewSetFontSizeMultiplier ( double value ) ;
/** \brief internal function for print preview
* \ internal
*/
void printpreviewUpdate ( ) ;
2022-07-19 05:33:20 +08:00
/** \brief internal function for export preview
* \ internal
*/
void exportpreviewPaintRequested ( JKQTPEnhancedPainter & painter , QSize size ) ;
2019-02-08 00:24:46 +08:00
/** \brief internal function for getDataColumnsByUser()
* \ internal
*/
void getDataColumnsByUserCheckAll ( ) ;
/** \brief internal function for getDataColumnsByUser()
* \ internal
*/
void getDataColumnsByUserCheckNone ( ) ;
/** \brief internal function for getDataColumnsByUser()
* \ internal
*/
void getDataColumnsByUserSave ( ) ;
/** \brief internal function for getDataColumnsByUser()
* \ internal
*/
void getDataColumnsByUserComboBoxSelected ( const QString & name ) ;
/** \brief internal function for getDataColumnsByUser()
* \ internal
*/
void getDataColumnsByUserItemChanged ( QListWidgetItem * widgetitem ) ;
/** \brief internal function for getDataColumnsByUser()
* \ internal
*/
void showPlotData ( ) ;
/** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the other x-axis */
void synchronizeXAxis ( double newxmin , double newxmax , double newymin , double newymax , JKQTBasePlotter * sender ) ;
/** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the other y-axis */
void synchronizeYAxis ( double newxmin , double newxmax , double newymin , double newymax , JKQTBasePlotter * sender ) ;
/** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local x- and y-axis to the other x- and y-axis */
void synchronizeXYAxis ( double newxmin , double newxmax , double newymin , double newymax , JKQTBasePlotter * sender ) ;
protected :
/** \brief current style properties for this JKQTBasePlotter instance
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see JKQTPSetSystemDefaultBaseStyle ( ) , JKQTPSetSystemDefaultBaseStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
JKQTBasePlotterStyle plotterStyle ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief copy sub-properties of plotterStyle to sub-objects that require it (axes, axes in graphs ...) and emit a plot update */
void propagateStyle ( ) ;
/** \brief used to plot LaTeX markup */
JKQTMathText mathText ;
/** \brief model representing all Plots in this plotter and showing their visible/invisible state */
JKQTPGraphsModel * m_plotsModel ;
/** \brief object used for the x-axis */
JKQTPHorizontalAxis * xAxis ;
/** \brief object used for the y-axis */
JKQTPVerticalAxis * yAxis ;
/** \brief filename for the ini file in which to save the user settings
* \ see jkqtplotter_base_userprops
*/
QString userSettigsFilename ;
/** \brief prefix for the ini file in which to save the user settings
* \ see jkqtplotter_base_userprops
*/
QString userSettigsPrefix ;
/** \brief indicates whether the \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" is activated
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT
*/
bool gridPrinting ;
/** \brief x position of the current graph in \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing"
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT
*/
size_t gridPrintingCurrentX ;
/** \brief y position of the current graph in \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing"
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
size_t gridPrintingCurrentY ;
/** \brief list that manages all the additional graphs for \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode */
QList < JKQTPGridPrintingItem > gridPrintingList ;
/** \brief this list contains all the rows of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its heights */
2019-06-21 21:46:53 +08:00
QList < size_t > gridPrintingRows ;
2019-02-08 00:24:46 +08:00
/** \brief this list contains all the columns of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its widths */
2019-06-21 21:46:53 +08:00
QList < size_t > gridPrintingColumns ;
2019-02-08 00:24:46 +08:00
/** \brief size of all plots in \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode, filled by gridPrintingCalc() */
QSizeF gridPrintingSize ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief this is an internal property that is used by the export/print system to control the "magnification". Usually this is 1.0
* but if set ! = 1.0 , it is used to scale the widgetWidth and widgetHeight before painting ! */
double paintMagnification ;
/** \brief an object which manages all data columns for this plotter class */
JKQTPDatastore * datastore ;
/** \brief indicates whether the datastore is managed (allocated/freed) internally or externally */
bool datastoreInternal ;
/** \brief width of the plot widget
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ image html plot_widget_orientation . png
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see setWidgetSize ( ) , \ ref jkqtplotter_base_plotsize
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
int widgetWidth ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief height of the plot widget
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ image html plot_widget_orientation . png
*
* \ see setWidgetSize ( ) , \ ref jkqtplotter_base_plotsize
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
int widgetHeight ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief <b>calculated value:</b> free space between widget top border and plot top border, as used to plot the graph
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
double internalPlotBorderTop ;
/** \brief <b>calculated value:</b> free space between widget top border and top border of the key/legend
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotKeyBorderTop ;
/** \brief <b>calculated value:</b> height of the plot title (or 0 if no title)
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
double internalTitleHeight ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief <b>calculated value:</b> free space between widget top border and plot top border, as used to plot the graph
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderLeft ;
/** \brief <b>calculated value:</b> free space between widget left border and left border of the key/legend
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
double internalPlotKeyBorderLeft ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief <b>calculated value:</b> free space between widget top border and plot top border, as used to plot the graph
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderBottom ;
/** \brief <b>calculated value:</b> free space between widget bottom border and bottom border of the key/legend
* \ internal
2015-07-11 18:56:02 +08:00
*
2019-02-08 00:24:46 +08:00
* \ note This property is an intermediate storage for calculated values . Do not change directly !
2015-07-11 18:56:02 +08:00
*/
2019-02-08 00:24:46 +08:00
double internalPlotKeyBorderBottom ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief <b>calculated value:</b> free space between widget top border and plot top border, as used to plot the graph
* \ internal
*
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderRight ;
/** \brief <b>calculated value:</b> free space between widget right border and right border of the key/legend
* \ internal
*
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotKeyBorderRight ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief <b>calculated value:</b> free space between widget top border and (plot+drawOutside) top border (including coordinate axes)
* \ internal
*
* \ image html plot_widget_orientation . png
*
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderTop_notIncludingOutsidePlotSections ;
/** \brief <b>calculated value:</b> free space between widget left border and (plot+drawOutside) left border (including coordinate axes)
* \ internal
*
* \ image html plot_widget_orientation . png
*
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderLeft_notIncludingOutsidePlotSections ;
/** \brief <b>calculated value:</b> free space between widget right border and (plot+drawOutside) right border (including coordinate axes)
* \ internal
*
* \ image html plot_widget_orientation . png
*
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderBottom_notIncludingOutsidePlotSections ;
/** \brief <b>calculated value:</b> free space between widget bottom border and (plot+drawOutside) bottom border (including coordinate axes)
* \ internal
*
* \ image html plot_widget_orientation . png
*
* \ note This property is an intermediate storage for calculated values . Do not change directly !
*/
double internalPlotBorderRight_notIncludingOutsidePlotSections ;
2019-02-03 21:04:48 +08:00
2019-02-08 00:24:46 +08:00
/** \brief <b>calculated value:</b> plot width in pixel inside the widget (calculated by calcPlotScaling() from plotBorderLeft, plotBorderRight and widgetWidth)
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
int internalPlotWidth ;
/** \brief <b>calculated value:</b> plot height in pixel inside the widget (calculated by calcPlotScaling() from plotBorderTop, plotBorderBottom and widgetHeight)
*
* \ image html plot_widget_orientation . png
*
* \ see \ ref jkqtplotter_base_plotsize
*/
int internalPlotHeight ;
2019-02-03 21:04:48 +08:00
2020-09-12 05:19:31 +08:00
/** \brief indicates whether the widget should maintain an aspect ratio of plotwidth and plotheight
*
* \ see aspectRatio
*/
2019-02-08 00:24:46 +08:00
bool maintainAspectRatio ;
2020-09-12 05:19:31 +08:00
/** \brief the aspect ratio of plotwidth and plotheight to maintain, if \c maintainAspectRatio==true
*
* \ f [ \ mbox { aspectRatio } = \ frac { \ mbox { plotWidth } } { \ mbox { plotHeight } } \ f ]
*
* \ see maintainAspectRatio
*/
2019-02-08 00:24:46 +08:00
double aspectRatio ;
2019-02-03 21:04:48 +08:00
2020-09-09 02:15:33 +08:00
/** \brief indicates whether the axes should maintain an aspect ratio
*
2020-09-12 05:19:31 +08:00
* When the axis aspect ratio is to be maintained and new axis ranges are set ( e . g . when calling setXY ( ) ) ,
* the given axis ranges are modified , so
* \ f [ \ mbox { axisAspectRatio } = \ frac { \ left | x_ \ text { max } - x_ \ text { min } \ right | } { \ left | y_ \ text { max } - y_ \ text { min } \ right | } \ f ]
*
* \ note An axis aspect ratio is only well defined for linear axes ( if both axes are linear ) .
2020-09-09 02:15:33 +08:00
* If both axes a logarithmic , the axis ration is defined for log ( axismax ) - log ( axismin ) .
* For other combinations of axes , this function is deactivated
*
* \ see axisAspectRatio
*/
2019-02-08 00:24:46 +08:00
bool maintainAxisAspectRatio ;
2020-09-09 02:15:33 +08:00
/** \brief the aspect ratio of axis widths to maintain, if \c maintainAxisAspectRatio==true
*
2020-09-12 05:19:31 +08:00
* When the axis aspect ratio is to be maintained and new axis ranges are set ( e . g . when calling setXY ( ) ) ,
* the given axis ranges are modified , so
* \ f [ \ mbox { axisAspectRatio } = \ frac { \ left | x_ \ text { max } - x_ \ text { min } \ right | } { \ left | y_ \ text { max } - y_ \ text { min } \ right | } \ f ]
*
* \ note An axis aspect ratio is only well defined for linear axes ( if both axes are linear ) .
2020-09-09 02:15:33 +08:00
* If both axes a logarithmic , the axis ration is defined for log ( axismax ) - log ( axismin ) .
* For other combinations of axes , this function is deactivated
*
* \ see maintainAxisAspectRatio
*/
2019-02-08 00:24:46 +08:00
double axisAspectRatio ;
2019-02-03 21:04:48 +08:00
2019-02-08 00:24:46 +08:00
/** \brief the plot label text */
QString plotLabel ;
2019-02-03 21:04:48 +08:00
2019-02-08 00:24:46 +08:00
/** \brief calculate the scaling and offset values from axis min/max values */
void calcPlotScaling ( JKQTPEnhancedPainter & painter ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief set the standard settings (colors, line widths ...) */
void initSettings ( ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief specifies whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate() */
bool emitSignals ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief multiplier which is used for font sizes when the plot is exported/printed */
double fontSizePrintMultiplier ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief multiplier which is used for linewidths when the plot is exported/printed */
double lineWidthPrintMultiplier ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief multiplier for the font size */
double fontSizeMultiplier ;
/** \brief multiplier or the line widths */
double lineWidthMultiplier ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief internal: used to store a list of all currently used plot styles */
QList < int > usedStyles ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief a vector that contains all graphs to be plottet in the system */
QList < JKQTPPlotElement * > graphs ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief indicates whether to use clipping (hack for printing, see print() ) */
bool useClipping ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief QAction which triggers saving of the plot as an image */
QAction * actSavePlot ;
/** \brief QAction which triggers saving of the data used for the plot */
QAction * actSaveData ;
/** \brief QAction which triggers copying of the data to the clipboard */
QAction * actCopyData ;
/** \brief QAction which triggers copying of the image to the clipboard */
QAction * actCopyPixelImage ;
/** \brief QAction which triggers copying of the data to the clipboard in Matlab format */
QAction * actCopyMatlab ;
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
2019-02-08 00:24:46 +08:00
/** \brief QAction which triggers the saving as PDF */
QAction * actSavePDF ;
/** \brief QAction which triggers the saving as Scalable Vector Graphics (SVG) */
QAction * actSaveSVG ;
/** \brief QAction which triggers the printing */
QAction * actPrint ;
2022-07-19 05:33:20 +08:00
# endif
/** \brief QAction which triggers the saving as pixel image */
QAction * actSavePix ;
2019-02-08 00:24:46 +08:00
/** \brief QAction which triggers the saving as CSV (data only) */
QAction * actSaveCSV ;
/** \brief QAction which triggers zoom all */
QAction * actZoomAll ;
/** \brief QAction which triggers zoom in */
QAction * actZoomIn ;
/** \brief QAction which triggers zoom out */
QAction * actZoomOut ;
/** \brief QAction to show a table with all the plot data in the datastore */
QAction * actShowPlotData ;
/** \brief this list contains additional actions, that can be registered by registerAdditionalAction(). They are shown in the context menu only and are e.g. used to display "save image data" actions. Each action may be in a category (key of map), which is displayed as a submenu of the context-menu! */
AdditionalActionsMap lstAdditionalPlotterActions ;
/** \brief the current directory in which to open SaveAs ... dialogs */
QString currentSaveDirectory ;
/** \brief the current file format to use in SaveAs ... dialogs */
QString currentFileFormat ;
/** \brief the current file format to use in SaveDataAs ... dialogs */
QString currentDataFileFormat ;
/** \brief the currently selected printer */
QString currentPrinter ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief the master plotter for x-dimension, this plotter is connected to. */
JKQTBasePlotter * masterPlotterX ;
/** \brief the master plotter for y-dimension, this plotter is connected to. */
JKQTBasePlotter * masterPlotterY ;
/** \brief synchronize plot width with masterPlotterX */
bool masterSynchronizeWidth ;
/** \brief synchronize plot height with masterPlotterY */
bool masterSynchronizeHeight ;
2015-07-11 18:56:02 +08:00
2020-09-09 17:26:04 +08:00
/** \brief controls, whether the signals plotUpdated() are emitted */
2019-02-08 00:24:46 +08:00
bool emitPlotSignals ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
QListWidget * dataColumnsListWidget ;
QComboBox * dataColumnsCombobox ;
QSet < int > getDataColumnsByUser ( ) ;
QMap < QString , QStringList > getDataColumnsByUserSaved ;
2019-01-26 03:16:04 +08:00
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
private :
double printZoomFactor ;
double printSizeX_Millimeter ;
double printSizeY_Millimeter ;
double printMagnification ;
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
2019-02-08 00:24:46 +08:00
QPointer < QPrintPreviewWidget > printPreview ;
2022-07-19 05:33:20 +08:00
# endif
2019-02-08 00:24:46 +08:00
QPointer < JKQTPEnhancedDoubleSpinBox > spinSizeX ;
QPointer < JKQTPEnhancedDoubleSpinBox > spinSizeY ;
QPointer < QLabel > exportPreviewLabel ;
QPointer < JKQTPEnhancedDoubleSpinBox > spinMagnification ;
bool printSetAbsolutePageSize ;
bool printSetAbsolutePlotSize ;
bool printKeepAbsoluteFontSizes ;
bool printScaleToPagesize ;
double printAspect ;
bool printKeepAspect ;
bool exportUnitInMM ;
QSizeF printPageSizeMM ;
bool printDoUpdate ;
2015-07-11 18:56:02 +08:00
} ;
2019-02-03 22:54:41 +08:00
/** \brief qHash()-specialization
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-03 22:54:41 +08:00
*/
2022-04-22 19:27:31 +08:00
# if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
inline size_t qHash ( const JKQTBasePlotter : : textSizeKey & data , size_t /*seed=0*/ ) {
# else
inline uint qHash ( const JKQTBasePlotter : : textSizeKey & data , uint /*seed=0*/ ) {
# endif
2015-07-11 18:56:02 +08:00
return qHash ( data . f . family ( ) ) + qHash ( data . text ) ;
}
# endif // JKQTPBASEPLOTTER_H