From f96e262371653a210fa69ced24f069fdf0b0b545 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sun, 16 Jun 2019 13:27:02 +0200 Subject: [PATCH] JKQTPlotter/JKQTBasePlotter: added functions to set properties of all grid lines (x+y axis) together --- lib/jkqtplotter/jkqtpbaseplotter.cpp | 35 +++++++++++++++++++++++++++ lib/jkqtplotter/jkqtpbaseplotter.h | 25 +++++++++++++++++++ lib/jkqtplotter/jkqtplotter.h | 36 ++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 8b7a6afce0..2270badd33 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -306,6 +306,41 @@ void JKQTBasePlotter::setGrid(bool val) { yAxis->setDrawGrid(val); } +void JKQTBasePlotter::setGridColor(QColor color) +{ + xAxis->setGridColor(color); + yAxis->setGridColor(color); +} + +void JKQTBasePlotter::setMinorGridColor(QColor color) +{ + xAxis->setMinorGridColor(color); + yAxis->setMinorGridColor(color); +} + +void JKQTBasePlotter::setGridWidth(double __value) +{ + xAxis->setGridWidth(__value); + yAxis->setGridWidth(__value); +} + +void JKQTBasePlotter::setMinorGridWidth(double __value) +{ + xAxis->setMinorGridWidth(__value); + yAxis->setMinorGridWidth(__value); +} +void JKQTBasePlotter::setGridStyle(Qt::PenStyle __value) +{ + xAxis->setGridStyle(__value); + yAxis->setGridStyle(__value); +} + +void JKQTBasePlotter::setMinorGridStyle(Qt::PenStyle __value) +{ + xAxis->setMinorGridStyle(__value); + yAxis->setMinorGridStyle(__value); +} + void JKQTBasePlotter::setShowZeroAxes(bool showX, bool showY) { getXAxis()->setShowZeroAxis(showX); getYAxis()->setShowZeroAxis(showY); diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h index 8d58cc642b..49b13d7fef 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.h +++ b/lib/jkqtplotter/jkqtpbaseplotter.h @@ -1434,6 +1434,31 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject { /** \brief sets whether to plot grid lines or not */ void setGrid(bool val); + /** \brief sets the color of all Major grid lines + * */ + void setGridColor(QColor color); + + /** \brief sets the color of all minor grid lines + * */ + void setMinorGridColor(QColor color); + + /** \brief sets the width of all Major grid lines + * */ + void setGridWidth(double __value); + + /** \brief sets the width of all minor grid lines + * */ + void setMinorGridWidth(double __value); + + /** \brief sets the style of all Major grid lines + * */ + void setGridStyle(Qt::PenStyle __value); + + /** \brief sets the style of all minor grid lines + * */ + void setMinorGridStyle(Qt::PenStyle __value); + + /** \brief switches the visibility of the zero-axes associated with the x- and y-axis * * \param showX indicates whether to show the zero-axis associated with the x-axis (i.e. x==0 or the vertical zero-axis) diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index 38a23fbb23..2f3f9086b6 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -926,6 +926,42 @@ class JKQTP_LIB_EXPORT JKQTPlotter: public QWidget { plotter->setGrid(val); } + /** \brief sets the color of all Major grid lines + * */ + inline void setGridColor(QColor color) { + plotter->setGridColor(color); + } + + /** \brief sets the color of all minor grid lines + * */ + inline void setMinorGridColor(QColor color) { + plotter->setMinorGridColor(color); + } + + /** \brief sets the width of all Major grid lines + * */ + inline void setGridWidth(double __value) { + plotter->setGridWidth(__value); + } + + /** \brief sets the width of all minor grid lines + * */ + inline void setMinorGridWidth(double __value) { + plotter->setMinorGridWidth(__value); + } + + /** \brief sets the style of all Major grid lines + * */ + inline void setGridStyle(Qt::PenStyle __value) { + plotter->setGridStyle(__value); + } + + /** \brief sets the style of all minor grid lines + * */ + inline void setMinorGridStyle(Qt::PenStyle __value) { + plotter->setMinorGridStyle(__value); + } + /** \brief switches the visibility of the zero-axes associated with the x- and y-axis * * \param showX indicates whether to show the zero-axis associated with the x-axis (i.e. x==0 or the vertical zero-axis)