IMPROVED/REWORKED: reworked JKQTPCADrawMode and coordinate axis drawing so the draw mide can be specified as ORed combination of flags from JKQTPCADrawModeElements, added flags to draw arrows at the end of the axis line

IMPROVED/REWORKED: coordinate axis code was refactored
NEW: all elements of a coordinate axis may have their own color now
This commit is contained in:
jkriege2 2022-09-23 20:43:53 +02:00
parent a769437ae3
commit d2c2185f9c
193 changed files with 871 additions and 589 deletions

View File

@ -114,13 +114,13 @@ if(JKQtPlotter_BUILD_TOOLS)
)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listerrorindicators)
add_custom_target(JKQTPlotter_GenerateDocImages_listaxislabeltype
COMMENT "Building JKQTPlotter Documentation Images: listaxislabeltype"
COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --listaxislabeltype --background=lightgrey --iconsize=50 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/"
add_custom_target(JKQTPlotter_GenerateDocImages_listaxisstyleprops
COMMENT "Building JKQTPlotter Documentation Images: listaxisstyleprops"
COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --listaxisstyleprops --background=lightgrey --iconsize=50 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/axisstyle/"
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
DEPENDS jkqtplotter_doc_imagegenerator
)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listaxislabeltype)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listaxisstyleprops)
endif(JKQtPlotter_BUILD_TOOLS)

View File

@ -29,6 +29,8 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
<li>REORGANIZED: separated line-graphs from jkqtpscatter.h/.cpp into jkqtplines.h/.cpp</li>
<li>IMPROVED: QT6-compatibility by removing deprecated warnings</li>
<li>IMPROVED/REWORKED: reworked JKQTPErrorPlotstyle and error indicator plotting so error-inidcators can be specified as ORed combination of flags from JKQTPErrorPlotstyleElements, added additional error indicator styles (half-bars, arrows...)</li>
<li>IMPROVED/REWORKED: reworked JKQTPCADrawMode and coordinate axis drawing so the draw mide can be specified as ORed combination of flags from JKQTPCADrawModeElements, added flags to draw arrows at the end of the axis line</li>
<li>IMPROVED/REWORKED: coordinate axis code was refactored</li>
<li>NEW: JKQTPFilledCurveXGraph and JKQTPFilledCurveYGraph can now plot wiggle plots with different fill styles above and below the baseline (feature request <a href="https://github.com/jkriege2/JKQtPlotter/issues/68">#68 Wiggle Plots</a> from <a href="https://github.com/xichaoqiang">user:xichaoqiang</a> </li>
<li>NEW/BREAKING CHANGE: data tooltip can now also be shown when "just" moving the mouse (so far this was only possible when dragging the mouse with a button pressed). This also removes JKQtPlotter::getActMouseLeftAsToolTip() and adds JKQtPlotter::getActMouseMoveToolTip() instead! Also the default toolbars and context menus changed!</li>
<li>NEW: new "seaborn" style for plots, see \ref jkqtpplotter_styling </li>
@ -54,6 +56,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
<li>NEW: Added signals JKQTBasePlotter::beforeExporting()/JKQTBasePlotter::afterExporting() and JKQTBasePlotterJKQTBasePlotter:beforePrinting()/JKQTBasePlotter::afterPrinting() which allow to modify the plot just before and just after an export/print</li>
<li>NEW: Added new JKQTPCALabelType elements (JKQTPCALTfrac...), so axis label ticks can be displayed as fractions 1/2 instead of 0.5</li>
<li>NEW: Added new JKQTPCALabelType element JKQTPCALTscientific, so axis label ticks can be displayed as numbers in scientific notation like \c 1.2E-34 </li>
<li>NEW: all elements of a coordinate axis may have their own color now </li>
</ul></li>
<li>JKQTMathText:<ul>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -83,7 +83,7 @@ void drawWithDateAxis(JKQTPlotter& plot) {
// set the title above the plot, use LaTeX instructions to make text bold
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
// set x-axis date-time-axis
plot.getXAxis()->setLabelType(JKQTPCALTdatetime);
plot.getXAxis()->setTickLabelType(JKQTPCALTdatetime);
plot.getXAxis()->setAxisLabel("Date");
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
plot.getXAxis()->setTickDateTimeFormat("MMM ''yy");
@ -150,7 +150,7 @@ void drawWithTimeAxis(JKQTPlotter& plot) {
// set the title above the plot, use LaTeX instructions to make text bold
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
// set x-axis date-time-axis
plot.getXAxis()->setLabelType(JKQTPCALTtime);
plot.getXAxis()->setTickLabelType(JKQTPCALTtime);
plot.getXAxis()->setAxisLabel("Time of Day");
// set format string for time axis with 24-hour and minute only,
// see QDateTime::toString() documentation for details on format strings

View File

@ -22,7 +22,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
plotBarchart->getPlotter()->setPlotLabel(tr("\\textbf{bar charts}"));
plotBarchart->setObjectName("plotBarchart");
plotBarchart->getPlotter()->setUserSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
plotBarchart->getPlotter()->getXAxis()->setLabelType(JKQTPCALTdate);
plotBarchart->getPlotter()->getXAxis()->setTickLabelType(JKQTPCALTdate);
plotBarchart->getPlotter()->getXAxis()->setTickDateFormat("dd. MMM yyyy");
barchartLayout->addWidget(plotBarchart);

View File

@ -86,7 +86,7 @@ int main(int argc, char* argv[])
plot.getYAxis()->setDrawMinorGrid(true);
// usually axis ticks are shown as numbers 0.01, 0.1, 1, 10, ... You can also force the scientific
// power-of-10 notation, using:
plot.getYAxis()->setLabelType(JKQTPCALTexponent);
plot.getYAxis()->setTickLabelType(JKQTPCALTexponent);
// the number of digits in JKQTPCALTexponent determines which labels are drawn in standard-notation,
// as compared to power-notation (e.g. if set to 1, the labels 0.1=10^{-1}, 1, 10 are shown in
// standard notation, the rest in power-notation. This tweak improves readability)

View File

@ -484,8 +484,7 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
submenu->setEnabled(true);
QAction* act;
JKQTPCADrawMode st;
for (int i=0; i<=static_cast<int>(JKQTPCADMmax); i++) {
st=static_cast<JKQTPCADrawMode>(i);
for (const JKQTPCADrawMode st : {JKQTPCADMnone,JKQTPCADMcomplete,JKQTPCADMcompleteMaxArrow,JKQTPCADMcompleteMinMaxArrow,JKQTPCADMLine,JKQTPCADMTicks,JKQTPCADMTickLabels,JKQTPCADMAxisLabel,JKQTPCADMLineTicksTickLabels,JKQTPCADMLineTicks,JKQTPCADMTicksTickLabelsAxisLabel,JKQTPCADMTicksTickLabels,JKQTPCADMTickLabelsAxisLabel}) {
act=new QAction(JKQTPCADrawMode2String(st));
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
submenu->addAction(act);

View File

@ -311,7 +311,10 @@ JKQTCOMMON_LIB_EXPORT void JKQTPPlotSymbol(QPaintDevice& paintDevice, double x,
*
* \image html geo_arrow_tipsatlineend.png
*
* \see \ref JKQTPlotterGeometricArrows and \ref JKQTPlotterGeometricGraphs
*
* \see JKQTPPlotLineDecorator(), JKQTPPlotDecoratedLine(), JKQTPLineDecoratorStyle, JKQTPLineDecoratorStyleCalcDecoratorSize()
*
* \see \ref JKQTPlotterGeometricArrows and \ref JKQTPlotterGeometricGraphs for usage examples.
*/
enum JKQTPLineDecoratorStyle {
JKQTPNoDecorator=0, /*!< \brief no decorator, i.e. a simple line-end \image html linedecorators/none.png */
@ -368,8 +371,10 @@ JKQTCOMMON_LIB_EXPORT JKQTPLineDecoratorStyle String2JKQTPLineDecoratorStyle(con
\param y y-coordinate of the decorator tip
\param angle_rad angle of the line pointing to (x,y), given in radians, 0rad points to the right, >0rad is a counter-clockwise rotation, as calculated by atan2() from dx, dy of a line!
\param style type of the decorator to plot, see JKQTPLineDecoratorStyle
\param size size of the decorator
\param size size of the decorator in pixels, the decorator fills at most the space \c x...x+size and \c y-size/2...y-size/2, but may be smaller (e.g. arrows are typically less high than the full \a size pixels ).
\param[out] line_start optional output parameter: when drawing the line let it end here, not necessarily at (x,y)
\see JKQTPPlotLineDecorator(), JKQTPPlotDecoratedLine(), JKQTPLineDecoratorStyle, JKQTPLineDecoratorStyleCalcDecoratorSize()
*/
template <class TPainter>
inline void JKQTPPlotLineDecorator(TPainter& painter, double x, double y, double angle_rad, JKQTPLineDecoratorStyle style, double size, QPointF* line_start=nullptr);
@ -384,11 +389,19 @@ inline void JKQTPPlotLineDecorator(TPainter& painter, double x, double y, double
\param size1 size of the first decorator
\param style2 type of the second decorator to plot, see JKQTPLineDecoratorStyle
\param size2 size of the second decorator
\note a decorator fills at most the space \c x...x+size and \c y-size/2...y-size/2 (where \c size is \a size1 or \a size2), but may be smaller (e.g. arrows are typically less high than the full \c size pixels ).
\see JKQTPPlotLineDecorator(), JKQTPPlotDecoratedLine(), JKQTPLineDecoratorStyle, JKQTPLineDecoratorStyleCalcDecoratorSize()
*/
template <class TPainter>
inline void JKQTPPlotDecoratedLine(TPainter& painter, const QLineF& l, JKQTPLineDecoratorStyle style1, double size1, JKQTPLineDecoratorStyle style2, double size2);
/** \brief calculates the tail decorator size from the line width \a line_width, using decoratorSizeFactor and a non-linear scaling function that levels off towards small \a line_width and increases sub-linearly for large ones, so the arrow heads to not grow too much */
/*! \brief calculates the tail decorator size from the line width \a line_width, using decoratorSizeFactor and a non-linear scaling function that levels off towards small \a line_width and increases sub-linearly for large ones, so the arrow heads to not grow too much
\ingroup jkqtptools_drawing
\see JKQTPPlotLineDecorator(), JKQTPPlotDecoratedLine(), JKQTPLineDecoratorStyle, JKQTPLineDecoratorStyleCalcDecoratorSize()
*/
JKQTCOMMON_LIB_EXPORT double JKQTPLineDecoratorStyleCalcDecoratorSize(double line_width, double decoratorSizeFactor);

View File

@ -377,6 +377,8 @@ JKQTPCADrawModeComboBox::JKQTPCADrawModeComboBox(QWidget *parent):
{
setEditable(false);
addDrawMode(JKQTPCADMcomplete, tr("complete"), QIcon(":/JKQTPlotter/jkqtp_axis_complete.png"));
addDrawMode(JKQTPCADMcompleteMaxArrow, tr("complete with max arrow"), QIcon(":/JKQTPlotter/jkqtp_axis_complete_maxarrow.png"));
addDrawMode(JKQTPCADMcompleteMinMaxArrow, tr("complete wih min&max arrows"), QIcon(":/JKQTPlotter/jkqtp_axis_complete_minmaxarrow.png"));
addDrawMode(JKQTPCADMLineTicksTickLabels, tr("line+tick+labels"), QIcon(":/JKQTPlotter/jkqtp_axis_ticksandlabels.png"));
addDrawMode(JKQTPCADMLineTicks, tr("line+tick"), QIcon(":/JKQTPlotter/jkqtp_axis_ticks.png"));
addDrawMode(JKQTPCADMLine, tr("line"), QIcon(":/JKQTPlotter/jkqtp_axis_line.png"));

File diff suppressed because it is too large Load Diff

View File

@ -250,7 +250,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
/** \copydoc userLogTickSpacing */
inline double getUserLogTickSpacing() const { return this->userLogTickSpacing; }
/** \copydoc JKQTPCoordinateAxisStyle::labelType */
inline JKQTPCALabelType getLabelType() const { return this->axisStyle.labelType; }
inline JKQTPCALabelType getTickLabelType() const { return this->axisStyle.tickLabelType; }
/** \copydoc axisLabel */
inline QString getAxisLabel() const { return this->axisLabel; }
/** \copydoc JKQTPCoordinateAxisStyle::labelPosition */
@ -271,10 +271,22 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
inline unsigned int getMinorTicks() const { return this->axisStyle.minorTicks; }
/** \copydoc JKQTPCoordinateAxisStyle::tickOutsideLength */
inline double getTickOutsideLength() const { return this->axisStyle.tickOutsideLength; }
/** \copydoc JKQTPCoordinateAxisStyle::arrowSizeFactor */
inline double getArrowSizeFactor() const { return this->axisStyle.arrowSizeFactor; }
/** \copydoc JKQTPCoordinateAxisStyle::minorTickOutsideLength */
inline double getMinorTickOutsideLength() const { return this->axisStyle.minorTickOutsideLength; }
/** \copydoc JKQTPCoordinateAxisStyle::axisColor */
inline QColor getAxisColor() const { return this->axisStyle.axisColor; }
/** \copydoc JKQTPCoordinateAxisStyle::labelColor */
inline QColor getLabelColor() const { return this->axisStyle.labelColor; }
/** \copydoc JKQTPCoordinateAxisStyle::minorTickColor */
inline QColor getMinorTickColor() const { return this->axisStyle.minorTickColor; }
/** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelColor */
inline QColor getMinorTickLabelColor() const { return this->axisStyle.minorTickLabelColor; }
/** \copydoc JKQTPCoordinateAxisStyle::tickColor */
inline QColor getTickColor() const { return this->axisStyle.tickColor; }
/** \copydoc JKQTPCoordinateAxisStyle::tickLabelColor */
inline QColor getTickLabelColor() const { return this->axisStyle.tickLabelColor; }
/** \copydoc JKQTPCoordinateAxisStyle::showZeroAxis */
inline bool getShowZeroAxis() const { return this->axisStyle.showZeroAxis; }
/** \copydoc JKQTPGridStyle::lineColor */
@ -441,7 +453,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
void setUserLogTickSpacing (double __value);
/** \copydoc JKQTPCoordinateAxisStyle::labelType */
void setLabelType (JKQTPCALabelType __value);
void setTickLabelType (JKQTPCALabelType __value);
/** \copydoc JKQTPCoordinateAxisStyle::tickMode */
void setTickMode (JKQTPLabelTickMode __value);
@ -561,6 +573,18 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
/** \copydoc JKQTPCoordinateAxisStyle::tickLabelAngle */
void setTickLabelAngle(double __value);
/** \copydoc JKQTPCoordinateAxisStyle::arrowSizeFactor */
void setArrowSizeFactor(double f) ;
/** \copydoc JKQTPCoordinateAxisStyle::labelColor */
void setLabelColor(QColor c) ;
/** \copydoc JKQTPCoordinateAxisStyle::minorTickColor */
void setMinorTickColor(QColor c) ;
/** \copydoc JKQTPCoordinateAxisStyle::minorTickLabelColor */
void setMinorTickLabelColor(QColor c) ;
/** \copydoc JKQTPCoordinateAxisStyle::tickColor */
void setTickColor(QColor c);
/** \copydoc JKQTPCoordinateAxisStyle::tickLabelColor */
void setTickLabelColor(QColor c) ;
protected:
/** \brief indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ... */
@ -742,6 +766,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
/** \brief calculates the maximum width and height (returned as QSize) of all tick labels.
* Ascent and descent may also be returned in the two additional pointer arguments- */
QSizeF getMaxTickLabelSize(JKQTPEnhancedPainter& painter, double* ascent=nullptr, double* descent=nullptr);
/** \brief draw the axis line \a l (pointing from axismin to axismax) optionally decorated as specified by \a drawMode using JKQTPEnhancedPainter \a painter */
void drawAxisLine(JKQTPEnhancedPainter& painter, const QLineF& l, JKQTPCADrawMode drawMode) const;
};
@ -783,8 +809,36 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPVerticalAxis: public JKQTPCoordinateAxis {
virtual double getParentOtheraxisOffset() const override;
protected:
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize) ;
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize) ;
/** \brief draw a tick label on the left axis 1 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
*
* \param painter the JKQTPEnhancedPainter used for drawing
* \param xx the exact position of the tick in pixels
* \param yy the exact position of the tick in pixels
* \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
* \param label text to display
* \param fontSize the fontSize of the label (in pt)
* \param ascentMax maximum ascent of all tick labels
* \param descentMax maximum descent of all tick labels
* \param isMinor indicates whether the axis tick is a minor tick
*/
void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false) ;
/** \brief draw a tick label on the right axis 2 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
*
* \param painter the JKQTPEnhancedPainter used for drawing
* \param xx the exact position of the tick in pixels
* \param yy the exact position of the tick in pixels
* \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
* \param label text to display
* \param fontSize the fontSize of the label (in pt)
* \param ascentMax maximum ascent of all tick labels
* \param descentMax maximum descent of all tick labels
* \param isMinor indicates whether the axis tick is a minor tick
*/
void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false) ;
/** \brief draw the axis label using \a painter for axis 1 at \c x= \a left and \c y= \a bottom. \a labelMax is the maximum Size of all tick labels */
void drawAxisLabel1(JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax);
/** \brief draw the axis label using \a painter for axis 2 at \c x= \a right and \c y= \a bottom. \a labelMax is the maximum Size of all tick labels */
void drawAxisLabel2(JKQTPEnhancedPainter &painter, double right, double bottom, QSizeF labelMax);
};
@ -871,9 +925,36 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPHorizontalAxis: public JKQTPCoordinateAxis {
virtual double getParentOtheraxisOffset() const override;
protected:
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax) ;
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax) ;
/** \brief draw a tick label on the lower axis 1 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
*
* \param painter the JKQTPEnhancedPainter used for drawing
* \param xx the exact position of the tick in pixels
* \param yy the exact position of the tick in pixels
* \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
* \param label text to display
* \param fontSize the fontSize of the label (in pt)
* \param ascentMax maximum ascent of all tick labels
* \param descentMax maximum descent of all tick labels
* \param isMinor indicates whether the axis tick is a minor tick
*/
void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, double ascentMax, double descentMax, bool isMinor=false) ;
/** \brief draw a tick label on the upper axis 2 with text \a label (with optional rotation) at ( \a xx , \a yy ) (in pixel)
*
* \param painter the JKQTPEnhancedPainter used for drawing
* \param xx the exact position of the tick in pixels
* \param yy the exact position of the tick in pixels
* \param labelOffset offset of the label from ( \a xx , \a yy ) in pt, this is typically equal to \c tickOuterLength+tickLabelDistance
* \param label text to display
* \param fontSize the fontSize of the label (in pt)
* \param ascentMax maximum ascent of all tick labels
* \param descentMax maximum descent of all tick labels
* \param isMinor indicates whether the axis tick is a minor tick
*/
void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, double ascentMax, double descentMax, bool isMinor=false) ;
/** \brief draw the axis label using \a painter for axis 1 at \c x= \a left and \c y= \a bottom. \a labelMax is the maximum Size of all tick labels */
void drawAxisLabel1(JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax);
/** \brief draw the axis label using \a painter for axis 2 at \c x= \a left and \c y= \a top. \a labelMax is the maximum Size of all tick labels */
void drawAxisLabel2(JKQTPEnhancedPainter &painter, double left, double top, QSizeF labelMax);
};

View File

@ -33,7 +33,7 @@ JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle():
labelDigits(3),
autoLabelDigits(true),
minorTickLabelsEnabled(false),
labelType(JKQTPCALTexponent),
tickLabelType(JKQTPCALTexponent),
tickMode(JKQTPLTMLinOrPower),
labelPosition(JKQTPLabelCenter),
labelFontSize(10),
@ -43,9 +43,14 @@ JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle():
minorTickLabelFullNumber(true),
drawMode1(JKQTPCADMcomplete),
drawMode2(JKQTPCADMLineTicks),
minorTickColor(QColor("black")),
minorTickLabelColor(QColor("black")),
minorTickWidth(1),
tickColor(QColor("black")),
tickLabelColor(QColor("black")),
tickWidth(1.5),
lineWidth(1.5),
arrowSizeFactor(8),
lineWidthZeroAxis(1.5),
tickTimeFormat(QLocale().timeFormat(QLocale::NarrowFormat)),
tickDateFormat(QLocale().dateFormat(QLocale::NarrowFormat)),
@ -57,7 +62,8 @@ JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle():
tickInsideLength(3),
minorTickInsideLength(1.5),
axisColor(QColor("black")),
tickLabelDistance(3),
labelColor(QColor("black")),
tickLabelDistance(4),
labelDistance(5),
tickLabelAngle(0),
majorGridStyle(true),
@ -85,6 +91,7 @@ void JKQTPCoordinateAxisStyle::loadSettings(const QSettings &settings, const QSt
minorTickWidth = settings.value(group+"minor_tick/width", defaultStyle.minorTickWidth).toDouble();
tickWidth = settings.value(group+"ticks/width", defaultStyle.tickWidth).toDouble();
lineWidth = settings.value(group+"line_width", defaultStyle.lineWidth).toDouble();
arrowSizeFactor = settings.value(group+"arrow_size_factor", defaultStyle.arrowSizeFactor).toDouble();
lineWidthZeroAxis = settings.value(group+"zero_line/line_width", defaultStyle.lineWidthZeroAxis).toDouble();
labelFontSize = settings.value(group+"axis_label/font_size", defaultStyle.labelFontSize).toDouble();
tickLabelFontSize = settings.value(group+"ticks/label_font_size", defaultStyle.tickLabelFontSize).toDouble();
@ -102,8 +109,13 @@ void JKQTPCoordinateAxisStyle::loadSettings(const QSettings &settings, const QSt
tickLabelDistance = settings.value(group+"ticks/label_distance", defaultStyle.tickLabelDistance).toDouble();
labelDistance = settings.value(group+"axis_label/distance", defaultStyle.labelDistance).toDouble();
labelPosition=String2JKQTPLabelPosition(settings.value(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition)).toString());
labelType=String2JKQTPCALabelType(settings.value(group+"axis_label/type", JKQTPCALabelType2String(labelType)).toString());
tickLabelType=String2JKQTPCALabelType(settings.value(group+"ticks/type", JKQTPCALabelType2String(tickLabelType)).toString());
labelColor=jkqtp_String2QColor(settings.value(group+"axis_label/color", jkqtp_QColor2String(labelColor)).toString());
axisColor=jkqtp_String2QColor(settings.value(group+"color", jkqtp_QColor2String(axisColor)).toString());
tickColor=jkqtp_String2QColor(settings.value(group+"ticks/color", jkqtp_QColor2String(tickColor)).toString());
minorTickColor=jkqtp_String2QColor(settings.value(group+"minor_tick/color", jkqtp_QColor2String(minorTickColor)).toString());
tickLabelColor=jkqtp_String2QColor(settings.value(group+"ticks/label_color", jkqtp_QColor2String(tickLabelColor)).toString());
minorTickLabelColor=jkqtp_String2QColor(settings.value(group+"minor_tick/label_color", jkqtp_QColor2String(minorTickLabelColor)).toString());
drawMode1=String2JKQTPCADrawMode(settings.value(group+"draw_mode1", JKQTPCADrawMode2String(drawMode1)).toString());
drawMode2=String2JKQTPCADrawMode(settings.value(group+"draw_mode2", JKQTPCADrawMode2String(drawMode2)).toString());
tickMode=String2JKQTPLabelTickMode(settings.value(group+"ticks/mode", JKQTPLabelTickMode2String(tickMode)).toString());
@ -120,28 +132,34 @@ void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &
settings.setValue(group+"draw_mode1", JKQTPCADrawMode2String(drawMode1));
settings.setValue(group+"draw_mode2", JKQTPCADrawMode2String(drawMode2));
settings.setValue(group+"line_width", lineWidth);
settings.setValue(group+"arrow_size_factor", arrowSizeFactor);
settings.setValue(group+"axis_lines_offset", axisLineOffset);
settings.setValue(group+"min_ticks", minTicks);
settings.setValue(group+"axis_label/distance", labelDistance);
settings.setValue(group+"axis_label/font_size", labelFontSize);
settings.setValue(group+"axis_label/color", jkqtp_QColor2String(labelColor));
settings.setValue(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition));
settings.setValue(group+"axis_label/type", JKQTPCALabelType2String(labelType));
settings.setValue(group+"minor_tick/labels_enabled", minorTickLabelsEnabled);
settings.setValue(group+"minor_tick/inside_length", minorTickInsideLength);
settings.setValue(group+"minor_tick/label_font_size", minorTickLabelFontSize);
settings.setValue(group+"minor_tick/label_full_number", minorTickLabelFullNumber);
settings.setValue(group+"minor_tick/label_color", jkqtp_QColor2String(minorTickLabelColor));
settings.setValue(group+"minor_tick/outside_length", minorTickOutsideLength);
settings.setValue(group+"minor_tick/width", minorTickWidth);
settings.setValue(group+"minor_tick/count", minorTicks);
settings.setValue(group+"minor_tick/color", jkqtp_QColor2String(minorTickColor));
settings.setValue(group+"ticks/type", JKQTPCALabelType2String(tickLabelType));
settings.setValue(group+"ticks/date_format", tickDateFormat);
settings.setValue(group+"ticks/datetime_format", tickDateTimeFormat);
settings.setValue(group+"ticks/inside_length", tickInsideLength);
settings.setValue(group+"ticks/label_distance", tickLabelDistance);
settings.setValue(group+"ticks/label_font_size", tickLabelFontSize);
settings.setValue(group+"ticks/label_color", jkqtp_QColor2String(tickLabelColor));
settings.setValue(group+"ticks/mode", JKQTPLabelTickMode2String(tickMode));
settings.setValue(group+"ticks/outside_length", tickOutsideLength);
settings.setValue(group+"ticks/time_format", tickTimeFormat);
settings.setValue(group+"ticks/width", tickWidth);
settings.setValue(group+"ticks/color", jkqtp_QColor2String(tickColor));
settings.setValue(group+"zero_line/enabled", showZeroAxis);
settings.setValue(group+"zero_line/line_width", lineWidthZeroAxis);
settings.setValue(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis));
@ -150,6 +168,45 @@ void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &
minorGridStyle.saveSettings(settings, group+"minor_grid/");
}
QPen JKQTPCoordinateAxisStyle::getZeroAxisPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter *parent) const
{
QPen pmain(colorZeroAxis);
pmain.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidthZeroAxis*parent->getLineWidthMultiplier())));
pmain.setStyle(styleZeroAxis);
pmain.setCapStyle(Qt::SquareCap);
return pmain;
}
QPen JKQTPCoordinateAxisStyle::getAxisPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter *parent) const {
QPen pmain(axisColor);
pmain.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
pmain.setStyle(Qt::SolidLine);
pmain.setCapStyle(Qt::SquareCap);
return pmain;
}
QPen JKQTPCoordinateAxisStyle::getTickPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const {
QPen ptick=getAxisPen(painter, parent);
ptick.setColor(tickColor);
ptick.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, tickWidth*parent->getLineWidthMultiplier())));
ptick.setCapStyle(Qt::FlatCap);
return ptick;
}
QPen JKQTPCoordinateAxisStyle::getMinorTickPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter *parent) const {
QPen pmtick=getTickPen(painter, parent);
pmtick.setColor(minorTickColor);
pmtick.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, minorTickWidth*parent->getLineWidthMultiplier())));
pmtick.setCapStyle(Qt::FlatCap);
return pmtick;
}
double JKQTPCoordinateAxisStyle::getArrowSize(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
{
const QPen paxis=getAxisPen(painter, parent);
return JKQTPLineDecoratorStyleCalcDecoratorSize(paxis.widthF(), arrowSizeFactor);
}
JKQTPColorbarCoordinateAxisStyle::JKQTPColorbarCoordinateAxisStyle():
JKQTPCoordinateAxisStyle()

View File

@ -107,7 +107,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle {
/** \brief if \c true, the plotter displays minor axis labels as number between 1 and 10 in some cases */
bool minorTickLabelsEnabled;
/** \brief indicates how to draw the labels */
JKQTPCALabelType labelType;
JKQTPCALabelType tickLabelType;
/** \brief mode of the major ticks */
JKQTPLabelTickMode tickMode;
@ -116,6 +116,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle {
JKQTPLabelPosition labelPosition;
/** \brief fontsize of the axis labels */
double labelFontSize;
/** \brief color of the axis label */
QColor labelColor;
/** \brief fontsize of the axis tick labels */
double tickLabelFontSize;
/** \brief fontsize of the minor axis tick labels */
@ -130,12 +132,22 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle {
JKQTPCADrawMode drawMode1;
/** \brief draw mode of the secondary (right/top) axis */
JKQTPCADrawMode drawMode2;
/** \brief color of minor ticks */
QColor minorTickColor;
/** \brief color of minor tick labels */
QColor minorTickLabelColor;
/** \brief line width of minor ticks in pt */
double minorTickWidth;
/** \brief color of axis ticks */
QColor tickColor;
/** \brief color of axis tick labels */
QColor tickLabelColor;
/** \brief line width of ticks in pt */
double tickWidth;
/** \brief line width of axis in pt */
double lineWidth;
/** \brief factor used to calculate the size of line arrows */
double arrowSizeFactor;
/** \brief line width of 0-line in pt */
double lineWidthZeroAxis;
@ -184,6 +196,18 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle {
Qt::PenStyle styleZeroAxis;
/** \brief if non-zero, the line of the coordinate axis is moved outside the plot by this amount [pt]. This does not apply to the zero-axis! */
double axisLineOffset;
/** \brief returns a QPen that can be used for drawing zero axis lines */
QPen getZeroAxisPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent) const;
/** \brief returns a QPen that can be used for drawing axis lines */
QPen getAxisPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
/** \brief returns a QPen that can be used for drawing axis tick lines */
QPen getTickPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent) const;
/** \brief returns a QPen that can be used for drawing minor axis tick lines */
QPen getMinorTickPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
/** \brief calculates the size of an arrow in pixels */
double getArrowSize(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
};

View File

@ -146,7 +146,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
colorBarRightAxis->setOtherAxisWidth(cb.width());
colorBarRightAxis->drawAxes(painter);
if ( JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode2())) {
if ( colorBarRightAxis->getDrawMode1().testFlag(JKQTPCADMLine) && colorBarRightAxis->getDrawMode2().testFlag(JKQTPCADMLine)) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.topRight()));
painter.drawLine(QLineF(cb.bottomLeft(), cb.bottomRight()));
@ -205,7 +205,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
colorBarTopAxis->setOtherAxisWidth(cb.height());
colorBarTopAxis->drawAxes(painter);
if ( JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode2())) {
if ( colorBarTopAxis->getDrawMode1().testFlag(JKQTPCADMLine) && colorBarTopAxis->getDrawMode2().testFlag(JKQTPCADMLine)) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.bottomLeft()));
painter.drawLine(QLineF(cb.topRight(), cb.bottomRight()));
@ -654,7 +654,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
modifierColorBarRightAxis->setOtherAxisWidth(cb.height());
modifierColorBarRightAxis->drawAxes(painter);
} else {
if ( JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode2())) {
if ( colorBarRightAxis->getDrawMode1().testFlag(JKQTPCADMLine) && colorBarRightAxis->getDrawMode2().testFlag(JKQTPCADMLine)) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.topRight()));
painter.drawLine(QLineF(cb.bottomLeft(), cb.bottomRight()));
@ -707,7 +707,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
modifierColorBarTopAxis->setOtherAxisWidth(cb.width());
modifierColorBarTopAxis->drawAxes(painter);
} else {
if ( JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode2())) {
if ( colorBarTopAxis->getDrawMode1().testFlag(JKQTPCADMLine) && colorBarTopAxis->getDrawMode2().testFlag(JKQTPCADMLine)) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.bottomLeft()));
painter.drawLine(QLineF(cb.topRight(), cb.bottomRight()));

View File

@ -39,36 +39,42 @@
QString JKQTPCADrawMode2String(JKQTPCADrawMode pos) {
switch(pos) {
case JKQTPCADMcomplete: return "all";
case JKQTPCADMTicksTickLabelsAxisLabel: return "ticks+labels+axislabel";
case JKQTPCADMTicksTickLabels: return "ticks+labels";
case JKQTPCADMTicks: return "ticks";
case JKQTPCADMLineTicksTickLabels: return "line+ticks+labels";
case JKQTPCADMTickLabelsAxisLabel: return "labels+axislabel";
case JKQTPCADMTickLabels: return "labels";
case JKQTPCADMLineTicks: return "line+ticks";
case JKQTPCADMLine: return "line";
case JKQTPCADMnone: return "none";
}
return "";
if (pos==JKQTPCADMnone) return "none";
if (pos==JKQTPCADMcomplete) return "complete";
if (pos==JKQTPCADMcompleteMaxArrow) return "complete+max_filled_arrow";
if (pos==JKQTPCADMcompleteMinMaxArrow) return "complete+max_filled_arrow+min_filled_arrow";
QString s="";
if (pos.testFlag(JKQTPCADMLine)) JKQTPExtendString(s, "+", "line");
if (pos.testFlag(JKQTPCADMMaxArrow)) JKQTPExtendString(s, "+", "max_arrow");
if (pos.testFlag(JKQTPCADMMaxFilledArrow)) JKQTPExtendString(s, "+", "max_filled_arrow");
if (pos.testFlag(JKQTPCADMMinArrow)) JKQTPExtendString(s, "+", "min_arrow");
if (pos.testFlag(JKQTPCADMMinFilledArrow)) JKQTPExtendString(s, "+", "min_filled_arrow");
if (pos.testFlag(JKQTPCADMTicks)) JKQTPExtendString(s, "+", "ticks");
if (pos.testFlag(JKQTPCADMTickLabels)) JKQTPExtendString(s, "+", "labels");
if (pos.testFlag(JKQTPCADMAxisLabel)) JKQTPExtendString(s, "+", "axislabel");
return s;
}
JKQTPCADrawMode String2JKQTPCADrawMode(const QString& pos) {
QString s=pos.trimmed().toLower();
if (s=="all" || s=="complete" || s=="line+ticks+labels+axislabel") return JKQTPCADMcomplete;
if (s=="ticks+labels+axislabel") return JKQTPCADMTicksTickLabelsAxisLabel;
if (s=="labels+axislabel") return JKQTPCADMTickLabelsAxisLabel;
if (s=="ticks+labels") return JKQTPCADMTicksTickLabels;
if (s=="line+ticks+labels") return JKQTPCADMLineTicksTickLabels;
if (s=="labels") return JKQTPCADMTickLabels;
if (s=="line+ticks") return JKQTPCADMLineTicks;
if (s=="ticks") return JKQTPCADMTicks;
if (s=="line") return JKQTPCADMLine;
if (s=="none") return JKQTPCADMnone;
return JKQTPCADMnone;
QStringList slist=pos.trimmed().toLower().split('+');
JKQTPCADrawMode res=JKQTPCADMnone;
for (const QString& s: slist) {
if (s=="all" || s=="complete") res |= JKQTPCADMcomplete;
if (s=="labels" || s=="ticklabels") res |= JKQTPCADMTickLabels;
if (s=="axislabel") res |= JKQTPCADMAxisLabel;
if (s=="ticks") res |= JKQTPCADMTicks;
if (s=="line") res |= JKQTPCADMLine;
if (s=="max_arrow"||s=="maxarrow") res |= JKQTPCADMMaxArrow;
if (s=="max_filled_arrow"||s=="maxfilledarrow") res |= JKQTPCADMMaxFilledArrow;
if (s=="min_arrow"||s=="minarrow") res |= JKQTPCADMMinArrow;
if (s=="min_filled_arrow"||s=="minfilledarrow") res |= JKQTPCADMMinFilledArrow;
}
return res;
}
@ -108,6 +114,7 @@ QString JKQTPCALabelType2String(JKQTPCALabelType pos) {
case JKQTPCALTfrac: return "frac";
case JKQTPCALTsfrac: return "sfrac";
case JKQTPCALTslashfrac: return "slashfrac";
case JKQTPCALTcount: return "";
}
return "";
}
@ -391,26 +398,6 @@ QString JKQTPMouseDragActions2String(JKQTPMouseDragActions act)
}
bool JKQTPCADrawModeHasLine(JKQTPCADrawMode pos)
{
return (pos==JKQTPCADMcomplete) || (pos==JKQTPCADMLineTicksTickLabels) || (pos==JKQTPCADMLineTicks) || (pos==JKQTPCADMLine);
}
bool JKQTPCADrawModeHasTicks(JKQTPCADrawMode pos)
{
return (pos==JKQTPCADMcomplete) || (pos==JKQTPCADMTicksTickLabelsAxisLabel) || (pos==JKQTPCADMLineTicks) || (pos==JKQTPCADMLineTicksTickLabels) || (pos==JKQTPCADMTicksTickLabels)|| (pos==JKQTPCADMTicks);
}
bool JKQTPCADrawModeHasTickLabels(JKQTPCADrawMode pos)
{
return (pos==JKQTPCADMcomplete) || (pos==JKQTPCADMTicksTickLabelsAxisLabel) || (pos==JKQTPCADMLineTicksTickLabels) || (pos==JKQTPCADMTicksTickLabels) || (pos==JKQTPCADMTickLabels) || (pos==JKQTPCADMTickLabelsAxisLabel);
}
bool JKQTPCADrawModeHasAxisLabel(JKQTPCADrawMode pos)
{
return (pos==JKQTPCADMcomplete) || (pos==JKQTPCADMTicksTickLabelsAxisLabel) || (pos==JKQTPCADMTickLabelsAxisLabel);
}
JKQTPColorDerivationMode::JKQTPColorDerivationMode(PredefinedModes mode):
colorModification(ColorChangeMode::SameColor),

View File

@ -385,42 +385,45 @@ JKQTPLOTTER_LIB_EXPORT QString JKQTPColorDerivationMode2String(JKQTPColorDerivat
JKQTPLOTTER_LIB_EXPORT JKQTPColorDerivationMode String2JKQTPColorDerivationMode(const QString &mode);
/** \brief display mode for an axis
* \ingroup jkqtpplottersupprt */
enum JKQTPCADrawMode {
JKQTPCADMcomplete=0, /*!< \brief draw axis with ticks, ticklabels and axis label */
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 */
JKQTPCADMnone, /*!< \brief draw no axis */
/** \brief drawing flags for a coordinate axis
* \ingroup jkqtpplottersupprt
*
* \note This enum provides the elements for \ref JKQTPCADrawMode, which is actually used
* throughout the code.
*
* \see JKQTPCADrawMode, JKQTPCoordinateAxisStyle
*/
enum JKQTPCADrawModeElements {
JKQTPCADMLine=0x01, /*!< \brief draw axis as thick line \image html axisstyle/JKQTPCADMLine.png */
JKQTPCADMTicks=0x02, /*!< \brief draw axis ticks \image html axisstyle/JKQTPCADMTicks.png */
JKQTPCADMTickLabels=0x04, /*!< \brief draw axis tick labels \image html axisstyle/JKQTPCADMTickLabels.png */
JKQTPCADMAxisLabel=0x08, /*!< \brief draw axis axis Label \image html axisstyle/JKQTPCADMAxisLabel.png */
JKQTPCADMmax=JKQTPCADMnone
JKQTPCADMMaxArrow=0x0100, /*!< \brief an open arrow at the max-end of the axis \image html axisstyle/JKQTPCADMMaxArrow.png */
JKQTPCADMMaxFilledArrow=0x0200, /*!< \brief draw a filled arrow at the max-end of the axis \image html axisstyle/JKQTPCADMMaxFilledArrow.png */
JKQTPCADMMinArrow=0x1000, /*!< \brief an open arrow at the end of the axis at the min-end of the axis \image html axisstyle/JKQTPCADMMinArrow.png */
JKQTPCADMMinFilledArrow=0x2000, /*!< \brief draw a filled arrow at the min-end of the axis \image html axisstyle/JKQTPCADMMinFilledArrow.png */
JKQTPCADMLineTicksTickLabels=JKQTPCADMLine|JKQTPCADMTicks|JKQTPCADMTickLabels, /*!< \brief draw axis with ticks, line and tick labels \image html axisstyle/JKQTPCADMLineTicksTickLabels.png */
JKQTPCADMLineTicks=JKQTPCADMLine|JKQTPCADMTicks, /*!< \brief draw axis with ticks and line \image html axisstyle/JKQTPCADMLineTicks.png */
JKQTPCADMTicksTickLabelsAxisLabel=JKQTPCADMTicks|JKQTPCADMTickLabels|JKQTPCADMAxisLabel, /*!< \brief draw axis with ticks, tick labels and axisLabel \image html axisstyle/JKQTPCADMTicksTickLabelsAxisLabel.png */
JKQTPCADMTicksTickLabels=JKQTPCADMTicks|JKQTPCADMTickLabels, /*!< \brief draw axis with ticks and tick labels \image html axisstyle/JKQTPCADMTicksTickLabels.png */
JKQTPCADMTickLabelsAxisLabel=JKQTPCADMTickLabels|JKQTPCADMAxisLabel, /*!< \brief draw axis tick labels and axisLabel \image html axisstyle/JKQTPCADMTickLabelsAxisLabel.png */
JKQTPCADMnone=0x0000, /*!< \brief draw no axis \image html axisstyle/JKQTPCADMnone.png */
JKQTPCADMcomplete=JKQTPCADMLine|JKQTPCADMTicks|JKQTPCADMTickLabels|JKQTPCADMAxisLabel, /*!< \brief draw axis withline, ticks, ticklabels and axis label \image html axisstyle/JKQTPCADMcomplete.png */
JKQTPCADMcompleteMaxArrow=JKQTPCADMcomplete|JKQTPCADMMaxFilledArrow, /*!< \brief draw axis withline, ticks, ticklabels and axis label and an arrow pointing to the max-side of the axis \image html axisstyle/JKQTPCADMcompleteMaxArrow.png */
JKQTPCADMcompleteMinMaxArrow=JKQTPCADMcomplete|JKQTPCADMMaxFilledArrow|JKQTPCADMMinFilledArrow, /*!< \brief draw axis withline, ticks, ticklabels and axis label and arrows pointing to the min and max side of the axis \image html axisstyle/JKQTPCADMcompleteMinMaxArrow.png */
};
/** \brief determines whether JKQTPCADrawMode has the line
* \ingroup jkqtpplottersupprt
/** \brief drawing mode for a coordinate axis
* \ingroup jkqtplotter_basegraphserrors
*
* \qFlagsNote{JKQTPCADrawMode,JKQTPCADrawModeElements}
*
* \see JKQTPCADrawModeElements, JKQTPCoordinateAxisStyle
*/
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasLine(JKQTPCADrawMode pos);
Q_DECLARE_FLAGS(JKQTPCADrawMode, JKQTPCADrawModeElements)
Q_DECLARE_OPERATORS_FOR_FLAGS(JKQTPCADrawMode)
/** \brief determines whether JKQTPCADrawMode has ticks
* \ingroup jkqtpplottersupprt
*/
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasTicks(JKQTPCADrawMode pos);
/** \brief determines whether JKQTPCADrawMode has tick labels
* \ingroup jkqtpplottersupprt
*/
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasTickLabels(JKQTPCADrawMode pos);
/** \brief determines whether JKQTPCADrawMode has the axis label
* \ingroup jkqtpplottersupprt
*/
JKQTPLOTTER_LIB_EXPORT bool JKQTPCADrawModeHasAxisLabel(JKQTPCADrawMode pos);
@ -438,19 +441,19 @@ JKQTPLOTTER_LIB_EXPORT JKQTPCADrawMode String2JKQTPCADrawMode(const QString& pos
/** \brief display mode for the axis labels
* \ingroup jkqtpplottersupprt */
enum JKQTPCALabelType {
JKQTPCALTdefault, /*!< \brief simply print the numbers \image html JKQTPCALTdefault.png */
JKQTPCALTscientific, /*!< \brief print the numbers in scientific notation, e.g. \c "1.23e-4" \image html JKQTPCALTscientific.png */
JKQTPCALTexponentCharacter, /*!< \brief print the numbers and show a unit character, i.e. 5&mu; for \f$ 5\cdot 10^{-6} \f$ , \c 3k for \f$ 3\cdot 10^3 \f$ ... \image html JKQTPCALTexponentCharacter.png */
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*/
JKQTPCALTdatetime, /*!< \brief show numbers as times \image html JKQTPCALTdatetime.png */
JKQTPCALTfrac, /*!< \brief show numbers as fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \f$ \frac{1}{2} \f$ \image html JKQTPCALTfrac.png */
JKQTPCALTslashfrac, /*!< \brief show numbers as fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \c 1/2 \image html JKQTPCALTslashfrac.png */
JKQTPCALTsfrac, /*!< \brief show numbers as fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed using \c \\sfrac{1}{2} \image html JKQTPCALTsfrac.png */
JKQTPCALTintfrac, /*!< \brief show numbers as integral+fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \$ -3\frac{1}{2} \f$ \image html JKQTPCALTintfrac.png */
JKQTPCALTintslashfrac, /*!< \brief show numbers as integral+fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \c 1/2 \image html JKQTPCALTintslashfrac.png */
JKQTPCALTintsfrac, /*!< \brief show numbers as integral+fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed using \c \\sfrac{1}{2} \image html JKQTPCALTintsfrac.png */
JKQTPCALTdefault=0, /*!< \brief simply print the numbers \image html axisstyle/JKQTPCALTdefault.png */
JKQTPCALTscientific, /*!< \brief print the numbers in scientific notation, e.g. \c "1.23e-4" \image html axisstyle/JKQTPCALTscientific.png */
JKQTPCALTexponentCharacter, /*!< \brief print the numbers and show a unit character, i.e. 5&mu; for \f$ 5\cdot 10^{-6} \f$ , \c 3k for \f$ 3\cdot 10^3 \f$ ... \image html axisstyle/JKQTPCALTexponentCharacter.png */
JKQTPCALTexponent, /*!< \brief show numbers in exponential for, e.g. \f$ 3\cdot 10^5 \f$ ... \image html axisstyle/JKQTPCALTexponent.png */
JKQTPCALTdate, /*!< \brief show numbers as dates \image html axisstyle/JKQTPCALTdate.png */
JKQTPCALTtime, /*!< \brief show numbers as times \image html axisstyle/JKQTPCALTtime.png*/
JKQTPCALTdatetime, /*!< \brief show numbers as times \image html axisstyle/JKQTPCALTdatetime.png */
JKQTPCALTfrac, /*!< \brief show numbers as fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \f$ \frac{1}{2} \f$ \image html axisstyle/JKQTPCALTfrac.png */
JKQTPCALTslashfrac, /*!< \brief show numbers as fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \c 1/2 \image html axisstyle/JKQTPCALTslashfrac.png */
JKQTPCALTsfrac, /*!< \brief show numbers as fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed using \c \\sfrac{1}{2} \image html axisstyle/JKQTPCALTsfrac.png */
JKQTPCALTintfrac, /*!< \brief show numbers as integral+fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \$ -3\frac{1}{2} \f$ \image html axisstyle/JKQTPCALTintfrac.png */
JKQTPCALTintslashfrac, /*!< \brief show numbers as integral+fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed like \c 1/2 \image html axisstyle/JKQTPCALTintslashfrac.png */
JKQTPCALTintsfrac, /*!< \brief show numbers as integral+fraction, the number is first rounded to the given precision and then a fraction is calculated and displayed using \c \\sfrac{1}{2} \image html axisstyle/JKQTPCALTintsfrac.png */
JKQTPCALTcount,
JKQTPCALTmax=JKQTPCALTcount-1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Some files were not shown because too many files have changed in this diff Show More