diff --git a/Histogram1D.h b/Histogram1D.h index 85f3856..8b239de 100644 --- a/Histogram1D.h +++ b/Histogram1D.h @@ -12,6 +12,8 @@ class Histogram1D : public QCustomPlot{ public: Histogram1D(QString title, QString xLabel, int xbin, double xmin, double xmax, QWidget * parent = nullptr) : QCustomPlot(parent){ + isLogY = false; + for( int i = 0; i < 3; i ++) txt[i] = nullptr; nData = 1; Rebin(xbin, xmin, xmax); @@ -82,6 +84,7 @@ public: QMenu menu(this); QAction * a1 = menu.addAction("UnZoom"); + QAction * a5 = menu.addAction("Set/UnSet Log-y"); QAction * a2 = menu.addAction("Clear hist."); QAction * a3 = menu.addAction("Toggle Stat."); QAction * a4 = menu.addAction("Rebin (clear histogram)"); @@ -170,6 +173,17 @@ public: } } + if( selectedAction == a5 ){ + + if( !isLogY ){ + this->yAxis->setScaleType(QCPAxis::stLogarithmic); + isLogY = true; + }else{ + this->yAxis->setScaleType(QCPAxis::stLinear); + isLogY = false; + } + this->replot(); + } } }); @@ -294,6 +308,8 @@ private: int underFlow; int overFlow; + bool isLogY; + unsigned short nData; QVector xList; QVector yList[MaxNHist];