add log-y for histogram 1
This commit is contained in:
parent
495d65a112
commit
d90dd4920f
|
@ -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<double> xList;
|
||||
QVector<double> yList[MaxNHist];
|
||||
|
|
Loading…
Reference in New Issue
Block a user