I have a custom scaling for the x-axis, and want to have an automatic scaling for the y-axis. It seems like a customized x-axis scale disables the axisAutoScale(QwtPlot::yLeft) somehow. Is there an easy fix to this problem?
best regards
Printable View
I have a custom scaling for the x-axis, and want to have an automatic scaling for the y-axis. It seems like a customized x-axis scale disables the axisAutoScale(QwtPlot::yLeft) somehow. Is there an easy fix to this problem?
best regards
There is nothing to fix - setting a scale for one axis doesn't disable autoscaling for other axes.
Uwe
The autoscaling works in the very beginning of the simulation, but after that it just keeps the new fixed scale. I've tried to run the autoscale in a loop, but it doesnt seem to be working. Is it in theory enough to set the autoscaling options in the constructor, or is it necessary to manually run the autoscaling function in a loop?
Why does line 71 only work on the first iteration? The autoscaling is performed just once in the beginning, and then it stays frozen in that position.
Code:
#ifndef NEWPLOT_H #define NEWPLOT_H #include <cmath> #include <QtGui/QDialog> #include "qwt_plot.h" #include <qwt_plot_curve.h> #include <QTimer> #include <qwt_plot_grid.h> #include <qwt_plot_panner.h> #include <QString> { Q_OBJECT public: { m_time = 0; for (int i = 0; i < 1000; i++) { m_x[i] = 0; m_y[i] = 0.0; } this->setTitle("Winch 1"); //this->axisAutoScale(QwtPlot::yLeft); this->setAutoReplot(true); timeFrame = 10; } void appendData( double x, double y){ memmove(m_y, &m_y[1], 999 * sizeof(double)); memmove(m_x, &m_x[1], 999 * sizeof(double)); m_y[999] = y; m_x[999] = x; } private slots: { timeFrame =mystring.toDouble(); } void draw() { if (!m_curve) { m_curve->setRawSamples(m_x, m_y, 1000); m_curve->attach(this); } //this->setAxisScale(QwtPlot::yLeft, -100, 100); this->replot(); // Grid //QwtPlotGrid *grid = new QwtPlotGrid; //grid->enableXMin(true); //grid->enableYMin(true); //grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); //grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); //grid->attach(this); //QwtPlotPanner* megaPanner = new QwtPlotPanner(this->canvas()); //megaPanner->setMouseButton(Qt::RightButton); //megaPanner->setAxisEnabled(QwtPlot::xBottom, false); } private: QwtPlotCurve *m_curve; int m_time; double m_x[1000]; double m_y[1000]; double timeFrame; }; #endif // NEWPLOT_H
Bump. I could really use some help here. See something fishy in my code?