
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():
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 );
}
virtual QwtScaleDiv YourScaleEnigine::divideScale( double x1, double x2,
int maxMajSteps, int maxMinSteps, double stepSize ) const
{
QwtScaleDiv scaleDiv = QwtLinearScaleEngine::divideScale( x1, x2, ... );
// now remove/replace ticks from the dead areas
return filteredTicks( scaleDiv );
}
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks