[vtkusers] vtkLegendScaleActor label fitting

Alex Malyushytsky malyushytsky at gmail.com
Thu Mar 19 21:02:27 EDT 2015


To my mind current implementation of vtkLegendScaleActor is useless due to
inability to scale axis value labels so they are visible on the
screen (displayed in viewport).
This is sad cause in all other areas it does a good job.
The problem seems related to the usage of vtkAxisActor2D which does not
provide sufficient control to be set up properly.
I was able to achieve desired effects overriding both classes and
making vtkAxisActor2D
to display fixed size text using pre-defined ( by vtkLegendScaleActor
subclass) offsets calling
vtkTextMapper::SetMultipleConstrainedFontSize( viewport, xOffset, yOffset5,
this->LabelMappers, this->AdjustedNumberOfLabels, this->LastMaxLabelSize );
instead of

TextMapper::SetMultipleRelativeFontSize(viewport,
this->LabelMappers,this->AdjustedNumberOfLabels,size,this->LastMaxLabelSize,0.015*this->FontFactor*this->LabelFactor);
in vtkAxisActor2D subclass.
My solution is not perfect, I would prefer to restrict scaling of the
labels to make sure they fir viewport instead and
it does not fix axis title positioning ( I simply do not show them ).
But if anybody is interested I may provide the mock up of the class to
demonstrate the fix.

Regards,
   Alex



On Tue, Mar 17, 2015 at 5:25 PM, Alex Malyushytsky <malyushytsky at gmail.com>
wrote:

> *I am trying to use *vtkLegendScaleActor in distance mode.
> Everything works fine, but depending on the zoom and viewport size labels
> (on vertical axes)  may be drawn outside of the viewport.
>
> I am looking for solution which probably can be either dynamic adjusting
> of  the offsets or automatic scaling of the labels.
>
> Anybody can point how to do it?
>
> Best regards,
>     Alex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150319/8a55cb92/attachment.html>


More information about the vtkusers mailing list