This commit is contained in:
2019-07-15 15:46:38 +02:00
parent 0f2641f9fa
commit 4f5b8c17b2
7 changed files with 65 additions and 64 deletions

View File

@ -13,6 +13,11 @@
#ifndef SLSQT1DPLOT_H
#define SLSQT1DPLOT_H
typedef double double32_t;
typedef float float32_t;
typedef int int32_t;
#include "ansi.h"
@ -26,6 +31,7 @@
class QPen;
class SlsQt1DPlot;
class QwtSymbol;
class SlsQtH1D:public QwtPlotCurve{
@ -40,6 +46,8 @@ class SlsQtH1D:public QwtPlotCurve{
int SetLineColor(int c=-1);
int SetLineWidth(int w=1);
void SetLineStyle(int s=0);
void setStyleLinesorDots(bool isLines);
void setSymbolMarkers(bool isMarker);
void SetData(int n, double xmin, double xmax, double* d=0);
void SetData(int n, double* dx, double* dy);
@ -72,7 +80,6 @@ class SlsQtH1D:public QwtPlotCurve{
double *x,*y;
double ymin,ymax;
double firstXgt0,firstYgt0;
void Initailize();
int SetUpArrays(int n);
int CheckIndex(int bx);
@ -120,8 +127,8 @@ class SlsQt1DPlot:public QwtPlot{
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
use zooming functionality without mouse control*/
void DisableZoom(bool disable);
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);Update();};
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);Update();};
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
double GetXMinimum(){return hist_list->Hist()->GetXMin();};

View File

@ -50,10 +50,9 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
#if QWT_VERSION<0x060000
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
#elif QWT_VERSION==0x060000
virtual QwtText trackerText(const QPointF &pos) const{
#else
virtual QwtText trackerTextF(const QPointF &pos) const{
using QwtPlotPicker::trackerText;
virtual QwtText trackerText(const QPoint &pos) const{
#endif
QColor bg(Qt::white);
@ -64,8 +63,7 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
#if QWT_VERSION<0x060000
QwtText text = QwtPlotZoomer::trackerText(pos);
#else
QPoint p=pos.toPoint();
QwtText text = QwtPlotZoomer::trackerText(p);
QwtText text = QwtPlotPicker::trackerText(pos);
#endif
text.setBackgroundBrush( QBrush( bg ));
return text;

View File

@ -14,6 +14,7 @@
#include <qwt_scale_draw.h>
#include <qwt_scale_engine.h>
#include <qwt_scale_widget.h>
#include "qwt_symbol.h"
#include <stdlib.h>
#if QWT_VERSION >= 0x060100
@ -124,6 +125,23 @@ void SlsQtH1D::SetLineStyle(int s) {
setPen(*pen_ptr);
}
void SlsQtH1D::setStyleLinesorDots(bool isLines) {
setStyle(isLines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
}
void SlsQtH1D::setSymbolMarkers(bool isMarker) {
QwtSymbol* marker = new QwtSymbol();
if (isMarker) {
marker->setStyle(QwtSymbol::Cross);
marker->setSize(5, 5);
}
#if QWT_VERSION < 0x060000
setSymbol(*marker);
#else
setSymbol(marker);
#endif
}
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
n = SetUpArrays(n);