Hi. The troubles are:
1) when i move the plot by mouse, it could be moved far away from any needed area. How can i tell Qwt the EXACT plotting zone?
2) when the plot is being dragged and not dropped,only the part, the previously visible part is drawn. How can it be fixed?
#include <QtGui/QApplication>
#include <QVector>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_canvas.h>
#define NUM_OF_POINTS 1000
int main(int argc, char *argv[])
{
double x[NUM_OF_POINTS], y[NUM_OF_POINTS];
for(int i = 0; i < NUM_OF_POINTS; i++)
{
x[i] = i;
y[i] = i*i;
}
megaCurve->setData(x,y,NUM_OF_POINTS);
megaCurve->attach(megaPlot);
megaGrid->enableXMin(true);
megaGrid->enableYMin(true);
megaGrid->attach(megaPlot);
megaPlot->resize(640,480);
megaPanner->setMouseButton(Qt::RightButton);
megaPlot->show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QVector>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_canvas.h>
#define NUM_OF_POINTS 1000
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QwtPlot* megaPlot = new QwtPlot(QwtText("MegaPlot"));
QwtPlotCurve* megaCurve = new QwtPlotCurve("MEGALINE");
double x[NUM_OF_POINTS], y[NUM_OF_POINTS];
for(int i = 0; i < NUM_OF_POINTS; i++)
{
x[i] = i;
y[i] = i*i;
}
megaCurve->setData(x,y,NUM_OF_POINTS);
megaCurve->attach(megaPlot);
QwtPlotGrid* megaGrid = new QwtPlotGrid;
megaGrid->enableXMin(true);
megaGrid->enableYMin(true);
megaGrid->attach(megaPlot);
megaPlot->resize(640,480);
QwtPlotPanner* megaPanner = new QwtPlotPanner(megaPlot->canvas());
megaPanner->setMouseButton(Qt::RightButton);
megaPlot->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks