added shortcut setShowZeroAxes() to JKQTBasePlotter and JKQTPlotter

This commit is contained in:
jkriege2 2019-06-12 13:00:28 +02:00
parent 6d95c5c64c
commit 8aaf806ab5
3 changed files with 38 additions and 1 deletions

View File

@ -304,7 +304,16 @@ JKQTBasePlotter::~JKQTBasePlotter(){
void JKQTBasePlotter::setGrid(bool val) {
xAxis->setDrawGrid(val);
yAxis->setDrawGrid(val);
};
}
void JKQTBasePlotter::setShowZeroAxes(bool showX, bool showY) {
getXAxis()->setShowZeroAxis(showX);
getYAxis()->setShowZeroAxis(showY);
}
void JKQTBasePlotter::setShowZeroAxes(bool showXY) {
setShowZeroAxes(showXY,showXY);
}
void JKQTBasePlotter::useExternalDatastore(JKQTPDatastore* newStore){
if (datastoreInternal && datastore!=nullptr) {

View File

@ -1434,6 +1434,18 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/** \brief sets whether to plot grid lines or not */
void setGrid(bool val);
/** \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)
* \param showY indicates whether to show the zero-axis associated with the y-axis (i.e. y==0 or the horizontal zero-axis)
* */
void setShowZeroAxes(bool showX, bool showY);
/** \brief switches the visibility of the zero-axes associated with the x- and y-axis
*
* \param showXY indicates whether to show the zero-axis associated with the x- and y-axis
* */
void setShowZeroAxes(bool showXY);
/** \brief save the current plot as a pixel image image (PNG ...), if filename is empty a file selection dialog is displayed */
void saveAsPixelImage(const QString& filename=QString(""), bool displayPreview=true, const QByteArray &outputFormat=QByteArray());

View File

@ -926,6 +926,22 @@ class JKQTP_LIB_EXPORT JKQTPlotter: public QWidget {
plotter->setGrid(val);
}
/** \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)
* \param showY indicates whether to show the zero-axis associated with the y-axis (i.e. y==0 or the horizontal zero-axis)
* */
inline void setShowZeroAxes(bool showX, bool showY) {
plotter->setShowZeroAxes(showX, showY);
}
/** \brief switches the visibility of the zero-axes associated with the x- and y-axis
*
* \param showXY indicates whether to show the zero-axis associated with the x- and y-axis
* */
inline void setShowZeroAxes(bool showXY) {
plotter->setShowZeroAxes(showXY);
}
/** \brief save the current plot as an image file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed.
* The image format is extracted from the file extension (jpeg, tiff, png, pdf, ...) */
inline void saveImage(const QString& filename=QString(""), bool displayPreview=true) {