reworked grid-style representation

This commit is contained in:
jkriege2 2020-09-29 13:19:04 +02:00
parent 58403f8905
commit 75c7e3421b
4 changed files with 113 additions and 73 deletions

View File

@ -841,37 +841,37 @@ void JKQTPCoordinateAxis::setInverted(bool __value) {
} }
void JKQTPCoordinateAxis::setGridColor(const QColor& __value) { void JKQTPCoordinateAxis::setGridColor(const QColor& __value) {
this->axisStyle.gridColor = __value; this->axisStyle.majorGridStyle.lineColor = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
void JKQTPCoordinateAxis::setMinorGridColor(const QColor& __value) { void JKQTPCoordinateAxis::setMinorGridColor(const QColor& __value) {
this->axisStyle.minorGridColor = __value; this->axisStyle.minorGridStyle.lineColor = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
void JKQTPCoordinateAxis::setGridWidth(double __value) { void JKQTPCoordinateAxis::setGridWidth(double __value) {
this->axisStyle.gridWidth = __value; this->axisStyle.majorGridStyle.lineWidth = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
void JKQTPCoordinateAxis::setGridStyle(Qt::PenStyle __value) { void JKQTPCoordinateAxis::setGridStyle(Qt::PenStyle __value) {
this->axisStyle.gridStyle = __value; this->axisStyle.majorGridStyle.lineStyle = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
void JKQTPCoordinateAxis::setMinorGridWidth(double __value) { void JKQTPCoordinateAxis::setMinorGridWidth(double __value) {
this->axisStyle.minorGridWidth = __value; this->axisStyle.minorGridStyle.lineWidth = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
void JKQTPCoordinateAxis::setMinorGridStyle(Qt::PenStyle __value) { void JKQTPCoordinateAxis::setMinorGridStyle(Qt::PenStyle __value) {
this->axisStyle.minorGridStyle = __value; this->axisStyle.minorGridStyle.lineStyle = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
@ -932,13 +932,13 @@ void JKQTPCoordinateAxis::setLabelDigits(int __value) {
} }
void JKQTPCoordinateAxis::setDrawGrid(bool __value) { void JKQTPCoordinateAxis::setDrawGrid(bool __value) {
this->axisStyle.drawGrid = __value; this->axisStyle.majorGridStyle.enabled = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
void JKQTPCoordinateAxis::setDrawMinorGrid(bool __value) { void JKQTPCoordinateAxis::setDrawMinorGrid(bool __value) {
this->axisStyle.drawMinorGrid = __value; this->axisStyle.minorGridStyle.enabled = __value;
this->paramsChanged=true; this->paramsChanged=true;
redrawPlot(); redrawPlot();
} }
@ -1144,13 +1144,13 @@ void JKQTPVerticalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
//qDebug()<<" start JKQTPVerticalAxis::drawGrids("; //qDebug()<<" start JKQTPVerticalAxis::drawGrids(";
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pg=painter.pen(); QPen pg=painter.pen();
pg.setColor(axisStyle.gridColor); pg.setColor(axisStyle.majorGridStyle.lineColor);
pg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.gridWidth*parent->getLineWidthMultiplier()))); pg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.majorGridStyle.lineWidth*parent->getLineWidthMultiplier())));
pg.setStyle(axisStyle.gridStyle); pg.setStyle(axisStyle.majorGridStyle.lineStyle);
QPen pmg=painter.pen(); QPen pmg=painter.pen();
pmg.setColor(axisStyle.minorGridColor); pmg.setColor(axisStyle.minorGridStyle.lineColor);
pmg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, axisStyle.minorGridWidth*parent->getLineWidthMultiplier()))); pmg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, axisStyle.minorGridStyle.lineWidth*parent->getLineWidthMultiplier())));
pmg.setStyle(axisStyle.minorGridStyle); pmg.setStyle(axisStyle.minorGridStyle.lineStyle);
//double top=x2p(axismax); //double top=x2p(axismax);
//double bottom=x2p(axismin); //double bottom=x2p(axismin);
double left=0; double left=0;
@ -1179,14 +1179,14 @@ void JKQTPVerticalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
//painter.setPen(pg); //painter.setPen(pg);
//qDebug()<<" 1"; //qDebug()<<" 1";
if (axisStyle.drawGrid && (x<axismax) && (x>axismin) && (fabs(left-right)>0)) { if (axisStyle.majorGridStyle.enabled && (x<axismax) && (x>axismin) && (fabs(left-right)>0)) {
QLineF l(left, xx, right, xx); QLineF l(left, xx, right, xx);
if (l.length()>0) lines_pg.append(l);//painter.drawLine(l); if (l.length()>0) lines_pg.append(l);//painter.drawLine(l);
} }
//qDebug()<<" 2"; //qDebug()<<" 2";
//painter.setPen(pmg); //painter.setPen(pmg);
//qDebug()<<" 3"; //qDebug()<<" 3";
if ((tickLabels.size()<=0) && axisStyle.drawMinorGrid && (axisStyle.minorTicks>0) && (fabs(right-left)>0)) { if ((tickLabels.size()<=0) && axisStyle.minorGridStyle.enabled && (axisStyle.minorTicks>0) && (fabs(right-left)>0)) {
//qDebug()<<" 3.1"; //qDebug()<<" 3.1";
double mx=x+mtdist; double mx=x+mtdist;
//qDebug()<<" 3.2"; //qDebug()<<" 3.2";
@ -1777,13 +1777,13 @@ void JKQTPHorizontalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
bottom=getParentOtheraxisOffset()+getParentOtheraxisWidth();//; bottom=getParentOtheraxisOffset()+getParentOtheraxisWidth();//;
} }
QPen pg=painter.pen(); QPen pg=painter.pen();
pg.setColor(axisStyle.gridColor); pg.setColor(axisStyle.majorGridStyle.lineColor);
pg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.gridWidth*parent->getFontSizeMultiplier()))); pg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.majorGridStyle.lineWidth*parent->getFontSizeMultiplier())));
pg.setStyle(axisStyle.gridStyle); pg.setStyle(axisStyle.majorGridStyle.lineStyle);
QPen pmg=painter.pen(); QPen pmg=painter.pen();
pmg.setColor(axisStyle.minorGridColor); pmg.setColor(axisStyle.minorGridStyle.lineColor);
pmg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.minorGridWidth*parent->getLineWidthMultiplier()))); pmg.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.minorGridStyle.lineWidth*parent->getLineWidthMultiplier())));
pmg.setStyle(axisStyle.minorGridStyle); pmg.setStyle(axisStyle.minorGridStyle.lineStyle);
double x=tickStart; double x=tickStart;
QString label=""; QString label="";
@ -1800,12 +1800,12 @@ void JKQTPHorizontalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
//qDebug()<<" tick @ x="<<x<<" label="<<label<<" mtdist="<<mtdist<<" axisStyle.minorTicks="<<minorTicks; //qDebug()<<" tick @ x="<<x<<" label="<<label<<" mtdist="<<mtdist<<" axisStyle.minorTicks="<<minorTicks;
//painter.setPen(pg); //painter.setPen(pg);
if (axisStyle.drawGrid && (x<axismax) && (x>axismin)) { if (axisStyle.majorGridStyle.enabled && (x<axismax) && (x>axismin)) {
QLineF l(xx, bottom, xx, top); QLineF l(xx, bottom, xx, top);
if (l.length()>0) lines_pg.append(l);//painter.drawLine(l); if (l.length()>0) lines_pg.append(l);//painter.drawLine(l);
} }
//painter.setPen(pmg); //painter.setPen(pmg);
if ((tickLabels.size()<=0) && axisStyle.drawMinorGrid && (axisStyle.minorTicks>0)) { if ((tickLabels.size()<=0) && axisStyle.minorGridStyle.enabled && (axisStyle.minorTicks>0)) {
double mx=x+mtdist; double mx=x+mtdist;
for (int i=0; i<static_cast<int>(axisStyle.minorTicks); i++) { for (int i=0; i<static_cast<int>(axisStyle.minorTicks); i++) {
double mxx=x2p(mx); double mxx=x2p(mx);

View File

@ -278,17 +278,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
/** \copydoc JKQTPCoordinateAxisStyle::showZeroAxis */ /** \copydoc JKQTPCoordinateAxisStyle::showZeroAxis */
inline bool getShowZeroAxis() const { return this->axisStyle.showZeroAxis; } inline bool getShowZeroAxis() const { return this->axisStyle.showZeroAxis; }
/** \copydoc JKQTPCoordinateAxisStyle::gridColor */ /** \copydoc JKQTPCoordinateAxisStyle::gridColor */
inline QColor getGridColor() const { return this->axisStyle.gridColor; } inline QColor getGridColor() const { return this->axisStyle.majorGridStyle.lineColor; }
/** \copydoc JKQTPCoordinateAxisStyle::minorGridColor */ /** \copydoc JKQTPCoordinateAxisStyle::minorGridColor */
inline QColor getMinorGridColor() const { return this->axisStyle.minorGridColor; } inline QColor getMinorGridColor() const { return this->axisStyle.minorGridStyle.lineColor; }
/** \copydoc JKQTPCoordinateAxisStyle::gridWidth */ /** \copydoc JKQTPCoordinateAxisStyle::gridWidth */
inline double getGridWidth() const { return this->axisStyle.gridWidth; } inline double getGridWidth() const { return this->axisStyle.majorGridStyle.lineWidth; }
/** \copydoc JKQTPCoordinateAxisStyle::gridStyle */ /** \copydoc JKQTPCoordinateAxisStyle::gridStyle */
inline Qt::PenStyle getGridStyle() const { return this->axisStyle.gridStyle; } inline Qt::PenStyle getGridStyle() const { return this->axisStyle.majorGridStyle.lineStyle; }
/** \copydoc JKQTPCoordinateAxisStyle::minorGridWidth */ /** \copydoc JKQTPCoordinateAxisStyle::minorGridWidth */
inline double getMinorGridWidth() const { return this->axisStyle.minorGridWidth; } inline double getMinorGridWidth() const { return this->axisStyle.minorGridStyle.lineWidth; }
/** \copydoc JKQTPCoordinateAxisStyle::minorGridStyle */ /** \copydoc JKQTPCoordinateAxisStyle::minorGridStyle */
inline Qt::PenStyle getMinorGridStyle() const { return this->axisStyle.minorGridStyle; } inline Qt::PenStyle getMinorGridStyle() const { return this->axisStyle.minorGridStyle.lineStyle; }
/** \copydoc JKQTPCoordinateAxisStyle::tickTimeFormat */ /** \copydoc JKQTPCoordinateAxisStyle::tickTimeFormat */
inline QString getTickTimeFormat() const { return this->axisStyle.tickTimeFormat; } inline QString getTickTimeFormat() const { return this->axisStyle.tickTimeFormat; }
/** \copydoc JKQTPCoordinateAxisStyle::tickDateFormat */ /** \copydoc JKQTPCoordinateAxisStyle::tickDateFormat */
@ -315,9 +315,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
/** \copydoc JKQTPCoordinateAxisStyle::labelDistance */ /** \copydoc JKQTPCoordinateAxisStyle::labelDistance */
inline double getLabelDistance() const { return this->axisStyle.labelDistance; } inline double getLabelDistance() const { return this->axisStyle.labelDistance; }
/** \copydoc JKQTPCoordinateAxisStyle::drawGrid */ /** \copydoc JKQTPCoordinateAxisStyle::drawGrid */
inline bool getDrawGrid() const { return this->axisStyle.drawGrid; } inline bool getDrawGrid() const { return this->axisStyle.majorGridStyle.enabled; }
/** \copydoc JKQTPCoordinateAxisStyle::drawMinorGrid */ /** \copydoc JKQTPCoordinateAxisStyle::drawMinorGrid */
inline bool getDrawMinorGrid() const { return this->axisStyle.drawMinorGrid; } inline bool getDrawMinorGrid() const { return this->axisStyle.minorGridStyle.enabled; }
/** \copydoc JKQTPCoordinateAxisStyle::autoLabelDigits */ /** \copydoc JKQTPCoordinateAxisStyle::autoLabelDigits */
inline void setAutoLabelDigits(bool __value) inline void setAutoLabelDigits(bool __value)
{ {

View File

@ -2,6 +2,33 @@
#include "jkqtpbaseplotterstyle.h" #include "jkqtpbaseplotterstyle.h"
#include <QApplication> #include <QApplication>
JKQTPGridStyle::JKQTPGridStyle(bool isMajor):
enabled(isMajor),
lineColor(QColor("gray")),
lineWidth(isMajor?0.75:0.5),
lineStyle(isMajor?Qt::DashLine:Qt::DotLine)
{
}
void JKQTPGridStyle::loadSettings(const QSettings &settings, const QString &group, const JKQTPGridStyle &defaultStyle)
{
lineWidth = settings.value(group+"width", defaultStyle.lineWidth).toDouble();
enabled = settings.value(group+"enabled", defaultStyle.enabled).toBool();
lineColor=jkqtp_String2QColor(settings.value(group+"color", jkqtp_QColor2String(lineColor)).toString());
lineStyle=jkqtp_String2QPenStyle(settings.value(group+"style", jkqtp_QPenStyle2String(lineStyle)).toString());
}
void JKQTPGridStyle::saveSettings(QSettings &settings, const QString &group) const
{
settings.setValue(group+"enabled", enabled);
settings.setValue(group+"color", jkqtp_QColor2String(lineColor));
settings.setValue(group+"width", lineWidth);
settings.setValue(group+"style", jkqtp_QPenStyle2String(lineStyle));
}
JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle(): JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle():
labelDigits(3), labelDigits(3),
autoLabelDigits(true), autoLabelDigits(true),
@ -33,14 +60,8 @@ JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle():
tickLabelDistance(3), tickLabelDistance(3),
labelDistance(5), labelDistance(5),
tickLabelAngle(0), tickLabelAngle(0),
drawGrid(true), majorGridStyle(true),
gridColor(QColor("gray")), minorGridStyle(false),
gridWidth(0.75),
gridStyle(Qt::DashLine),
drawMinorGrid(false),
minorGridColor(QColor("gray")),
minorGridWidth(0.5),
minorGridStyle(Qt::DotLine),
colorZeroAxis(QColor("black")), colorZeroAxis(QColor("black")),
styleZeroAxis(Qt::SolidLine), styleZeroAxis(Qt::SolidLine),
axisLineOffset(0) axisLineOffset(0)
@ -80,23 +101,17 @@ void JKQTPCoordinateAxisStyle::loadSettings(const QSettings &settings, const QSt
minorTickInsideLength = settings.value(group+"minor_tick/inside_length", defaultStyle.minorTickInsideLength).toDouble(); minorTickInsideLength = settings.value(group+"minor_tick/inside_length", defaultStyle.minorTickInsideLength).toDouble();
tickLabelDistance = settings.value(group+"ticks/label_distance", defaultStyle.tickLabelDistance).toDouble(); tickLabelDistance = settings.value(group+"ticks/label_distance", defaultStyle.tickLabelDistance).toDouble();
labelDistance = settings.value(group+"axis_label/distance", defaultStyle.labelDistance).toDouble(); labelDistance = settings.value(group+"axis_label/distance", defaultStyle.labelDistance).toDouble();
gridWidth = settings.value(group+"grid/width", defaultStyle.gridWidth).toDouble();
minorGridWidth = settings.value(group+"minor_grid/width", defaultStyle.minorGridWidth).toDouble();
drawGrid = settings.value(group+"grid/enabled", defaultStyle.drawGrid).toBool();
drawMinorGrid = settings.value(group+"minor_grid/enabled", defaultStyle.drawMinorGrid).toBool();
labelPosition=String2JKQTPLabelPosition(settings.value(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition)).toString()); labelPosition=String2JKQTPLabelPosition(settings.value(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition)).toString());
labelType=String2JKQTPCALabelType(settings.value(group+"axis_label/type", JKQTPCALabelType2String(labelType)).toString()); labelType=String2JKQTPCALabelType(settings.value(group+"axis_label/type", JKQTPCALabelType2String(labelType)).toString());
axisColor=jkqtp_String2QColor(settings.value(group+"color", jkqtp_QColor2String(axisColor)).toString()); axisColor=jkqtp_String2QColor(settings.value(group+"color", jkqtp_QColor2String(axisColor)).toString());
gridColor=jkqtp_String2QColor(settings.value(group+"grid/color", jkqtp_QColor2String(gridColor)).toString());
minorGridColor=jkqtp_String2QColor(settings.value(group+"minor_grid/color", jkqtp_QColor2String(minorGridColor)).toString());
gridStyle=jkqtp_String2QPenStyle(settings.value(group+"grid/style", jkqtp_QPenStyle2String(gridStyle)).toString());
minorGridStyle=jkqtp_String2QPenStyle(settings.value(group+"minor_grid/style", jkqtp_QPenStyle2String(minorGridStyle)).toString());
drawMode1=String2JKQTPCADrawMode(settings.value(group+"draw_mode1", JKQTPCADrawMode2String(drawMode1)).toString()); drawMode1=String2JKQTPCADrawMode(settings.value(group+"draw_mode1", JKQTPCADrawMode2String(drawMode1)).toString());
drawMode2=String2JKQTPCADrawMode(settings.value(group+"draw_mode2", JKQTPCADrawMode2String(drawMode2)).toString()); drawMode2=String2JKQTPCADrawMode(settings.value(group+"draw_mode2", JKQTPCADrawMode2String(drawMode2)).toString());
tickMode=String2JKQTPLabelTickMode(settings.value(group+"ticks/mode", JKQTPLabelTickMode2String(tickMode)).toString()); tickMode=String2JKQTPLabelTickMode(settings.value(group+"ticks/mode", JKQTPLabelTickMode2String(tickMode)).toString());
colorZeroAxis=jkqtp_String2QColor(settings.value(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis)).toString()); colorZeroAxis=jkqtp_String2QColor(settings.value(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis)).toString());
styleZeroAxis=jkqtp_String2QPenStyle(settings.value(group+"zero_line/style", jkqtp_QPenStyle2String(styleZeroAxis)).toString()); styleZeroAxis=jkqtp_String2QPenStyle(settings.value(group+"zero_line/style", jkqtp_QPenStyle2String(styleZeroAxis)).toString());
axisLineOffset = settings.value(group+"axis_lines_offset", defaultStyle.axisLineOffset).toDouble(); axisLineOffset = settings.value(group+"axis_lines_offset", defaultStyle.axisLineOffset).toDouble();
majorGridStyle.loadSettings(settings, group+"grid/", defaultStyle.majorGridStyle);
minorGridStyle.loadSettings(settings, group+"minor_grid/", defaultStyle.minorGridStyle);
} }
void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &group) const void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &group) const
@ -107,18 +122,10 @@ void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &
settings.setValue(group+"line_width", lineWidth); settings.setValue(group+"line_width", lineWidth);
settings.setValue(group+"axis_lines_offset", axisLineOffset); settings.setValue(group+"axis_lines_offset", axisLineOffset);
settings.setValue(group+"min_ticks", minTicks); settings.setValue(group+"min_ticks", minTicks);
settings.setValue(group+"grid/enabled", drawGrid);
settings.setValue(group+"grid/color", jkqtp_QColor2String(gridColor));
settings.setValue(group+"grid/width", gridWidth);
settings.setValue(group+"grid/style", jkqtp_QPenStyle2String(gridStyle));
settings.setValue(group+"axis_label/distance", labelDistance); settings.setValue(group+"axis_label/distance", labelDistance);
settings.setValue(group+"axis_label/font_size", labelFontSize); settings.setValue(group+"axis_label/font_size", labelFontSize);
settings.setValue(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition)); settings.setValue(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition));
settings.setValue(group+"axis_label/type", JKQTPCALabelType2String(labelType)); settings.setValue(group+"axis_label/type", JKQTPCALabelType2String(labelType));
settings.setValue(group+"minor_grid/enabled", drawMinorGrid);
settings.setValue(group+"minor_grid/color", jkqtp_QColor2String(minorGridColor));
settings.setValue(group+"minor_grid/style", jkqtp_QPenStyle2String(minorGridStyle));
settings.setValue(group+"minor_grid/width", minorGridWidth);
settings.setValue(group+"minor_tick/labels_enabled", minorTickLabelsEnabled); settings.setValue(group+"minor_tick/labels_enabled", minorTickLabelsEnabled);
settings.setValue(group+"minor_tick/inside_length", minorTickInsideLength); settings.setValue(group+"minor_tick/inside_length", minorTickInsideLength);
settings.setValue(group+"minor_tick/label_font_size", minorTickLabelFontSize); settings.setValue(group+"minor_tick/label_font_size", minorTickLabelFontSize);
@ -139,4 +146,7 @@ void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &
settings.setValue(group+"zero_line/line_width", lineWidthZeroAxis); settings.setValue(group+"zero_line/line_width", lineWidthZeroAxis);
settings.setValue(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis)); settings.setValue(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis));
settings.setValue(group+"zero_line/style", jkqtp_QPenStyle2String(styleZeroAxis)); settings.setValue(group+"zero_line/style", jkqtp_QPenStyle2String(styleZeroAxis));
majorGridStyle.saveSettings(settings, group+"grid/");
minorGridStyle.saveSettings(settings, group+"minor_grid/");
} }

View File

@ -28,6 +28,47 @@
class JKQTBasePlotterStyle; // forward class JKQTBasePlotterStyle; // forward
/** \brief Support Class for JKQTPCoordinateAxis, and summarizes all properties that define the visual styling of a grid (minor or major), associated with a JKQTPCoordinateAxis
* \ingroup jkqtpplotter_styling
*
* \see JKQTPCoordinateAxis, \ref jkqtpplotter_styling
*
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPGridStyle {
Q_GADGET
public:
JKQTPGridStyle(bool isMajor=true);
/** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object
*
* \param settings QSettings-object to read from
* \param group Group in the QSettings-object to read from
* \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
* By default, this is a default-constructed object
*/
void loadSettings(const QSettings &settings, const QString& group=QString("grid/"), const JKQTPGridStyle &defaultStyle=JKQTPGridStyle());
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
*
* \param settings QSettings-object to save to
* \param group Group in the QSettings-object to save to
*/
void saveSettings(QSettings& settings, const QString& group=QString("grid/")) const;
/** \brief indicates whether to draw the major grid lines */
bool enabled;
/** \brief color of the grid*/
QColor lineColor;
/** \brief width of the grid lines (in pixel) */
double lineWidth;
/** \brief line stye of the grid lines */
Qt::PenStyle lineStyle;
};
/** \brief Support Class for JKQTPCoordinateAxis, which summarizes all properties that define the visual styling of a JKQTPCoordinateAxis /** \brief Support Class for JKQTPCoordinateAxis, which summarizes all properties that define the visual styling of a JKQTPCoordinateAxis
* \ingroup jkqtpplotter_styling * \ingroup jkqtpplotter_styling
* *
@ -131,27 +172,16 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle {
/** \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) */
double tickLabelAngle; double tickLabelAngle;
/** \brief indicates whether to draw the major grid lines */ /** \brief styling of the major/primary grid */
bool drawGrid; JKQTPGridStyle majorGridStyle;
/** \brief color of the grid*/ /** \brief styling of the minor/secondary grid */
QColor gridColor; JKQTPGridStyle minorGridStyle;
/** \brief width of the grid lines (in pixel) */
double gridWidth;
/** \brief line stye of the grid lines */
Qt::PenStyle gridStyle;
/** \brief indicates whether to draw the minor grid lines */
bool drawMinorGrid;
/** \brief color of the minor grid lines */
QColor minorGridColor;
/** \brief width of the minor grid lines (in pixel) */
double minorGridWidth;
/** \brief line stye of the minor grid lines */
Qt::PenStyle minorGridStyle;
/** \brief color of 0-line */ /** \brief color of 0-line */
QColor colorZeroAxis; QColor colorZeroAxis;
/** \brief pen style of 0-line */ /** \brief pen style of 0-line */
Qt::PenStyle styleZeroAxis; Qt::PenStyle styleZeroAxis;
/** \brief if non-zero, the line of the coordinate axis is moved outside by this amount [pt] */ /** \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; double axisLineOffset;
}; };