#ifndef MYZOOMER_H
#define MYZOOMER_H
#include <qwt_plot_zoomer.h>
{
public:
{
setTrackerMode(ActiveOnly);
}
};
#endif
//MyWidget.cpp
void MyWidget::setAxis(){
MyPlot * myPlot = new MyPlot();
myPlot->changeAxis(curveNum, y); // calls MyPlot
myPlot->replot(); // after every thing has been called and the y axes have been set, I replot.
}
//I declare myZoomer in myPlot
#include "MyZoomer.h"
{
CurveAttrib ** curves;
public:
MyPlot(){
myZoomer
[0] = new MyZoomer
(QwtPlot::xBottom,
QwtPlot::yLeft, this
->canvas
());
myZoomer
[1] = new MyZoomer
(QwtPlot::xBottom,
QwtPlot::yRight, this
->canvas
());
}
MyZoomer *myZoomer[2];
....
void changeAxis(int curvNum, int axis){
curves[curvNum]->axis(axis); // the function 'axis' calls another function in
// CurveAttrib which assigns the axis
curves[curvNum]->curve->attach(this);
// here I make it so that the zoomer fits to the new data points,
// this happens before I replot so it looks right,
// the problem is that when I zoom the axis don't rescale,
// I don't know where to set auto scale for the y axes AFTER I zoom
myZoomer[0]->setZoomBase();
myZoomer[1]->setZoomBase();
this->setAxisAutoScale(yLeft);
this->setAxisAutoScale(yRight);
this->setAxisAutoScale(xBottom);
}
};
#endif
class CurveAttrib{
......
void axis(int axis){ /// sets y-left or y-right
curve->detach();
if (axis == 1){
}else{
}
}
#ifndef MYZOOMER_H
#define MYZOOMER_H
#include <qwt_plot_zoomer.h>
class MyZoomer : public QwtPlotZoomer
{
public:
MyZoomer(int xAxis, int yAxis, QwtPlotCanvas *canvas):
QwtPlotZoomer(xAxis, yAxis, canvas)
{
setTrackerMode(ActiveOnly);
}
};
#endif
//MyWidget.cpp
void MyWidget::setAxis(){
MyPlot * myPlot = new MyPlot();
myPlot->changeAxis(curveNum, y); // calls MyPlot
myPlot->replot(); // after every thing has been called and the y axes have been set, I replot.
}
//I declare myZoomer in myPlot
#include "MyZoomer.h"
class MyPlot : public QwtPlot
{
CurveAttrib ** curves;
public:
MyPlot(){
myZoomer[0] = new MyZoomer(QwtPlot::xBottom, QwtPlot::yLeft, this->canvas());
myZoomer[1] = new MyZoomer(QwtPlot::xBottom, QwtPlot::yRight, this->canvas());
enableAxis(QwtPlot::yRight);
}
MyZoomer *myZoomer[2];
....
void changeAxis(int curvNum, int axis){
curves[curvNum]->axis(axis); // the function 'axis' calls another function in
// CurveAttrib which assigns the axis
curves[curvNum]->curve->attach(this);
// here I make it so that the zoomer fits to the new data points,
// this happens before I replot so it looks right,
// the problem is that when I zoom the axis don't rescale,
// I don't know where to set auto scale for the y axes AFTER I zoom
myZoomer[0]->setZoomBase();
myZoomer[1]->setZoomBase();
this->setAxisAutoScale(yLeft);
this->setAxisAutoScale(yRight);
this->setAxisAutoScale(xBottom);
}
};
#endif
class CurveAttrib{
......
void axis(int axis){ /// sets y-left or y-right
curve->detach();
if (axis == 1){
curve->setYAxis(QwtPlot::yRight);
}else{
curve->setYAxis(QwtPlot::yLeft);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks