Hello,
I have a problem using the member function attach several times. Compiler does not find error, however only one curve appear that does not satisfy me. Is it possible to attach several curves to QwtPlot object?

In other words, I have attached many curves, than I make replot. As a result, only last attached curve is visible. I have studied sinusplot demo. The only difference with my code i have found is that all curves have been attached inside constructor. I do it in public member function.

Edited 5 Years Ago by Freude: n/a

This seems relevant.

In Google most information is about old 5. version of qwt. I have qwt 6. There is surprisingly little information about it. I did not find tutorial or something like this. However, changes are significantly as following from demo files.

Here is my member function which draws several characteristics stored in ps_x and ps_y sequentially in the single column. The number of characteristics equals number_of_characteristics.

void DataPlot::plot_Draw(double ps_x[], double ps_y[], double x_min, double x_max, double y_min, double y_max, int number_of_characteristics)
{
	double psx[1500];
	double psy[1500];
	
	setAxisScale(QwtPlot::xBottom, x_min, x_max);
	setAxisScale(QwtPlot::yLeft, y_min, y_max);  
	   
	QwtPlotCurve *d_curves[number_of_characteristics];
	
	for (int j=0;j<number_of_characteristics;j++){
		
		d_curves[j] = new QwtPlotCurve("Gain spectra");
		d_curves[j]->setRenderHint(QwtPlotItem::RenderAntialiased);
		d_curves[j]->setPen(QPen(QColor(150,150,200),2));
		d_curves[j]->setStyle(QwtPlotCurve::Lines);

		for (int j1=0;j1<1500;j1++){
			psx[j1]=ps_x[j1+j*1500];
			psy[j1]=ps_y[j1+j*1500];
		};
		// Insert new curves		
		d_curves[j]->setRawSamples(psx,psy,1500);
		d_curves[j]->attach(this);  
	};
	replot(); 	
}

Edited 5 Years Ago by Freude: n/a

I have found solution. Everything works nice if I use setSamples instead of setRawSamples.

This article has been dead for over six months. Start a new discussion instead.