diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 3e8885b76d..4441c44967 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -2462,6 +2462,42 @@ bool JKQTBasePlotter::isEmittingPlotSignalsEnabled() const return this->emitPlotSignals; } +void JKQTBasePlotter::setGridPrinting(bool __value) +{ + this->gridPrinting = __value; +} + +bool JKQTBasePlotter::getGridPrinting() const +{ + return this->gridPrinting; +} + +void JKQTBasePlotter::setGridPrintingCurrentX(size_t __value) +{ + this->gridPrintingCurrentX = __value; +} + +size_t JKQTBasePlotter::getGridPrintingCurrentX() const +{ + return this->gridPrintingCurrentX; +} + +void JKQTBasePlotter::setGridPrintingCurrentY(size_t __value) +{ + this->gridPrintingCurrentY = __value; +} + +size_t JKQTBasePlotter::getGridPrintingCurrentY() const +{ + return this->gridPrintingCurrentY; +} + +void JKQTBasePlotter::setGridPrintingCurrentPos(size_t x, size_t y) +{ + gridPrintingCurrentX=x; + gridPrintingCurrentY=y; +} + void JKQTBasePlotter::registerAdditionalAction(const QString &key, QAction *act) { if (!lstAdditionalPlotterActions.contains(key)) { diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h index 61dee9cd4e..765d34520c 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.h +++ b/lib/jkqtplotter/jkqtpbaseplotter.h @@ -144,7 +144,8 @@ class LIB_EXPORT JKQTPPaintDeviceAdapter { * may be used to set the axis properties. * * - * \section jkqtplotter_base_key Graph Keys + * \section jkqtbaseplotter_appearance_and_style Appearance & Styling of the Graph + * \subsection jkqtplotter_base_key Graph Keys * 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. @@ -165,43 +166,7 @@ class LIB_EXPORT JKQTPPaintDeviceAdapter { * key content. By default this feature is switched ON. * * - * \section jkqtplotter_base_saveprint Saving and Printing Graphs - * 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) - * - saveAsPS() 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) - * - 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 - * . - * - * As one often want's to combine different graphs, there is a possibility to combine this graph with more other graphs. - * To do so one can think of the graphs to be part of a grid where each graph is contained in one cell. By default this - * mechanism is deactivated. You can activate it by calling setGridPrinting(true). Then you can set the position of the - * current graph by calling setGridPrintingCurrentX() and setGridPrintingCurrentY(). Add additional graphs by calling - * addGridPrintingPlotter(). The position of the current graph is 0,0 by default. Afterwards the save and print routines - * will export/print all graphs, not just the current one. There will be no additional border between the graphs, as the - * class expects the internal graph borders to be sufficient. - * - * - * \section jkqtplotter_base_defaultvalues Default Properties - * The plot is configured by a huge set of properties. For each property there is also a second protected variable which - * contains its default value. This way it is possible to store only those parameters in an INI file which have changed with - * respect to the default values. If the property is ( \copybrief is )called \c property then the according default value is stored in - * \c default_property. To reduce the code to be entered you can use the JKQTPPROPERTY() macro. - * - * Default values are available only for properties that control the appearance of the graphs (line widths, border widths, - * color, fonts ...), not the type of the graph (xmin, xmax, logXAxis, ...) - * - * \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(). - * These methods MAY (strictly optional and turned off by default) be called by saveSettings() and loadSettings(), if the property userSettigsFilename ( \copybrief userSettigsFilename )is - * set (not-empty). In this case the suer settings are stored/loaded also everytime they are changed by the user or programmatically. - * - * \section jkqtplotter_base_aspectratios Aspect Ratios + * \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: @@ -215,6 +180,66 @@ class LIB_EXPORT JKQTPPaintDeviceAdapter { * setAxisAspectRatio(4.0*getAspectRatio()); * \endcode * . + * + * + * \section jkqtbaseplotter_dataexport_print Printing, Saving & Exporting + * + * \subsection jkqtplotter_base_saveprint Saving and Printing Graphs + * 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) + * - saveAsPS() 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) + * - 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 + * - 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 + * - 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() + * . + * + * + * \subsection JKQTBASEPLOTTER_GRIDPRINTING Grid-Printing / Layouting Several Graphs + * As one often want's to combine different graphs, there is a possibility to combine this graph with more other graphs. + * To do so one can think of the graphs to be part of a grid where each graph is contained in one cell. By default this + * mechanism is deactivated. You can activate it by calling setGridPrinting(true). Then you can set the position of the + * current graph by calling setGridPrintingCurrentX() and setGridPrintingCurrentY(). Add additional graphs by calling + * addGridPrintingPlotter(). The position of the current graph is 0,0 by default. Afterwards the save and print routines + * will export/print all graphs, not just the current one. There will be no additional border between the graphs, as the + * class expects the internal graph borders to be sufficient. + * + * \see \ref JKQTPLOTTER_SYNCMULTIPLOT + * + * + * \section jkqtplotter_base_defaultvalues Default Properties + * The plot is configured by a huge set of properties. For each property there is also a second protected variable which + * contains its default value. This way it is possible to store only those parameters in an INI file which have changed with + * respect to the default values. If the property is called \c property then the according default value is stored in + * \c default_property. To reduce the code to be entered you can use the JKQTPPROPERTY() macro. + * + * Default values are available only for properties that control the appearance of the graphs (line widths, border widths, + * color, fonts ...), not the type of the graph (xmin, xmax, logXAxis, ...) + * + * \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(). + * These methods MAY (strictly optional and turned off by default) be called by saveSettings() and loadSettings(), if the property userSettigsFilename ( \copybrief userSettigsFilename )is + * set (not-empty). In this case the suer settings are stored/loaded also everytime they are changed by the user or programmatically. */ class LIB_EXPORT JKQTBasePlotter: public QObject { Q_OBJECT @@ -1740,45 +1765,36 @@ class LIB_EXPORT JKQTBasePlotter: public QObject { /*! \brief sets the property gridPrinting ( \copybrief gridPrinting ) to the specified \a __value. \details Description of the parameter gridPrinting is:
\copydoc gridPrinting\see gridPrinting for more information */ - inline void setGridPrinting(bool __value) - { - this->gridPrinting = __value; - } + void setGridPrinting(bool __value); /*! \brief returns the property gridPrinting ( \copybrief gridPrinting ). \details Description of the parameter gridPrinting is:
\copydoc gridPrinting\see gridPrinting for more information */ - inline bool getGridPrinting() const - { - return this->gridPrinting; - } + bool getGridPrinting() const; /*! \brief sets the property gridPrintingCurrentX ( \copybrief gridPrintingCurrentX ) to the specified \a __value. \details Description of the parameter gridPrintingCurrentX is:
\copydoc gridPrintingCurrentX\see gridPrintingCurrentX for more information */ - inline void setGridPrintingCurrentX(size_t __value) - { - this->gridPrintingCurrentX = __value; - } + void setGridPrintingCurrentX(size_t __value); /*! \brief returns the property gridPrintingCurrentX ( \copybrief gridPrintingCurrentX ). \details Description of the parameter gridPrintingCurrentX is:
\copydoc gridPrintingCurrentX\see gridPrintingCurrentX for more information */ - inline size_t getGridPrintingCurrentX() const - { - return this->gridPrintingCurrentX; - } + size_t getGridPrintingCurrentX() const; /*! \brief sets the property gridPrintingCurrentY ( \copybrief gridPrintingCurrentY ) to the specified \a __value. \details Description of the parameter gridPrintingCurrentY is:
\copydoc gridPrintingCurrentY\see gridPrintingCurrentY for more information */ - inline void setGridPrintingCurrentY(size_t __value) - { - this->gridPrintingCurrentY = __value; - } + void setGridPrintingCurrentY(size_t __value); /*! \brief returns the property gridPrintingCurrentY ( \copybrief gridPrintingCurrentY ). \details Description of the parameter gridPrintingCurrentY is:
\copydoc gridPrintingCurrentY\see gridPrintingCurrentY for more information */ - inline size_t getGridPrintingCurrentY() const - { - return this->gridPrintingCurrentY; - } + size_t getGridPrintingCurrentY() const; + + /** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid + * + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentX(), setGridPrintingCurrentY() \ref JKQTPBASELOTTER_SYNCMULTIPLOT + */ + void setGridPrintingCurrentPos(size_t x, size_t y); + + + /*! \brief sets the property currentSaveDirectory ( \copybrief currentSaveDirectory ) to the specified \a __value. \details Description of the parameter currentSaveDirectory is:
\copydoc currentSaveDirectory\see currentSaveDirectory for more information */ diff --git a/lib/jkqtplotter/jkqtpgraphs.h b/lib/jkqtplotter/jkqtpgraphs.h index f713cba053..eaae6b7bf9 100644 --- a/lib/jkqtplotter/jkqtpgraphs.h +++ b/lib/jkqtplotter/jkqtpgraphs.h @@ -254,7 +254,14 @@ class LIB_EXPORT JKQTPXYLineGraph: public JKQTPXYGraph { \ingroup jkqtplotter_linesymbolgraphs set the properties sizeColumn and/or colorColumn to change the size and/or color of the symbols according to the values in the column. - */ + + \image html jkqtplotter_simpletest_paramscatterplot.png "Different Styles of Parametrized Scatter/Line Graphs" + + \image html jkqtplotter_simpletest_paramscatterplot_image_star.png "JKQTPXYParametrizedScatterGraph with symbols organized in a grid" + + + \see JKQTPXYParametrizedErrorScatterGraph, \ref JKQTPlotterParamScatter , \ref JKQTPlotterParamScatterImage +*/ class LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph, public JKQTPColorPaletteTools { Q_OBJECT public: @@ -516,6 +523,10 @@ class LIB_EXPORT JKQTPXYLineErrorGraph: public JKQTPXYLineGraph, public JKQTPXYG \ingroup jkqtplotter_linesymbolgraphs set the properties sizeColumn and/or colorColumn to change the size and/or color of the symbols according to the values in the column. + + \image html screen_parmetrizedplots_datatable.png + + \see JKQTPXYParametrizedScatterGraph, \ref JKQTPlotterParamScatter */ class LIB_EXPORT JKQTPXYParametrizedErrorScatterGraph: public JKQTPXYParametrizedScatterGraph, public JKQTPXYGraphErrors { Q_OBJECT @@ -553,21 +564,9 @@ class LIB_EXPORT JKQTPXYParametrizedErrorScatterGraph: public JKQTPXYParametrize /*! \brief This implements a step plot with values \f$ \left(x, f(x) \right) \f$ \ingroup jkqtplotter_linesymbolgraphs - A step plot starts at \f$ \left(x_{i-1}, f(x_{i-1})\right) \f$ and then goes on to - \f$ \left(x_{i}, f(x_{i-1})\right) \f$. There it raises immediately to - \f$ \left(x_i, f(x_i)\right) \f$. + \image html jkqtplotter_simpletest_stepplots.png - If you want the \f$ x_i \f$ values in the center of the steps, use - \code JKQTPStepHorizontalGraph::setXCentered(true) \endcode . In that case the steps - go from \f$ \left(x_{i-1}, f(x_{i-1})\right) \f$ to \f$ \left(x_{i}-\delta/2, f(x_{i-1})\right) \f$ , - then to \f$ \left(x_{i}-\delta/2, f(x_{i})\right) \f$ and finally - to \f$ \left(x_{i}, f(x_{i})\right) \f$ where \f$ \delta=(x_{i}-x_{i-1}) \f$ . - - This diagram shows a plot with \code JKQTPStepHorizontalGraph::setValuesCentered(false) \endcode : - \image html plot_stephorplot1.png - - This diagram shows a plot with \code JKQTPStepHorizontalGraph::setValuesCentered(true) \endcode : - \image html plot_stephorplot2.png + \see JKQTPStepVerticalGraph, \ref JKQTPlotterStepPlot */ class LIB_EXPORT JKQTPStepHorizontalGraph: public JKQTPXYGraph { Q_OBJECT @@ -726,21 +725,9 @@ class LIB_EXPORT JKQTPStepHorizontalGraph: public JKQTPXYGraph { /*! \brief This implements a step plot with values \f$ \left(f(y), y \right) \f$ \ingroup jkqtplotter_linesymbolgraphs - A step plot starts at \f$ \left(f(y_{i-1}), x_{i-1}\right) \f$ and then goes on to - \f$ \left(f(y_{i-1}), y_{i}\right) \f$. There it raises immediately to - \f$ \left(f(y_i), y_i\right) \f$. - - If you want the \f$ y_i \f$ values in the center of the steps, use - \code JKQTPStepHorizontalGraph::setValuesCentered(true) \endcode . In that case the steps - go from \f$ \left(f(y_{i-1}), y_{i-1})\right) \f$ to \f$ \left(f(y_{i-1}), y_{i}-\delta/2\right) \f$ , - then to \f$ \left(f(y_{i}, y_{i}-\delta/2\right) \f$ and finally - to \f$ \left(f(y_{i}), y_{i}\right) \f$ where \f$ \delta=(y_{i}-y_{i-1}) \f$ . - - This diagram shows a plot with \code JKQTPStepHorizontalGraph::setXCentered(false) \endcode : \image html plot_stepverplot1.png - This diagram shows a plot with \code JKQTPStepHorizontalGraph::setXCentered(true) \endcode : - \image html plot_stepverplot2.png + \see JKQTPStepHorizontalGraph, \ref JKQTPlotterStepPlot */ class LIB_EXPORT JKQTPStepVerticalGraph: public JKQTPStepHorizontalGraph { Q_OBJECT diff --git a/lib/jkqtplotter/jkqtpgraphsfilledcurve.h b/lib/jkqtplotter/jkqtpgraphsfilledcurve.h index 53b7066c1c..e06b988151 100644 --- a/lib/jkqtplotter/jkqtpgraphsfilledcurve.h +++ b/lib/jkqtplotter/jkqtpgraphsfilledcurve.h @@ -31,7 +31,9 @@ /*! \brief This implements filled curve plots where the area is filled between the plot line and the x-Axis. \ingroup jkqtplotter_linesymbolgraphs - \image html plot_filledcurvexerrorplots.png + \image html jkqtplotter_simpletest_filledgraphs.png + + \see \ref JKQTPlotterFilledGraphs */ class LIB_EXPORT JKQTPFilledCurveXGraph: public JKQTPXYGraph { Q_OBJECT @@ -211,6 +213,9 @@ class LIB_EXPORT JKQTPFilledCurveXGraph: public JKQTPXYGraph { \ingroup jkqtplotter_linesymbolgraphs \image html plot_filledcurvexerrorplots.png + + + \see \ref JKQTPlotterFilledGraphs */ class LIB_EXPORT JKQTPFilledCurveXErrorGraph: public JKQTPFilledCurveXGraph, public JKQTPYGraphErrors { Q_OBJECT @@ -236,7 +241,10 @@ class LIB_EXPORT JKQTPFilledCurveXErrorGraph: public JKQTPFilledCurveXGraph, pub /*! \brief This implements filled curve plots where the area is filled between the plot line and y-Axis \ingroup jkqtplotter_linesymbolgraphs - \image html plot_filledcurvexplots.png + \image html jkqtplotter_simpletest_filledgraphs_yaxis.png + + \see \ref JKQTPlotterFilledGraphs + */ class LIB_EXPORT JKQTPFilledCurveYGraph: public JKQTPFilledCurveXGraph { Q_OBJECT @@ -256,6 +264,8 @@ class LIB_EXPORT JKQTPFilledCurveYGraph: public JKQTPFilledCurveXGraph { \ingroup jkqtplotter_linesymbolgraphs \image html plot_filledcurveyerrorplots.png + + \see \ref JKQTPlotterFilledGraphs */ class LIB_EXPORT JKQTPFilledCurveYErrorGraph: public JKQTPFilledCurveYGraph, public JKQTPXGraphErrors { Q_OBJECT @@ -286,6 +296,10 @@ class LIB_EXPORT JKQTPFilledCurveYErrorGraph: public JKQTPFilledCurveYGraph, pub With setDrawlines(true): \image html JKQTPFilledVerticalRangeGraph_WithLines.png + + + + \see \ref JKQTPlotterDateTimeAxes */ class LIB_EXPORT JKQTPFilledVerticalRangeGraph: public JKQTPXYGraph { Q_OBJECT diff --git a/lib/jkqtplotter/jkqtpgraphsimage.h b/lib/jkqtplotter/jkqtpgraphsimage.h index 4429ab8806..37c84afb65 100644 --- a/lib/jkqtplotter/jkqtpgraphsimage.h +++ b/lib/jkqtplotter/jkqtpgraphsimage.h @@ -347,7 +347,7 @@ class LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase { /*! \brief class to plot an image from a QImage object \ingroup jkqtplotter_imagelots_elements - \image html jkqtplotter_simpletest_rgbimageplot_qt + \image html jkqtplotter_simpletest_rgbimageplot_qt.png */ class LIB_EXPORT JKQTPImage: public JKQTPImageBase { Q_OBJECT diff --git a/lib/jkqtplotter/jkqtplotter.cpp b/lib/jkqtplotter/jkqtplotter.cpp index a9fbf05491..e751e5feae 100644 --- a/lib/jkqtplotter/jkqtplotter.cpp +++ b/lib/jkqtplotter/jkqtplotter.cpp @@ -892,11 +892,11 @@ void JKQTPlotter::masterPlotScalingRecalculated() { } } -void JKQTPlotter::synchronizeToMaster(JKQTPlotter* master, bool synchronizeWidth, bool synchronizeHeight) { +void JKQTPlotter::synchronizeToMaster(JKQTPlotter* master, bool synchronizeWidth, bool synchronizeHeight, bool synchronizeZoomingMasterToSlave, bool synchronizeZoomingSlaveToMaster) { if (!master) { resetMasterSynchronization(); } - plotter->synchronizeToMaster(master->getPlotter(), synchronizeWidth, synchronizeHeight); + plotter->synchronizeToMaster(master->getPlotter(), synchronizeWidth, synchronizeHeight, synchronizeZoomingMasterToSlave, synchronizeZoomingSlaveToMaster); masterPlotter=master; if (masterPlotter) connect(masterPlotter->getPlotter(), SIGNAL(plotScalingRecalculated()), this, SLOT(masterPlotScalingRecalculated())); redrawPlot(); @@ -908,6 +908,36 @@ void JKQTPlotter::resetMasterSynchronization() { redrawPlot(); } +void JKQTPlotter::setGridPrinting(bool enabled) +{ + plotter->setGridPrinting(enabled); +} + +void JKQTPlotter::addGridPrintingPlotter(size_t x, size_t y, JKQTPlotter *plotterOther) +{ + plotter->addGridPrintingPlotter(x,y,plotterOther->getPlotter()); +} + +void JKQTPlotter::clearGridPrintingPlotters() +{ + plotter->clearGridPrintingPlotters(); +} + +void JKQTPlotter::setGridPrintingCurrentX(size_t x) +{ + plotter->setGridPrintingCurrentX(x); +} + +void JKQTPlotter::setGridPrintingCurrentY(size_t y) +{ + plotter->setGridPrintingCurrentY(y); +} + +void JKQTPlotter::setGridPrintingCurrentPos(size_t x, size_t y) +{ + plotter->setGridPrintingCurrentPos(x,y); +} + bool JKQTPlotter::isPlotUpdateEnabled() const { return doDrawing; } diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index e6a7ad145f..d034235d7e 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -62,18 +62,79 @@ LIB_EXPORT void initJKQTPlotterResources(); /** \brief plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing) * \ingroup jkqtpplotterclasses * - * This class is an implementation of JKQTBasePlotter. It uses the tools from this base class - * to display function graphs that use the internal datastore as data source. This class mostly - * adds the Widget for the output and adds different types of user interactions. + * This class is a QWidget-wrapper around JKQTBasePlotter. It uses the tools from JKQTBasePlotter + * to display scientific plots. This class mostly adds the Widget for the output and adds different + * types of user interactions. * * Please have a look at the documentation of JKQTBasePlotter for details on the management of graphs * and the formating/styling of the plot and graphs! * - * \see JKQTBasePlotter + * The rest of this documentation ins split into sections that each treat a special topic, as outlines below: + * + * \tableofcontents * * + * \section JKQTPLOTTER_SYNCMULTIPLOT Synchronizing Several Plots * - * \section JKQTPLOTTER_USERINTERACTION User-Interactions + * 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 + * Qt Layout. 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 + * - When you print the plot, the printing does not know about the layout and will only print one of the + * several plots in your layout. + * - 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. + * . + * + * To overcome these limitations, JKQTPlotter offers 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: + * - Declaring the Relations (forwarding to JKQTBasePlotter !): + * - 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, true, false, true, true); + * + * // synchronize y-axis of width/plotResidHist to y-axis of width/plotResid + * plotResidHist->synchronizeToMaster(plotResid, false, 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. + * - resetMasterSynchronization() / JKQTBasePlotter::resetMasterSynchronization() deletes all synchronizations + * from the JKQTPlotter + * . + * - Synchronizing Axes (forwarding to JKQTBasePlotter !): + * - 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 + * - clearGridPrintingPlotters() clear all additional plotters for grid printing mode + * . + * These two functionalities are kept separate, so you can use them independently. + * + * \note Note that the grid printing mode only allows to put plots to the right (positive x-values in addGridPrintingPlotter() ) + * and to the bottom (positive y-values in addGridPrintingPlotter() ) of the current plot. Therefore the master plot + * needs to be the top-left plot of your grid and all plots need to be aligned in a grid (i.e. using + * QGridLayout) + * + * \see See \ref JKQTPlotterMultiPlotLayout for an extensive example of the functionality. + * + * + * \section JKQTPLOTTER_USERINTERACTION User-Interactions/GUI Features * * JKQTPlotter offers a lot of user-interaction features out of the box. These are detailed below. * @@ -156,7 +217,18 @@ LIB_EXPORT void initJKQTPlotterResources(); * * \subsection JKQTPLOTTER_USERMOUSEINTERACTION Mouse-Interaction in JKQTPlotter * - * \see \ref JKQTPlotterUserInteraction + * This section summarizes all user-interaction functions in JKQTPlotter that somehow relate to the mouse. + * These are: + * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG + * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK + * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEWHEEL + * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE + * . + * + * \note Zooming and Paning interactions apply to both axes when they are performed with the mouse + * inside the plot. They are limited to one of the two axes, when the mouse hovers over that axis + * (e.g. when you zoom by mouse-wheel while the mouse pointer is below the plot, over the x-axis, + * only the x-axis is affected by the operation). * * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG Actions When Dragging the Mouse * JKQTPlotter offers several methods that allow to customize, how it reacts to mouse actions: @@ -175,7 +247,13 @@ LIB_EXPORT void initJKQTPlotterResources(); * * Pressing the \c ESC key will stop the current JKQTPlotter::MouseActionMode. * - * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK Actions After Clicks on the Mouse Buttons + * If e.g. the mode JKQTPlotter::MouseActionMode::ZoomRectangle is selected, while you drag the mouse, the + * zoom rectangle is drawn over the plot. You can modify the style of drawing using these functions: + * - setUserActionColor() sets the color of the drawn shape + * - setUserActionCompositionMode() specifies how to combine the shape with the existing plot + * . + * + * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK Actions After (Double-)Clicks on the Mouse Buttons * The right mouse button has a special role: If it is single-clicked and no JKQTPlotter::MouseActionMode is specified * for the vent, it opens the context menu, unless you call \c setContextMenuMoode(JKQTPlotter::NoContextMenu) . * You can also use setContextMenuMoode() to specify which type of context menu is shown. See JKQTPlotter::ContextMenuModes @@ -222,6 +300,9 @@ LIB_EXPORT void initJKQTPlotterResources(); * In addition the signal plotMouseMove() is called whenever the mouse moves over the plot. * Additional signals may be emitted, depending on the currently active JKQTPlotter::MouseActionMode. * + * Also the current mouse position is shown above the graph by default (can be switched on or off + * using setMousePositionShown() ). + * * * * \section JKQTPLOTTER_USEQTCREATOR How to use JKQTPlotter in the Qt Form Designer @@ -334,14 +415,10 @@ class LIB_EXPORT JKQTPlotter: public QWidget { \details Description of the parameter displayMousePosition is:
\copydoc displayMousePosition\see displayMousePosition for more information */ bool isMousePositionShown() const; - /*! \brief returns the property userActionColor ( \copybrief userActionColor ). - \details Description of the parameter userActionColor is:
\copydoc userActionColor- \see userActionColor for more information */ + /** \brief returns the fill color of the zoom rectangle \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */ QColor getUserActionColor() const; - /*! \brief returns the property userActionCompositionMode ( \copybrief userActionCompositionMode ). - \details Description of the parameter userActionCompositionMode is:
\copydoc userActionCompositionMode- \see userActionCompositionMode for more information */ + /** \brief returns the QPainter::CompositionMode used to draw the zoom rectangle etc. \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */ QPainter::CompositionMode getUserActionCompositionMode() const; @@ -373,12 +450,64 @@ class LIB_EXPORT JKQTPlotter: public QWidget { \param master the plotter widget to synchronize to \param synchronizeWidth do you want the plot width to be synchronized? \param synchronizeHeight do you want the plot height to be synchronized? - */ - void synchronizeToMaster(JKQTPlotter* master, bool synchronizeWidth, bool synchronizeHeight); + \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 - /** \brief switches any synchronization off, that has been created by synchronizeToMaster() */ + + + \note This function internally calls JKQTBasePlotter::synchronizeToMaster() + \see synchronizeToMaster(), resetMasterSynchronization(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void synchronizeToMaster(JKQTBasePlotter* master, bool synchronizeWidth, bool synchronizeHeight, bool synchronizeZoomingMasterToSlave=false, bool synchronizeZoomingSlaveToMaster=false); + + + /** \brief switches any synchronization off, that has been created by synchronizeToMaster() + * + * \note This function internally calls JKQTBasePlotter::resetMasterSynchronization() + * \see synchronizeToMaster(), resetMasterSynchronization(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ void resetMasterSynchronization(); + /*! \brief enables grid-printing for this plot + * + * \note This function call forwards to JKQTBasePlotter::setGridPrinting() + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void setGridPrinting(bool enabled); + + /** \brief add a new plotter \a plotterOther for grid printing mode, at location \a x / \a y + * + * \note This function call forwards to JKQTBasePlotter::addGridPrintingPlotter() + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void addGridPrintingPlotter(size_t x, size_t y, JKQTPlotter* plotterOther) ; + + /** \brief clear all additional plotters for grid printing mode + * + * \note This function call forwards to JKQTBasePlotter::clearGridPrintingPlotters() + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void clearGridPrintingPlotters() ; + /** \brief set the x-position of this JKQTPlotter in the grid-printing grid + * + * \note This function call forwards to JKQTBasePlotter::setGridPrintingCurrentX() + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), setGridPrintingCurrentY(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void setGridPrintingCurrentX(size_t x); + /** \brief set the y-position of this JKQTPlotter in the grid-printing grid + * + * \note This function call forwards to JKQTBasePlotter::setGridPrintingCurrentY() + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), setGridPrintingCurrentX(), \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void setGridPrintingCurrentY(size_t y); + /** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid + * + * \note This function call forwards to JKQTBasePlotter::setGridPrintingCurrentPos() + * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentX(), setGridPrintingCurrentY() \ref JKQTPLOTTER_SYNCMULTIPLOT + */ + void setGridPrintingCurrentPos(size_t x, size_t y); + + /** \brief returns a pointer to the datastore used by this object */ inline JKQTPDatastore* getDatastore() { return plotter->getDatastore(); } @@ -434,11 +563,11 @@ class LIB_EXPORT JKQTPlotter: public QWidget { /** \brief clear all registered mouse double-click actions */ void clearAllRegisteredMouseDoubleClickActions(); - /** \brief specifies the action to perform on a mouse wheel event when a given modifier is pressed \see deregisterMouseWheelAction(), clearAllMouseWheelActions(), JKQTPLOTTER_USERMOUSEINTERACTION */ + /** \brief specifies the action to perform on a mouse wheel event when a given modifier is pressed \see deregisterMouseWheelAction(), clearAllMouseWheelActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */ void registerMouseWheelAction(Qt::KeyboardModifier modifier, MouseWheelActions action); - /** \brief deletes all mouse-wheel actions registered for a given \a modifier \see registerMouseWheelAction(), clearAllMouseWheelActions(), JKQTPLOTTER_USERMOUSEINTERACTION */ + /** \brief deletes all mouse-wheel actions registered for a given \a modifier \see registerMouseWheelAction(), clearAllMouseWheelActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */ void deregisterMouseWheelAction(Qt::KeyboardModifier modifier); - /** \brief deletes all mouse-wheel actions \see registerMouseWheelAction(), deregisterMouseWheelAction(), JKQTPLOTTER_USERMOUSEINTERACTION */ + /** \brief deletes all mouse-wheel actions \see registerMouseWheelAction(), deregisterMouseWheelAction(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */ void clearAllMouseWheelActions(); /*! \brief returns the currently set special context menu object */ @@ -557,7 +686,7 @@ class LIB_EXPORT JKQTPlotter: public QWidget { return getConstplotter()->getKeyFontSize(); } - /** \brief returns the currently set mode for the context menu \see ContextMenuModes, JKQTPLOTTER_USERMOUSEINTERACTION */ + /** \brief returns the currently set mode for the context menu \see ContextMenuModes, \ref JKQTPLOTTER_USERMOUSEINTERACTION */ ContextMenuModes getContextMenuMode() const; @@ -652,25 +781,21 @@ class LIB_EXPORT JKQTPlotter: public QWidget { void setToolbarAlwaysOn(bool __value); /*! \brief sets the property displayMousePosition ( \copybrief displayMousePosition ) to the specified \a __value. \details Description of the parameter displayMousePosition is:
\copydoc displayMousePosition- \see displayMousePosition for more information */ + \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE */ void setMousePositionShown(bool __value); - /*! \brief sets the property userActionColor ( \copybrief userActionColor ) to the specified \a __value. - \details Description of the parameter userActionColor is:
\copydoc userActionColor- \see userActionColor for more information */ + /** \brief set the fill color of the zoom rectangle \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */ void setUserActionColor(const QColor & __value); - /*! \brief sets the property userActionCompositionMode ( \copybrief userActionCompositionMode ) to the specified \a __value. - \details Description of the parameter userActionCompositionMode is:
\copydoc userActionCompositionMode- \see userActionCompositionMode for more information */ + /** \brief set the QPainter::CompositionMode used to draw the zoom rectangle etc. \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */ void setUserActionCompositionMode(const QPainter::CompositionMode & __value); - /** \brief sets the mode if the standard context menu \see ContextMenuModes, JKQTPLOTTER_USERMOUSEINTERACTION */ + /** \brief sets the mode if the standard context menu \see ContextMenuModes, \ref JKQTPLOTTER_USERMOUSEINTERACTION */ void setContextMenuMode(ContextMenuModes mode); - /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the other x-axis */ + /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the other x-axis \see \ref JKQTPLOTTER_SYNCMULTIPLOT */ void synchronizeXAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender); - /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the other y-axis */ + /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the other y-axis \see \ref JKQTPLOTTER_SYNCMULTIPLOT */ void synchronizeYAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* 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 */ + /** \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 \see \ref JKQTPLOTTER_SYNCMULTIPLOT */ void synchronizeXYAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender); @@ -889,12 +1014,12 @@ class LIB_EXPORT JKQTPlotter: public QWidget { JKQTBasePlotter* plotter; - /** \brief fill color of the zoom rectangle */ + /** \brief fill color of the zoom rectangle \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */ QColor userActionColor; /*! \brief default value for property property userActionColor. \see userActionColor for more information */ QColor default_userActionColor; - /** \brief fill color of the zoom rectangle */ + /** \brief the QPainter::CompositionMode used to draw the zoom rectangle etc. \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */ QPainter::CompositionMode userActionCompositionMode; /*! \brief default value for property property userActionCompositionMode. \see userActionCompositionMode for more information */ QPainter::CompositionMode default_userActionCompositionMode; @@ -1043,7 +1168,7 @@ class LIB_EXPORT JKQTPlotter: public QWidget { * * \image html jkqtplotter_mousepositiondisplay.png * - * \see mousePositionTemplate, \ref JKQTPlotterUserInteraction + * \see mousePositionTemplate, \ref JKQTPlotterUserInteraction, \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE */ bool displayMousePosition; /** \brief this string is used to generate the position output above the graph (\c %1 is replaced by the x-position, \c %2 by the y-position)