Is there a way to label a minor tick?
You might have layout issues, but beside this you can do the following:
virtual void YourScaleDraw
::draw( QPainter *painter,
const QPalette& palette ) const
{
painter
->setPen
( palette.
color( QPalette::Text ) );
const QList<double> ticks
= scldiv
().
ticks( QwtScaleDiv::MinorTick );
for ( int i = 0; i < ticks.count(); i++ )
{
const double v = ticks[i];
if ( d_data->scldiv.contains( v ) )
drawLabel( painter, v );
}
}
virtual void YourScaleDraw::draw( QPainter *painter,
const QPalette& palette ) const
{
painter->setPen( palette.color( QPalette::Text ) );
const QList<double> ticks = scldiv().ticks( QwtScaleDiv::MinorTick );
for ( int i = 0; i < ticks.count(); i++ )
{
const double v = ticks[i];
if ( d_data->scldiv.contains( v ) )
drawLabel( painter, v );
}
QwtScaleDraw::draw( painter, palette );
}
To copy to clipboard, switch view to plain text mode
Is there a way to get the current step size from QwtScaleDraw?
The step size is a parameter that is used for calculating the boundaries and ticks ( QwtScaleDiv ) of a scale, but the scale division might be built manually as well. So a QwtScaleDraw object has no step size !
But when a scale division has been calculated from a scale engine then delta between 2 major steps is usually the value you are looking for. Note, that when you have used a step size of 0 the step size has been calculated using the max major steps parameter instead.
When I set the step size of the scale engine to something large, my plot is significantly larger than if I go by the defaults.
No it isn't - the only effect I can imagine is because the scales are somehow aligned ( depending on the flags of the scale engine ) to multiples of the step size. But this leads to different ticks and boundaries, but not to larger scales.
Larger scales ( in widget coordinates ) might be because of having many major steps and tick labels, where space is needed.
HTH,
Uwe
Bookmarks