Seite 1 von 1

qwt qwtplot - Kurve nicht zu sehen[gelöst]

Verfasst: 10. Mai 2007 23:04
von pitaz
Hallo, Hab hier n'kleines Testprogramm geschrieben bei dem die Kurve, die eigentlich da sein sollte nicht zu sehen ist. Was mache ich flasch?? Habs eigentlich vom simple_plot beispiel abgeschaut.

Code: Alles auswählen

#include <QApplication>

#include "fkplot.h"

int main(int argc, char *argv[])
{

    QApplication app(argc, argv);

    fkplot b(0);

    b.show();

    return app.exec();
}
und fkplot.cpp (header nur Konstruktor):

Code: Alles auswählen

#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_text.h>
#include "fkplot.h"

fkplot::fkplot(QWidget *parent):QwtPlot(parent)
{
    
	setTitle("test");
    
    setAxisTitle(xBottom, "x-->");
    setAxisTitle(yLeft, "y-->");

	setAxisScale(xBottom, 0, 7);
	setAxisScale(yLeft, -300, 300);



	double vx[100];
	double vy[100];

	QwtPlotCurve *kf = new QwtPlotCurve;
	
	kf->setRenderHint(QwtPlotItem::RenderAntialiased);
	kf->setPen(QPen(Qt::red));
	kf->attach(this);
	
	for(int i=0; i<=99; i++)
	{
	    vx[i]= 7/99*i;
		vy[i]= 200*sin(vx[i]);
	}
	
	kf->setData(vx, vy, 100);

	resize(640,480);
	 
	replot();
}
Vielen Dank für eine Antwort

Verfasst: 11. Mai 2007 08:03
von Parcivall
Hallo!

Wie sieht Dein header aus kannst Du den bitte auch posten...
Habe zwar auch erst mit QWT begonnen aber eigene Bsp. wie in SimplePlot laufen sogar in selbst erstellten Oberflächen durch den QT-Designer.

Verfasst: 11. Mai 2007 08:12
von pitaz
hab ja gesagt der header besteht nur aus konstruktor:

Code: Alles auswählen

#include <qwt_plot.h>

class QwtPlotCurve;

class fkplot :public QwtPlot
{
public:
	fkplot();
};

Verfasst: 11. Mai 2007 08:48
von Uwe
Deine Punkte sind alle (0, 0). Um das zu ändern. mußt Du das so schreiben:

Code: Alles auswählen

vx[i]= 7.0/99*i;
vy[i]= 200.0*sin(vx[i]);

HTH,
Uwe

Verfasst: 11. Mai 2007 09:56
von pitaz
Vielen Dank für die Antwort. Jetzt klappts. *schäm* :)