[vtkusers] Size of labels in vtkScalarBarActor

Cory Quammen cory.quammen at kitware.com
Thu Oct 12 09:37:27 EDT 2017


Fernando,

Because you are using a scalar bar actor from ParaView, I suggest using the
vtkContext2DScalarBarActor. Font sizes are fixed in this scalar bar actor
implementation.

HTH,
Cory

On Thu, Oct 12, 2017 at 9:33 AM, Fernando Nellmeldin <
f.nellmeldin at open-engineering.com> wrote:

> Hello.
>
> I know that this issue was discussed many times before in this list, but I
> can't find a way to do what I want. I'm using VTK 7.1.1 (under Windows). So
> maybe there were some improvements.
>
> In fact, I'm using vtkPVScalarBarActor which includes some very well
> welcomed improvements, but the discussion should apply also to the normal
> vtkScalarBarActor.
> https://www.paraview.org/ParaView/Doc/Nightly/www/cxx-
> doc/classvtkPVScalarBarActor.html
>
> The issue is that the size of the labels for values depends on the
> viewport. So when the viewport changes the size, the labels also change
> their size. Is it possible to avoid this? I would like to set the size of
> the labels as constant or at least to define a maximum/minimum size,
> because sometimes it gets veeeeery small/big and it is not very pleaseant.
>
> Thank you!
>
> PS:
> Here's my code to configure the vtkPVScalarBarActor, in case it's
> useful... (I guess there are some calls that are useless):
>
> vtkSmartPointer<vtkPVScalarBarActor> scalarBarActor = vtkSmartPointer<
> vtkPVScalarBarActor>::New();
> scalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToDisplay();
> scalarBarActor->GetPositionCoordinate()->SetValue(20, 20, 0.0);
>
> scalarBarActor->SetAddRangeAnnotations(0);
> scalarBarActor->DrawTickMarksOff();
> scalarBarActor->UnconstrainedFontSizeOff();
> scalarBarActor->AnnotationTextScalingOn();
> scalarBarActor->SetFixedAnnotationLeaderLineColor(true);
>
> scalarBarActor->SetOrientationToVertical();
> //scalarBarActor->SetWidth(0.1); // width in viewport coordinates
> scalarBarActor->SetMaximumWidthInPixels(80);
> scalarBarActor->GetLabelTextProperty()->BoldOff();
> scalarBarActor->GetLabelTextProperty()->ItalicOff();
> scalarBarActor->GetLabelTextProperty()->ShadowOn();
> scalarBarActor->AutomaticLabelFormatOff();
> scalarBarActor->SetLabelFormat("%.2f");
> scalarBarActor->SetRangeLabelFormat(scalarBarActor->GetLabelFormat());
> scalarBarActor->SetMaximumNumberOfColors(100);
> scalarBarActor->SetNumberOfLabels(5);
>
> scalarBarActor->SetLookupTable(tempLUT); // defined elsewhere, doesn't
> matter
>
> scalarBarActor->SetTitle("Displacements");
> scalarBarActor->SetTitleJustification(VTK_TEXT_RIGHT);
> scalarBarActor->GetTitleTextProperty()->SetFontSize(8);
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171012/4ccafa98/attachment.html>


More information about the vtkusers mailing list