Scale Breaks in the QWT plot axis
I had a quick look and didn't find anything that seemed to cover this (apologies if i missed it).
i wanted to know if it is possible to create scale breaks in the qwt plots. I ask because I have a data set that does not contain any points in a certain portion of the x-axis range e.g. data exists from 400-2500 & 6000-14000 but is absent from 2500-6000.
So when I plot this i get my curves but they look a bit naff since there is this giant gap where my data doesn't exist.
Any ideas, clues?
Cheers
Oz
Re: Scale Breaks in the QWT plot axis
Quote:
Originally Posted by
OzQTNoob
i wanted to know if it is possible to create scale breaks in the qwt plots. I ask because I have a data set that does not contain any points in a certain portion of the x-axis range e.g. data exists from 400-2500 & 6000-14000 but is absent from 2500-6000.
You need to implement your own QwtScaleTransformation, mapping the unimportant intervals to a much smaller intervals on the paint device. In SVN trunk you find the scaleengine demo in the playground directory. It is for QwtTransform ( what will replace QwtScaleTransformation in Qwt 6.1 ), but you should get the idea what to do. Have a look at the "At 400" transformation, that extends an interval ( using pow() ) - fed with different parameters it is also able to shrink the interval.
You also need to avoid having ticks in the areas of no interest. One solution is to calculate them manually and assign them QwtPlot::setAxisScaleDiv. If this is not possible ( f.e when you need zooming ) you need to overload QwtLinearScaleEngine::divideScale():
Code:
virtual QwtScaleDiv YourScaleEnigine
::divideScale( double x1,
double x2,
int maxMajSteps, int maxMinSteps, double stepSize ) const
{
// now remove/replace ticks from the dead areas
return filteredTicks( scaleDiv );
}
Uwe