I can’t find a way to change the scarlarbarwidget font properties such as size and color.
Can anyone help?
BK
I can’t find a way to change the scarlarbarwidget font properties such as size and color.
Can anyone help?
BK
Hello,
Try calling GetScalarBarActor()
on your vtkScalarBarWidget
object. That method returns a pointer to a vtkScalarBarActor
object. Call one of the Get*TextProperty()
methods on it (one for title, another for the labels, etc.). Each of such methods returns a pointer to some vtkTextProperty
object, which has lots of methods to change text style.
https://vtk.org/doc/nightly/html/classvtkScalarBarActor.html
https://vtk.org/doc/nightly/html/classvtkTextProperty.html
regards,
Paulo
Hi Paulo,
Your advice basically got me to where I wanted to be. A couple of small points though.
The SetFontSize didn’t override the size that the scalarBarWidget had. I suspect that this is because the scalarBarWidget is re-sizeable and re-sizes accordingly. I haven’t taken the time to find out how to turn the re-size off. I probably don’t want that anyway.
I found it odd that vtkTextProperty has a GetShadowColor function, but no function to set the shadow color. Would be nice to do that. Maybe it is there somewhere; not obvious. Fortunately, I can turn the “white” shadow off with ShadowOff.
Thanks.
BK
Hello,
New features can be proposed here: Development - VTK.
Try calling UnconstrainedFontSizeOff()
of the vtkScalarBarActor
object in question before setting font size.
UnconstrainedFontSizeOff()
had no effect.
UnconstrainedFontSizeOn()
worked.