PDA

View Full Version : QwtSyntheticPointData boundaries can't be reached



Tomas_Zajic
14th December 2015, 22:47
Hello. I make use of QwtSyntheticPointData and I need to draw the plot reaching the borders of the interval. No matter how many sample points I insert, I can only get closer but can't reach it. For example:

CosinusData():QwtSyntheticPointData(30,QwtInterval (2.0,4.0,QwtInterval::IncludeBorders))

30 is the number of sample points. If there is 2 instead of 30, I can see the line starting at 2.0 and ending at 3.0. But I need it in 4.0. What can I do? I don't need to get closer adding more points. I only need to include max value boundary.

Thank you! I spent the whole day over this issue and I'm stuck :Confused

Uwe
15th December 2015, 07:13
I spent the whole day over this issue and I'm stuck :Confused
Qwt is open source and looking at the code makes a lot of sense, when facing such a situation.

F.e. when checking QwtSyntheticPointData::x() you can see easily, that the step size is calculated wrong. Instead
of "interval.width() / d_size" it has to be "interval.width() / ( d_size - 1 )".

Fixed in all relevant branches ( including 6.1 ) - if you don't want or can't use Qwt from SVN you can simple overload your x() method:


virtual CosinusData::x( uint index )
{
const double dx = interval().width() / ( size() - 1 );
return interval.minValue() + index * dx;
}Uwe

Tomas_Zajic
15th December 2015, 22:11
Vielen Dank! Es läuft schon:)
Looking at the source code for the next time.