Skip to content

ScalarBarActor

Introduction

vtkScalarBarActor creates a scalar bar with tick marks. A scalar bar is a legend that indicates to the viewer the correspondence between color value and data value. The legend consists of a rectangular bar made of rectangular pieces each colored a constant value. Since vtkScalarBarActor is a subclass of vtkActor2D, it is drawn in the image plane (i.e., in the renderer's viewport) on top of the 3D graphics window.

Methods

completedImage

ArgumentTypeRequiredDescription
doUpdateBooleanYes

computeBarSize

based on all the settins compute a barSegments array containing the segments opf the scalar bar each segment contains : corners[4][2] title - e.g. NaN, Above, ticks scalars - the normalized scalars values to use for that segment

Note that the bar consumes the space in the box that remains after leaving room for the text labels.

ArgumentTypeRequiredDescription
textSizesITextSizesYes

createPolyDataForOneLabel

Called by updatePolyDataForLabels modifies class constants ptv3, tmpv3

ArgumentTypeRequiredDescription
textYes
posYes
xdirYes
ydirYes
dirYes
offsetYes
resultsYes

extend

Method use to decorate a given object (publicAPI+model) with vtkScalarBarActor characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIScalarBarActorInitialValuesNo(default: {})

getActors

getAutoLayout

getAutomated

getAxisLabel

getAxisTextStyle

getAxisTitlePixelOffset

getBoxPosition

getBoxPositionByReference

getBoxSize

getBoxSizeByReference

getDrawAboveRangeSwatch

getDrawBelowRangeSwatch

getDrawNanAnnotation

getGenerateTicks

getNestedProps

getOrientation

Get the current bar orientation setting

getScalarsToColors

getTickTextStyle

newInstance

Method use to create a new instance of vtkScalarBarActor

recomputeBarSegments

ArgumentTypeRequiredDescription
textSizesITextSizesYes

resetAutoLayoutToDefault

setAutoLayout

ArgumentTypeRequiredDescription
autoLayoutYes

setAutomated

ArgumentTypeRequiredDescription
automatedBooleanYes

setAxisLabel

ArgumentTypeRequiredDescription
axisLabelStringYes

setAxisTextStyle

ArgumentTypeRequiredDescription
axisTextStyleIStyleYes

setAxisTitlePixelOffset

ArgumentTypeRequiredDescription
axisTitlePixelOffsetNumberYes

setBarPosition

ArgumentTypeRequiredDescription
barPositionVector2Yes

setBarPositionFrom

ArgumentTypeRequiredDescription
barPositionVector2Yes

setBarSize

ArgumentTypeRequiredDescription
barSizeSizeYes

setBarSizeFrom

ArgumentTypeRequiredDescription
barSizeSizeYes

setBoxPosition

ArgumentTypeRequiredDescription
boxPositionVector2Yes

setBoxPositionFrom

ArgumentTypeRequiredDescription
boxPositionVector2Yes

setBoxSize

ArgumentTypeRequiredDescription
boxSizeSizeYes

setBoxSizeFrom

ArgumentTypeRequiredDescription
boxSizeSizeYes

setDrawAboveRangeSwatch

Set whether the Above range swatch should be rendered or not

ArgumentTypeRequiredDescription
drawAboveRangeSwatchBooleanYes

setDrawBelowRangeSwatch

Set whether the Below range swatch should be rendered or not

ArgumentTypeRequiredDescription
drawBelowRangeSwatchBooleanYes

setDrawNanAnnotation

Set whether the NaN annotation should be rendered or not.

ArgumentTypeRequiredDescription
drawNanAnnotationBooleanYes

setGenerateTicks

Sets the function used to generate legend ticks.

This function takes a vtkScalarBarActorHelper and returns true on success. To have the desired effect, the function must call: helper.setTicks(ticks: num[]) and helper.setTickStrings(tickStrings: string[]).

After setting the generateTicks function you must regenerate the vtkScalarBarActor for your changes to take effect. One way to do that is:

 const mapper = scalarBarActor.getMapper()
 if (mapper) {
   mapper.getLookupTable().resetAnnotations()
 }
ArgumentTypeRequiredDescription
generateTicksYes

setOrientation

Set the orientation of the scalar bar

ArgumentTypeRequiredDescription
orientationYes'horizontal' to force horizontal, 'vertical' to force vertical, or null/undefined for auto

setOrientationToHorizontal

Forces the scalar bar to use horizontal orientation regardless of aspect ratio

setOrientationToVertical

Forces the scalar bar to use vertical orientation regardless of aspect ratio

setScalarsToColors

ArgumentTypeRequiredDescription
scalarsToColorsvtkScalarsToColorsYes

setTickLabelPixelOffset

ArgumentTypeRequiredDescription
tickLabelPixelOffsetYes

setTickTextStyle

ArgumentTypeRequiredDescription
tickStyleIStyleYes

setVisibility

update

main method to rebuild the scalarBar when something has changed tracks modified times

updatePolyDataForBarSegments

updatePolyDataForLabels

Udate the polydata associated with drawing the text labels specifically the quads used for each label and their associated tcoords etc. This changes every time the camera viewpoint changes

updateTextureAtlas

create the texture map atlas that contains the rendering of all the text strings. Only needs to be called when the text strings have changed (labels and ticks)