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

Alles rund um die Programmierung mit Qt
Antworten
pitaz
Beiträge: 6
Registriert: 18. April 2007 11:43

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

Beitrag 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
Zuletzt geändert von pitaz am 11. Mai 2007 09:57, insgesamt 1-mal geändert.
Parcivall
Beiträge: 12
Registriert: 17. April 2007 14:16

Beitrag 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.
„The rich can not live on an island surrounded by poverty.We all breathe the same air.We should give everyone a chance,at least a fundamental chance.“ (Ayerton Senna)
pitaz
Beiträge: 6
Registriert: 18. April 2007 11:43

Beitrag 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();
};
Uwe
Beiträge: 176
Registriert: 9. Oktober 2005 13:37
Wohnort: München

Beitrag 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
pitaz
Beiträge: 6
Registriert: 18. April 2007 11:43

Beitrag von pitaz »

Vielen Dank für die Antwort. Jetzt klappts. *schäm* :)
Antworten