diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index feb38eb18d..e38a9c1ce0 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -131,6 +131,14 @@ if(JKQtPlotter_BUILD_TOOLS) ) add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listaxisstyleprops) + add_custom_target(JKQTPlotter_GenerateDocImages_listaxisticklabelangles + COMMENT "Building JKQTPlotter Documentation Images: listaxisticklabelangles" + COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --listaxisticklabelangles --background=lightgrey --iconsize=50 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/axisstyle/" + WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR} + DEPENDS jkqtplotter_doc_imagegenerator + ) + add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listaxisticklabelangles) + add_custom_target(JKQTPlotter_GenerateDocImages_liststyles COMMENT "Building JKQTPlotter Documentation Images: liststyles" COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --liststyles --iconsize=1200 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/styles/" --doctomodify="${JKQTPlotter_GenerateDocImages_dox}/jkqtplotter_styling.dox" diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-15Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-15Degree.png new file mode 100644 index 0000000000..c15d96388f Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-15Degree.png differ diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-45Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-45Degree.png new file mode 100644 index 0000000000..ccae3a7b76 Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-45Degree.png differ diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-75Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-75Degree.png new file mode 100644 index 0000000000..34baeff818 Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle-75Degree.png differ diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle0Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle0Degree.png new file mode 100644 index 0000000000..ae9909010b Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle0Degree.png differ diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle15Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle15Degree.png new file mode 100644 index 0000000000..47e5053a1a Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle15Degree.png differ diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle45Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle45Degree.png new file mode 100644 index 0000000000..aa622bfae7 Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle45Degree.png differ diff --git a/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle75Degree.png b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle75Degree.png new file mode 100644 index 0000000000..7f742d1900 Binary files /dev/null and b/doc/images/axisstyle/JKQTPCoordinateAxisTickLabelAngle75Degree.png differ diff --git a/lib/jkqtplotter/jkqtpcoordinateaxesstyle.h b/lib/jkqtplotter/jkqtpcoordinateaxesstyle.h index ef8f10f73e..ccef1a4f2a 100644 --- a/lib/jkqtplotter/jkqtpcoordinateaxesstyle.h +++ b/lib/jkqtplotter/jkqtpcoordinateaxesstyle.h @@ -206,7 +206,19 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle { double tickLabelDistance; /** \brief distance between tick label and axis label in pt */ double labelDistance; - /** \brief rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal) */ + /** \brief rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal) + * + * These images show some example rotations: + * + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle-75Degree.png + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle-45Degree.png + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle-15Degree.png + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle0Degree.png + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle15Degree.png + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle45Degree.png + * \image html axisstyle/JKQTPCoordinateAxisTickLabelAngle75Degree.png + * + */ double tickLabelAngle; /** \brief styling of the major/primary grid */ diff --git a/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp b/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp index a86150f907..fe80f87cae 100644 --- a/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp +++ b/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp @@ -409,6 +409,36 @@ void doListAxisStyling(const QDir& outputDir, int iconsize, QColor backgroundCol plot.grabPixelImage(QSize(plot.getWidth(),plot.getHeight()), false).copy(0,0,plot.getWidth(),plot.getHeight()).save(outputDir.absoluteFilePath("axis_unit_scaling_pi.png"), "png"); } +void doListAxisTickLabelAngles(const QDir& outputDir, int iconsize, QColor backgroundColor) { + JKQTBasePlotter plot(true); + + plot.setXY(0,1000,0,1000); + plot.setWidgetSize(iconsize*5,5*iconsize); + plot.setShowKey(false); + plot.setGrid(true); + plot.setExportBackgroundColor(QColor("lightgrey")); + plot.getXAxis()->setShowZeroAxis(false); + plot.getYAxis()->setShowZeroAxis(false); + plot.getXAxis()->setDrawMode1(JKQTPCADMLineTicksTickLabels); + plot.getXAxis()->setDrawMode2(JKQTPCADMLineTicksTickLabels); + plot.getXAxis()->setDrawGrid(false); + plot.getYAxis()->setDrawMode1(JKQTPCADMLineTicksTickLabels); + plot.getYAxis()->setDrawMode2(JKQTPCADMLineTicksTickLabels); + plot.getYAxis()->setAxisLabel(""); + + + plot.getXAxis()->setTickLabelType(JKQTPCALTdefault); + plot.getYAxis()->setTickLabelType(JKQTPCALTdefault); + + + for (int angle: std::vector{-75,-45,-15,0,15,45,75}) { + plot.getXAxis()->setTickLabelAngle(angle); + plot.getYAxis()->setTickLabelAngle(angle); + plot.setPlotLabel("\\alpha="+QString::number(angle)+"^\\circ"); + plot.grabPixelImage(QSize(plot.getWidth(),plot.getHeight()), false).copy(0,0,plot.getWidth(),plot.getHeight()).save(outputDir.absoluteFilePath("JKQTPCoordinateAxisTickLabelAngle"+QString::number(angle)+"Degree.png"), "png"); + } +} + void plotStyle(const QSettings& style, QSize examplePlotSize, const QString& examplePlotFilename, QSize samplePlotSize, const QString& samplePlotFilename ) { JKQTBasePlotter plotExtra(true); @@ -513,6 +543,8 @@ int main(int argc, char* argv[]) parser.addOption(listerrorindicatorsOption); QCommandLineOption listaxisstylepropsOption("listaxisstyleprops", "generate example images for JKQTPCALabelType and other coordinate axis properties."); parser.addOption(listaxisstylepropsOption); + QCommandLineOption doListAxisTickLabelAnglesOption("listaxisticklabelangles", "generate example images for coordinate axis tick labels at different angles."); + parser.addOption(doListAxisTickLabelAnglesOption); QCommandLineOption listpalettesOption("listpalettes", "generate example images for all predefined palettes."); parser.addOption(listpalettesOption); QCommandLineOption liststylesOption("liststyles", "generate example images for all predefined style INI files."); @@ -530,6 +562,7 @@ int main(int argc, char* argv[]) const bool listlinedecorators=parser.isSet(listlinedecoratorsOption); const bool listerrorindicators=parser.isSet(listerrorindicatorsOption); const bool listaxisstyleprops=parser.isSet(listaxisstylepropsOption); + const bool dolistaxisticklabelangles=parser.isSet(doListAxisTickLabelAnglesOption); const bool liststyles=parser.isSet(liststylesOption); const int iconsize=parser.value(iconsizeOption).toInt(); const QColor backgroundColor = jkqtp_String2QColor(parser.value(backgroundOption)); @@ -540,6 +573,7 @@ int main(int argc, char* argv[]) if (listlinedecorators) doListLineDecorators(outputDir, iconsize, backgroundColor); if (listerrorindicators) doListErrorIndicators(outputDir, iconsize, backgroundColor); if (listaxisstyleprops) doListAxisStyling(outputDir, iconsize, backgroundColor); + if (dolistaxisticklabelangles) doListAxisTickLabelAngles(outputDir, iconsize, backgroundColor); if (liststyles) doListStyles(outputDir, doctomodify, iconsize, backgroundColor); if (listpalettes) doListPalettes(outputDir, QSize(iconsize,qMax(5,iconsize/16)));