Skip to content

Commit

Permalink
xyrangechanged not checked for histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
thattil committed Dec 16, 2016
1 parent 37ea7d4 commit f464be3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
1 change: 1 addition & 0 deletions slsDetectorGui/include/qDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef QDEFS_H
#define QDEFS_H

#include "ansi.h"
#include "sls_detector_defs.h"
#include "slsDetector.h"
#include "multiSlsDetector.h"
Expand Down
3 changes: 1 addition & 2 deletions slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
#ifndef SLSQT1DPLOT_H
#define SLSQT1DPLOT_H

#ifndef IAN
typedef double double32_t;
typedef float float32_t;
typedef int int32_t;
#endif
#include "ansi.h"


#include <qwt_plot.h>
Expand Down
54 changes: 29 additions & 25 deletions slsDetectorGui/src/qDrawPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,9 +1369,11 @@ void qDrawPlot::UpdatePlot(){
histFrameIndexTitle->setText(GetHistTitle(0));
plotHistogram->attach(plot1D);
//refixing all the zooming

plot1D->SetXMinMax(startPixel,endPixel);
plot1D->SetYMinMax(0,plotHistogram->boundingRect().height());
plot1D->SetZoomBase(startPixel,0,endPixel-startPixel,plotHistogram->boundingRect().height());

}
//not histogram
else{
Expand Down Expand Up @@ -1403,33 +1405,35 @@ void qDrawPlot::UpdatePlot(){
// firstPlot = false;
//}
}
}


// update range if required
if(XYRangeChanged){
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum();
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum();
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum();
plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
//Should not be reset for histogram,
//that is the only way to zoom in (new plots are zoomed out as its different each time)
if(!histogram)
XYRangeChanged = false;
}
//Display Statistics
if(displayStatistics){
double min=0,max=0,sum=0;
if(anglePlot)
GetStatistics(min,max,sum,histYAngleAxis,histNBins);
else
GetStatistics(min,max,sum,histYAxis[0],histNBins);
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
/**moved from below (had applied to histograms as well) to here, */
// update range if required
if(XYRangeChanged){
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum();
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum();
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum();
plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
//Should not be reset for histogram,
//that is the only way to zoom in (new plots are zoomed out as its different each time)
if(!histogram)
XYRangeChanged = false;
}
/**moved from below (had applied to histograms as well) to here, */
//Display Statistics
if(displayStatistics){
double min=0,max=0,sum=0;
if(anglePlot)
GetStatistics(min,max,sum,histYAngleAxis,histNBins);
else
GetStatistics(min,max,sum,histYAxis[0],histNBins);
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
}
}

if(saveAll) SavePlotAutomatic();

}
Expand Down

0 comments on commit f464be3

Please sign in to comment.