2015-07-11 18:56:02 +08:00
/*
2020-08-26 18:58:23 +08:00
Copyright ( c ) 2008 - 2020 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
2019-02-08 00:24:46 +08:00
it under the terms of the GNU Lesser General Public License as published by
2015-07-11 18:56:02 +08:00
the Free Software Foundation , either version 3 of the License , or
( 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
2019-02-08 00:24:46 +08:00
GNU Lesser General Public License for more details .
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
You should have received a copy of the GNU Lesser General Public License
2015-07-11 18:56:02 +08:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef JKQTPTOOLS_H_INCLUDED
# define JKQTPTOOLS_H_INCLUDED
2019-06-22 20:21:32 +08:00
# include "jkqtplotter/jkqtplotter_imexport.h"
2015-07-11 18:56:02 +08:00
# include <QString>
# include <QElapsedTimer>
2018-12-19 00:13:18 +08:00
# include <QLocale>
2015-07-11 18:56:02 +08:00
# include <cfloat>
# include <sys/types.h>
# include <sys/stat.h>
# include <errno.h>
# include <string>
# include <iostream>
# include <fstream>
# include <sstream>
# include <cstdarg>
# include <cstdio>
# include <cstdlib>
# include <vector>
2018-12-19 00:13:18 +08:00
# include <ctime>
# include <cmath>
2019-05-06 01:31:20 +08:00
# include <limits>
2018-12-19 00:13:18 +08:00
# include <cstdint>
2015-07-11 18:56:02 +08:00
# include <stdexcept>
# include <cctype>
2019-05-30 04:40:02 +08:00
# include "jkqtcommon/jkqtpstringtools.h"
2019-06-02 21:38:09 +08:00
# include "jkqtcommon/jkqtpdebuggingtools.h"
2019-05-30 04:40:02 +08:00
# include "jkqtcommon/jkqtpmathtools.h"
# include "jkqtcommon/jkqtpalgorithms.h"
# include "jkqtcommon/jkqtpcodestructuring.h"
2015-07-11 18:56:02 +08:00
class JKQTPEnhancedPainter ; // forward
2019-01-20 17:49:29 +08:00
class JKQTBasePlotter ; // forward declaration
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
2020-09-26 21:58:58 +08:00
/** \brief used to specify teh type of graph when calling getPlotStyle()
* \ ingroup jkqtpplottersupprt
*/
enum class JKQTPPlotStyleType {
Default , /*!< general graphs */
Barchart , /*!< barchart-type graphs */
Boxplot , /*!< boxplot-type graphs */
Filled , /*!< filled graphs */
Impulses , /*!< impulse-type graphs */
Geometric , /*!< geometric elements (e.g. rectangles, circles, lines, ...) */
Annotation , /*!< annotation elements */
} ;
2019-05-06 01:31:20 +08:00
/** \brief Styles in which to mark single positions during user actions in JKQTPlotter
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-05-06 01:31:20 +08:00
*/
enum JKQTPUserActionMarkerType {
jkqtpuamtCircle = 0 , /*!< \brief a small circle around the position to mark */
jkqtpuamtCrossHair = 1 , /*!< \brief a cross-hair to the position to mark */
jkqtpuamtCircleAndCrossHair = 2 , /*!< \brief a cross-hair to the position to mark, with a circle-marker around the actual target (i.e. combines jkqtpuamtCircle and jkqtpuamtCrossHair) */
} ;
/** \brief convert a JKQTPUserActionMarkerType to a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a>
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-05-06 01:31:20 +08:00
*
* \ see String2JKQTPUserActionMarkerType ( ) , JKQTPUserActionMarkerType
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPUserActionMarkerType2String ( JKQTPUserActionMarkerType act ) ;
2019-05-06 01:31:20 +08:00
/** \brief convert a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a> (created by JKQTPUserActionMarkerType2String() ) to JKQTPUserActionMarkerType
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-05-06 01:31:20 +08:00
*
* \ see JKQTPUserActionMarkerType2String ( ) , JKQTPUserActionMarkerType
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPUserActionMarkerType String2JKQTPUserActionMarkerType ( const QString & act ) ;
2019-05-06 01:31:20 +08:00
2019-02-08 00:24:46 +08:00
/** \brief Availble action this JKQtPlotter can perform when mouse events occur.
* This allows you to e . g . draw rectangles or lines over the plot and receive a signal , when the drawing finishes
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
*/
enum JKQTPMouseDragActions {
jkqtpmdaPanPlotOnMove = 0 , /*!< \brief the user can drag the current plot window while keeping the left mouse-button pushed down (=panning), the new widow is applied/displayed whenever the mouse moves \image html drag_viewport.gif "Drag the Plot Viewport" */
jkqtpmdaPanPlotOnRelease , /*!< \brief the user can drag the current plot window while keeping the left mouse-button pushed down (=panning), the new widow is applied/displayed when the left mouse button is released */
jkqtpmdaZoomByRectangle , /*!< \brief draw a rectangle and when finish zoom to that rectangle */
jkqtpmdaDrawRectangleForEvent , /*!< \brief draw a rectangle and when finished execute the signal JKQTPlotter::userRectangleFinished() \image html draw_rectangle.gif "Draw Rectangle User-Action" */
jkqtpmdaDrawCircleForEvent , /*!< \brief draw a circle and when finished execute the signal JKQTPlotter::userCircleFinished() \image html draw_circle.gif "Draw Circle User-Action" */
jkqtpmdaDrawEllipseForEvent , /*!< \brief draw an ellipse and when finished execute the signal JKQTPlotter::userEllipseFinished() \image html draw_ellipse.gif "Draw Ellipse User-Action" */
jkqtpmdaDrawLineForEvent , /*!< \brief draw a line and when finished execute the signal JKQTPlotter::userLineFinished() \image html draw_line.gif "Draw Lines User-Action" */
jkqtpmdaScribbleForEvents , /*!< \brief let the user scribble on the plot (left mouse button is kept pressed) and call JKQTPlotter::userScribbleClick() for each new position */
2019-05-06 01:31:20 +08:00
jkqtpmdaToolTipForClosestDataPoint , /*!< \brief shows a tooltip with data of the closest data-point in the plot \image html tooltiptool.gif */
jkqtpmdaRuler , /*!< \brief shows a ruler over the plot, which measures delta X, delta Y and sqrt(dx^2+dy^2) \image html rulertool.gif */
2019-02-08 00:24:46 +08:00
} ;
2019-05-06 01:31:20 +08:00
2019-02-08 00:24:46 +08:00
/** \brief convert a JKQTPMouseDragActions to a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a>
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see String2JKQTPMouseDragActions ( ) , JKQTPMouseDragActions
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPMouseDragActions2String ( JKQTPMouseDragActions act ) ;
2019-02-08 00:24:46 +08:00
/** \brief convert a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a> (created by JKQTPMouseDragActions2String() ) to JKQTPMouseDragActions
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see JKQTPMouseDragActions2String ( ) , JKQTPMouseDragActions
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPMouseDragActions String2JKQTPMouseDragActions ( const QString & button ) ;
2019-02-08 00:24:46 +08:00
/** \brief actions that can be bound to a double-click of the mouse
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
enum JKQTPMouseDoubleClickActions {
jkqtpdcaClickZoomsIn = 0 , /*!< \brief a double-click zooms into the plot at the current mouse location */
jkqtpdcaClickZoomsOut , /*!< \brief a double-click zooms out of the plot at the current mouse location */
jkqtpdcaClickOpensContextMenu , /*!< \brief a double-click opens the context menu */
jkqtpdcaClickOpensSpecialContextMenu , /*!< \brief a double-click opens the special context menu \see setSpecialContextMenu() */
jkqtpdcaClickMovesViewport , /*!< \brief a double-click centers the x/y-range around the clicked position */
} ;
/** \brief convert a JKQTPMouseDoubleClickActions to a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a>
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see String2JKQTPMouseDoubleClickActions ( ) , JKQTPMouseDoubleClickActions
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPMouseDoubleClickActions2String ( JKQTPMouseDoubleClickActions act ) ;
2019-02-08 00:24:46 +08:00
/** \brief convert a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a> (created by JKQTPMouseDoubleClickActions2String() ) to JKQTPMouseDoubleClickActions
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see JKQTPMouseDoubleClickActions2String ( ) , JKQTPMouseDoubleClickActions
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPMouseDoubleClickActions String2JKQTPMouseDoubleClickActions ( const QString & act ) ;
2019-02-08 00:24:46 +08:00
/** \brief actions that can be bound to a mouse wheel event
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
enum JKQTPMouseWheelActions {
jkqtpmwaZoomByWheel = 0 , /*!< \brief use the mouse-wheel for zooming */
jkqtpmwaPanByWheel , /*!< \brief use the mouse-wheel for panning the plot */
} ;
/** \brief convert a JKQTPMouseWheelActions to a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a>
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see String2JKQTPMouseWheelActions ( ) , JKQTPMouseWheelActions
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPMouseWheelActions2String ( JKQTPMouseWheelActions act ) ;
2019-02-08 00:24:46 +08:00
/** \brief convert a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a> (created by JKQTPMouseWheelActions2String() ) to JKQTPMouseWheelActions
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see JKQTPMouseWheelActions2String ( ) , JKQTPMouseWheelActions
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPMouseWheelActions String2JKQTPMouseWheelActions ( const QString & act ) ;
2019-02-08 00:24:46 +08:00
/** \brief modes for the context menu
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
enum JKQTPContextMenuModes {
jkqtpcmmStandardContextMenu = 0 , /*!< \brief only show the standard context menu \image html zoomin_mouse_contextmenu.gif "Zooming with the mouse" */
jkqtpcmmSpecialContextMenu , /*!< \brief only show the special context menu \see setSpecialContextMenu() */
jkqtpcmmStandardAndSpecialContextMenu , /*!< \brief show the standard context menu, with the special context menu incorporated \see setSpecialContextMenu() */
jkqtpcmmNoContextMenu , /*!< \brief don't show a context menu at all */
} ;
/** \brief convert a JKQTPContextMenuModes to a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a>
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see String2JKQTPContextMenuModes ( ) , JKQTPContextMenuModes
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPContextMenuModes2String ( JKQTPContextMenuModes act ) ;
2019-02-08 00:24:46 +08:00
/** \brief convert a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a> (created by JKQTPContextMenuModes2String() ) to JKQTPContextMenuModes
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*
* \ see JKQTPContextMenuModes2String ( ) , JKQTPContextMenuModes
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPContextMenuModes String2JKQTPContextMenuModes ( const QString & act ) ;
2019-02-08 00:24:46 +08:00
2019-05-23 04:20:00 +08:00
/** \brief data structure for storage of assigned JKQTPMouseDragActions \see JKQTPMouseDragActionsHashMapIterator
* \ ingroup jkqtpplottersupprt */
2019-02-08 00:24:46 +08:00
typedef QHash < QPair < Qt : : MouseButton , Qt : : KeyboardModifiers > , JKQTPMouseDragActions > JKQTPMouseDragActionsHashMap ;
2019-05-23 04:20:00 +08:00
/** \brief iterator for JKQTPMouseDragActionsHashMap \see JKQTPMouseDragActionsHashMap
* \ ingroup jkqtpplottersupprt */
2019-02-08 00:24:46 +08:00
typedef JKQTPMouseDragActionsHashMap : : const_iterator JKQTPMouseDragActionsHashMapIterator ;
2019-05-23 04:20:00 +08:00
/** \brief data structure for storage of assigned JKQTPMouseWheelActions \see JKQTPMouseWheelActionsHashMapIterator
* \ ingroup jkqtpplottersupprt */
2019-02-08 00:24:46 +08:00
typedef QHash < Qt : : KeyboardModifiers , JKQTPMouseWheelActions > JKQTPMouseWheelActionsHashMap ;
2019-05-23 04:20:00 +08:00
/** \brief iterator for JKQTPMouseWheelActionsHashMap \see JKQTPMouseWheelActionsHashMap
* \ ingroup jkqtpplottersupprt */
2019-02-08 00:24:46 +08:00
typedef JKQTPMouseWheelActionsHashMap : : const_iterator JKQTPMouseWheelActionsHashMapIterator ;
2019-05-23 04:20:00 +08:00
/** \brief data structure for storage of assigned JKQTPMouseDoubleClickActions \see JKQTPMouseDoubleClickActionsHashMapIterator
* \ ingroup jkqtpplottersupprt */
2019-02-08 00:24:46 +08:00
typedef QHash < QPair < Qt : : MouseButton , Qt : : KeyboardModifiers > , JKQTPMouseDoubleClickActions > JKQTPMouseDoubleClickActionsHashMap ;
2019-05-23 04:20:00 +08:00
/** \brief iterator for JKQTPMouseDoubleClickActionsHashMap \see JKQTPMouseDoubleClickActionsHashMap
* \ ingroup jkqtpplottersupprt */
2019-02-08 00:24:46 +08:00
typedef JKQTPMouseDoubleClickActionsHashMap : : const_iterator JKQTPMouseDoubleClickActionsHashMapIterator ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief Specifies how a fill-color is derived from a given color
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplotter_styling
2019-02-08 00:24:46 +08:00
*/
enum JKQTPColorDerivationMode {
2020-09-26 21:58:58 +08:00
JKQTPFFCMFullyTransparentColor , /*!< \brief fully transparent color */
JKQTPFFCMNoColor = JKQTPFFCMFullyTransparentColor , /*!< \brief fully transparent color */
JKQTPFFCMBlack , /*!< \brief fill with black */
JKQTPFFCMGrey75 , /*!< \brief fill with 75% grey */
JKQTPFFCMGrey50 , /*!< \brief fill with 50% grey */
JKQTPFFCMGrey25 , /*!< \brief fill with 25% grey */
JKQTPFFCMWhite , /*!< \brief fill with white */
2020-09-28 21:37:45 +08:00
JKQTPFFCMBlackTransparent , /*!< \brief fill with black, slightly transparent */
JKQTPFFCMGrey75Transparent , /*!< \brief fill with 75% grey, slightly transparent */
JKQTPFFCMGrey50Transparent , /*!< \brief fill with 50% grey, slightly transparent */
JKQTPFFCMGrey25Transparent , /*!< \brief fill with 25% grey, slightly transparent */
JKQTPFFCMWhiteTransparent , /*!< \brief fill with white, slightly transparent */
2019-02-08 00:24:46 +08:00
JKQTPFFCMSameColor , /*!< \brief fill with the same color */
2020-09-28 21:37:45 +08:00
JKQTPFFCMSameNonTransparentColor , /*!< \brief fill with the same color, but remove any transparency (if any) */
JKQTPFFCMSameMoreTransparentColor , /*!< \brief fill with the a partly transparent color */
JKQTPFFCMSameEvenMoreTransparentColor , /*!< \brief fill with the a more transparent color than JKQTPFFCMMoreTransparentColor */
JKQTPFFCMSameLessTransparentColor , /*!< \brief fill with the a partly transparent color */
JKQTPFFCMSameEvenLessTransparentColor , /*!< \brief fill with the a more transparent color than JKQTPFFCMLessTransparentColor*/
2019-02-08 00:24:46 +08:00
JKQTPFFCMInvertedColor , /*!< \brief fill with the inverted color */
2020-09-28 21:37:45 +08:00
JKQTPFFCMInvertedTransparentColor , /*!< \brief fill with the inverted color, slightly transparent */
JKQTPFFCMInvertedNonTransparentColor , /*!< \brief fill with the inverted color, non-transparent (even if the basecolor had some transparency) */
2019-02-08 00:24:46 +08:00
JKQTPFFCMLighterColor , /*!< \brief fill with the a lighter color */
JKQTPFFCMEvenLighterColor , /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor */
JKQTPFFCMDarkerColor , /*!< \brief fill with the a darker color */
JKQTPFFCMEvenDarkerColor , /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor */
2020-09-27 22:11:58 +08:00
JKQTPFFCMLighterAndTransparentColor , /*!< \brief fill with the a lighter color, that is in addition a bit transparent */
JKQTPFFCMEvenLighterAndTransparentColor , /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is in addition a bit transparent */
JKQTPFFCMDarkerAndTransparentColor , /*!< \brief fill with the a darker color, that is in addition a bit transparent */
JKQTPFFCMEvenDarkerAndTransparentColor , /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is in addition a bit transparent */
2020-09-28 21:37:45 +08:00
JKQTPFFCMLighterAndNonTransparentColor , /*!< \brief fill with the a lighter color, that is non-transparent (even if the basecolor had some transparency) */
JKQTPFFCMEvenLighterAndNonTransparentColor , /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is non-transparent (even if the basecolor had some transparency) */
JKQTPFFCMDarkerAndNonTransparentColor , /*!< \brief fill with the a darker color, that is non-transparent (even if the basecolor had some transparency) */
JKQTPFFCMEvenDarkerAndNonTransparentColor , /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is non-transparent (even if the basecolor had some transparency) */
2019-02-08 00:24:46 +08:00
} ;
/** \brief use a JKQTPColorDerivationMode to derive a color from \a col as specified
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplotter_styling
2019-02-08 00:24:46 +08:00
*
2020-09-26 21:58:58 +08:00
* \ param mode the mode of how to modify the given color \ a basecolor
* \ param basecolor the color in which to base the derivation
*
2019-02-08 00:24:46 +08:00
* \ see JKQTPColorDerivationMode
*/
2020-09-26 21:58:58 +08:00
JKQTPLOTTER_LIB_EXPORT QColor JKQTPGetDerivedColor ( JKQTPColorDerivationMode mode , const QColor & basecolor ) ;
2019-02-08 00:24:46 +08:00
2019-05-06 01:31:20 +08:00
/** \brief construct a QColor, based on the given \a color, but with alpha set to the specified value \a alphaF
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplotter_styling
2019-05-06 01:31:20 +08:00
* \ see QColorWithAlpha ( )
*/
inline QColor QColorWithAlphaF ( const QColor & color , qreal alphaF ) {
QColor c = color ;
c . setAlphaF ( alphaF ) ;
return c ;
}
/** \brief construct a QColor, based on the given \a color, but with alpha set to the specified value \a alpha
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplotter_styling
2019-05-06 01:31:20 +08:00
* \ see QColorWithAlphaF ( )
*/
inline QColor QColorWithAlpha ( const QColor & color , int alpha ) {
QColor c = color ;
c . setAlpha ( alpha ) ;
return c ;
}
2019-02-08 00:24:46 +08:00
/** \brief convert a JKQTPColorDerivationMode to a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a>
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplotter_styling
2019-02-08 00:24:46 +08:00
*
* \ see String2JKQTPColorDerivationMode ( ) , JKQTPColorDerivationMode
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPColorDerivationMode2String ( JKQTPColorDerivationMode mode ) ;
2019-02-08 00:24:46 +08:00
/** \brief convert a <a href="http://doc.qt.io/qt-5/qstring.html">QString</a> (created by JKQTPColorDerivationMode2String() ) to JKQTPColorDerivationMode
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplotter_styling
2019-02-08 00:24:46 +08:00
*
* \ see JKQTPColorDerivationMode2String ( ) , JKQTPColorDerivationMode
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPColorDerivationMode String2JKQTPColorDerivationMode ( const QString & mode ) ;
2019-02-08 00:24:46 +08:00
2015-07-11 18:56:02 +08:00
/** \brief display mode for an axis
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt */
2019-01-20 17:49:29 +08:00
enum JKQTPCADrawMode {
2015-07-11 18:56:02 +08:00
JKQTPCADMcomplete = 0 , /*!< \brief draw axis with ticks, ticklabels and axis label */
2019-02-08 00:24:46 +08:00
JKQTPCADMLineTicksTickLabels , /*!< \brief draw axis with ticks, line and tick labels */
JKQTPCADMLineTicks , /*!< \brief draw axis with ticks and line */
JKQTPCADMLine , /*!< \brief draw axis as thick line */
JKQTPCADMTicksTickLabelsAxisLabel , /*!< \brief draw axis with ticks, tick labels and axisLabel */
JKQTPCADMTicksTickLabels , /*!< \brief draw axis with ticks and tick labels */
JKQTPCADMTickLabelsAxisLabel , /*!< \brief draw axis tick labels and axisLabel */
JKQTPCADMTickLabels , /*!< \brief draw axis tick labels */
JKQTPCADMTicks , /*!< \brief draw axis with ticks */
2015-07-11 18:56:02 +08:00
JKQTPCADMnone /*!< \brief draw no axis */
} ;
2019-02-08 00:24:46 +08:00
/** \brief determines whether JKQTPCADrawMode has the line
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasLine ( JKQTPCADrawMode pos ) ;
2019-02-08 00:24:46 +08:00
/** \brief determines whether JKQTPCADrawMode has ticks
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasTicks ( JKQTPCADrawMode pos ) ;
2019-02-08 00:24:46 +08:00
/** \brief determines whether JKQTPCADrawMode has tick labels
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasTickLabels ( JKQTPCADrawMode pos ) ;
2019-02-08 00:24:46 +08:00
/** \brief determines whether JKQTPCADrawMode has the axis label
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-02-08 00:24:46 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasAxisLabel ( JKQTPCADrawMode pos ) ;
2019-02-08 00:24:46 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a JKQTPCADrawMode variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPCADrawMode2String ( JKQTPCADrawMode pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a string into a JKQTPCADrawMode
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPCADrawMode String2JKQTPCADrawMode ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
/** \brief display mode for the axis labels
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt */
2019-01-20 17:49:29 +08:00
enum JKQTPCALabelType {
2019-01-27 03:12:54 +08:00
JKQTPCALTdefault , /*!< \brief simply print the numbers \image html JKQTPCALTdefault.png */
2019-05-30 04:40:02 +08:00
JKQTPCALTexponentCharacter , /*!< \brief print the numbers and show a unit character, i.e. 5μ for \f$ 5\cdot 10^{-6} \f$ , \c 3k for \f$ 3\cdot 10^3 \f$ ... */
2019-01-27 03:12:54 +08:00
JKQTPCALTexponent , /*!< \brief show numbers in exponential for, e.g. \f$ 3\cdot 10^5 \f$ ... \image html JKQTPCALTexponent.png */
JKQTPCALTdate , /*!< \brief show numbers as dates \image html JKQTPCALTdate.png */
JKQTPCALTtime , /*!< \brief show numbers as times \image html JKQTPCALTtime.png*/
2015-07-11 18:56:02 +08:00
JKQTPCALTdatetime , /*!< \brief show numbers as times */
} ;
/** \brief mode of the axis ticks
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt */
2015-07-11 18:56:02 +08:00
enum JKQTPLabelTickMode {
JKQTPLTMLinOrPower = 0 , /*!< \brief linear, or log, depending on whether the axis is log */
JKQTPLTMLin , /*!< \brief always linear (even for log-axes) */
JKQTPLTMPower , /*!< \brief powers (of the log-base) */
} ;
/** \brief converts a JKQTPLabelTickMode variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPLabelTickMode2String ( JKQTPLabelTickMode pos ) ;
2015-07-11 18:56:02 +08:00
/** \brief converts a string into a JKQTPLabelTickMode
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPLabelTickMode String2JKQTPLabelTickMode ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a JKQTPCALabelType variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPCALabelType2String ( JKQTPCALabelType pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a string into a JKQTPCALabelType
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPCALabelType String2JKQTPCALabelType ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
/** \brief position of the axis labels
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-01-20 17:49:29 +08:00
enum JKQTPLabelPosition {
JKQTPLabelMin = 0 , /*!< \brief the axis label is near the min value of the axis (left/bottom) */
2019-02-08 00:24:46 +08:00
JKQTPLabelMax , /*!< \brief the axis label is near the max value of the axis (right/top) */
JKQTPLabelCenter /*!< \brief the label is at the center of the axis */
2015-07-11 18:56:02 +08:00
} ;
2019-01-20 17:49:29 +08:00
/** \brief converts a JKQTPLabelPosition variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPLabelPosition2String ( JKQTPLabelPosition pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a string into a JKQTPLabelPosition
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPLabelPosition String2JKQTPLabelPosition ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
/** \brief position of the key
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-01-20 17:49:29 +08:00
enum JKQTPKeyPosition {
JKQTPKeyOutsideTopRight = 0 , /*!< \brief the key is positioned on the right side of the graph */
JKQTPKeyOutsideTopLeft , /*!< \brief the key is positioned on the left side of the graph */
JKQTPKeyOutsideLeftTop , /*!< \brief the key is positioned above the graph */
JKQTPKeyOutsideLeftBottom , /*!< \brief the key is positioned below the graph */
JKQTPKeyOutsideRightBottom , /*!< \brief the key is positioned on the right side of the graph */
JKQTPKeyOutsideRightTop , /*!< \brief the key is positioned on the left side of the graph */
JKQTPKeyOutsideBottomLeft , /*!< \brief the key is positioned above the graph */
JKQTPKeyOutsideBottomRight , /*!< \brief the key is positioned below the graph */
JKQTPKeyInsideTopRight , /*!< \brief the key is positioned inside on the right side of the graph, but inside the graph*/
JKQTPKeyInsideTopLeft , /*!< \brief the key is positioned inside on the left side of the graph */
JKQTPKeyInsideBottomLeft , /*!< \brief the key is positioned inside on the upper bound of the graph */
JKQTPKeyInsideBottomRight /*!< \brief the key is positioned inside on the lower bound of the graph */
2015-07-11 18:56:02 +08:00
} ;
2019-01-20 17:49:29 +08:00
/** \brief converts a JKQTPLabelPosition variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPKeyPosition2String ( JKQTPKeyPosition pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a string into a JKQTPLabelPosition
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPKeyPosition String2JKQTPKeyPosition ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
/** \brief layout of the key
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-01-20 17:49:29 +08:00
enum JKQTPKeyLayout {
JKQTPKeyLayoutOneColumn , /*!< \brief the key consists of one column */
JKQTPKeyLayoutOneRow , /*!< \brief the key consists of one row */
JKQTPKeyLayoutMultiColumn , /*!< \brief the key consists of multiple columns */
2015-07-11 18:56:02 +08:00
} ;
2019-01-20 17:49:29 +08:00
/** \brief converts a JKQTPKeyLayout variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPKeyLayout2String ( JKQTPKeyLayout pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a String into a JKQTPKeyLayout
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPKeyLayout String2JKQTPKeyLayout ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
/** \brief used to represent the position of other graphs in \ref jkqtplotter_base_saveprint
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-01-20 17:49:29 +08:00
* \ internal
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
struct JKQTPLOTTER_LIB_EXPORT JKQTPGridPrintingItem {
2019-01-20 17:49:29 +08:00
/** \brief logic x-position of a graph, relative to the current JKQtPlotter */
2019-06-21 21:46:53 +08:00
size_t x ;
2019-01-20 17:49:29 +08:00
/** \brief logic y-position of a graph, relative to the current JKQtPlotter */
2019-06-21 21:46:53 +08:00
size_t y ;
2019-01-20 17:49:29 +08:00
/** \brief JKQTBasePlotter */
JKQTBasePlotter * plotter ;
} ;
2015-07-11 18:56:02 +08:00
/** \brief plot styles for the error information
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtplotter_basegraphserrors
2015-07-11 18:56:02 +08:00
*/
2019-01-20 17:49:29 +08:00
enum JKQTPErrorPlotstyle {
2019-01-26 20:00:40 +08:00
JKQTPErrorEllipses = 10 , /*!< \brief an ellipse spanned by the errors \image html JKQTPErrorEllipses.png */
JKQTPErrorBoxes = 9 , /*!< \brief a box spanned by the errors \image html JKQTPErrorBoxes.png */
JKQTPErrorSimpleBarsPolygons = 8 , /*!< \brief simplified error barsand polygons for each data point \image html JKQTPErrorSimpleBarsPolygons.png */
JKQTPErrorSimpleBarsLines = 7 , /*!< \brief simplified error bars and line for each data point \image html JKQTPErrorSimpleBarsLines.png */
JKQTPErrorSimpleBars = 6 , /*!< \brief simplified error bars for each data point \image html JKQTPErrorSimpleBars.png */
JKQTPErrorLines = 5 , /*!< \brief a second and third graph line above and below the actual data which indicates the error value \image html JKQTPErrorLines.png */
JKQTPErrorBars = 4 , /*!< \brief error bars for each data point \image html JKQTPErrorBars.png */
JKQTPErrorPolygons = 3 , /*!< \brief line error lines, but with filled range in between \image html JKQTPErrorPolygons.png */
JKQTPErrorBarsLines = 2 , /*!< \brief error bars and lines for each data point \image html JKQTPErrorBarsLines.png */
JKQTPErrorBarsPolygons = 1 , /*!< \brief error bars and polygons for each data point \image html JKQTPErrorBarsPolygons.png */
JKQTPNoError = 0 /*!< \brief don't show error information \image html JKQTPNoError.png */
2015-07-11 18:56:02 +08:00
} ;
2019-01-20 17:49:29 +08:00
/** \brief converts a JKQTPErrorPlotstyle variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtplotter_basegraphserrors
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPErrorPlotstyle2String ( JKQTPErrorPlotstyle pos ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 17:49:29 +08:00
/** \brief converts a String into a JKQTPErrorPlotstyle
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtplotter_basegraphserrors
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPErrorPlotstyle String2JKQTPErrorPlotstyle ( const QString & pos ) ;
2015-07-11 18:56:02 +08:00
2018-12-07 04:41:35 +08:00
/** \brief plot styles for the error information
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtplotter_linesymbolgraphs_simple
2019-01-26 20:00:40 +08:00
*
2019-04-22 19:27:50 +08:00
* \ see JKQTPSpecialLineTypeComboBox
2018-12-07 04:41:35 +08:00
*/
2019-04-22 19:27:50 +08:00
enum JKQTPSpecialLineType {
2019-01-26 20:00:40 +08:00
JKQTPStepLeft = 0 , /*!< \brief datapoint is on the left edge of the hor. step line \image html JKQTPStepLeft.png */
JKQTPStepCenter = 1 , /*!< \brief datapoint is centered on the hor. step line \image html JKQTPStepCenter.png */
JKQTPStepRight = 2 , /*!< \brief datapoint is on the right edge of the hor. step line \image html JKQTPStepRight.png */
2019-04-22 19:27:50 +08:00
JKQTPStepAverage = 3 , /*!< \brief horizontal line on the level of the average between two points + vertical lines to the points \image html JKQTPStepAverage.png */
JKQTPDirectLine = 4 , /*!< \brief no step, but connects the two datapoints with a straight line \image html JKQTPDirectLine.png */
2018-12-07 04:41:35 +08:00
} ;
2019-04-22 19:27:50 +08:00
/** \brief converts a JKQTPSpecialLineType variable into a human-readable string
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtplotter_linesymbolgraphs_simple
2018-12-07 04:41:35 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT QString JKQTPSpecialLineType2String ( JKQTPSpecialLineType pos ) ;
2018-12-07 04:41:35 +08:00
2019-04-22 19:27:50 +08:00
/** \brief converts a String into a JKQTPSpecialLineType
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtplotter_linesymbolgraphs_simple
2018-12-07 04:41:35 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT JKQTPSpecialLineType String2JKQTPSpecialLineType ( const QString & pos ) ;
2019-04-22 19:27:50 +08:00
2019-05-19 04:41:38 +08:00
2019-05-06 01:31:20 +08:00
2015-07-11 18:56:02 +08:00
# endif // JKQTPTOOLS_H_INCLUDED