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
computeBarSize
Compute the bar position and size within the box, and return the size of a single bar segment in normalized bar coordinates.
| Argument | Type | Required | Description |
|---|---|---|---|
textSizes | ITextSizes | Yes |
createPolyDataForOneLabel
Append the quad for a single label to results, advancing its point and cell indices. Does nothing when the text is absent from the texture atlas.
| Argument | Type | Required | Description |
|---|---|---|---|
text | String | Yes | |
pos | Vector3 | Yes | anchor point in normalized viewport coordinates |
alignment | Yes | horizontal and vertical anchoring of the text | |
orientation | Yes | text orientation | |
offset | Vector2 | Yes | pixel offset applied to the anchor point |
results | IResult | Yes | accumulator that is mutated in place |
extend
Method use to decorate a given object (publicAPI+model) with vtkScalarBarActor characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IScalarBarActorInitialValues | No | (default: {}) |
getActors
getAutoLayout
getAutomated
getAxisLabel
getAxisTextStyle
getAxisTextStyle
getAxisTitlePixelOffset
Pixel offset between the bar and the axis title, as used for this view.
getAxisTitlePixelOffset
getBarActor
Get the actor drawing the colored bar segments.
getBarPosition
getBarPositionByReference
getBarSize
getBarSizeByReference
getBoxPosition
Position of the box the bar and its labels are laid out in, in normalized viewport coordinates.
getBoxPosition
getBoxPositionByReference
getBoxPositionByReference
getBoxSize
Size of the box the bar and its labels are laid out in, in normalized viewport coordinates.
getBoxSize
getBoxSizeByReference
getBoxSizeByReference
getDrawAboveRangeSwatch
getDrawBelowRangeSwatch
getDrawNanAnnotation
getGenerateTicks
getLastAspectRatio
The view aspect ratio recorded at the last updateAPISpecificData().
getLastSize
The view size in pixels recorded at the last updateAPISpecificData().
getLastTickBounds
The scalar range the bar was last built for.
getNestedProps
getOrientation
Get the current bar orientation setting
getRenderable
Get the actor this helper renders for.
getScalarsToColors
getTickLabelPixelOffset
Pixel offset between the bar and the tick labels, as used for this view.
getTickLabelPixelOffset
getTickPositions
Normalized position along the tick segment for each tick. When unset, the position is derived from the tick value and the mapping range.
getTickStrings
The label drawn for each entry of getTicks().
getTickTextStyle
getTickTextStyle
getTicks
The scalar values the ticks are drawn at.
getTmActor
Get the actor drawing the text label quads.
getTopTitle
Whether the axis title is drawn above the bar rather than beside it.
newInstance
Method use to create a new instance of vtkScalarBarActor
recomputeBarSegments
Rebuild the bar segments (NaN, Below, ticks, Above) from the current settings.
| Argument | Type | Required | Description |
|---|---|---|---|
textSizes | ITextSizes | Yes |
resetAutoLayoutToDefault
resetGenerateTicksToDefault
setAutoLayout
| Argument | Type | Required | Description |
|---|---|---|---|
autoLayout | Yes |
setAutomated
| Argument | Type | Required | Description |
|---|---|---|---|
automated | Boolean | Yes |
setAxisLabel
| Argument | Type | Required | Description |
|---|---|---|---|
axisLabel | String | Yes |
setAxisTextStyle
| Argument | Type | Required | Description |
|---|---|---|---|
axisTextStyle | IStyle | Yes |
setAxisTitlePixelOffset
Pixel offset between the bar and the axis title, as used for this view.
| Argument | Type | Required | Description |
|---|---|---|---|
axisTitlePixelOffset | Number | Yes |
setAxisTitlePixelOffset
| Argument | Type | Required | Description |
|---|---|---|---|
axisTitlePixelOffset | Number | Yes |
setBarPosition
| Argument | Type | Required | Description |
|---|---|---|---|
barPosition | Vector2 | Yes |
setBarPositionFrom
| Argument | Type | Required | Description |
|---|---|---|---|
barPosition | Vector2 | Yes |
setBarSize
| Argument | Type | Required | Description |
|---|---|---|---|
barSize | Size | Yes |
setBarSizeFrom
| Argument | Type | Required | Description |
|---|---|---|---|
barSize | Size | Yes |
setBoxPosition
| Argument | Type | Required | Description |
|---|---|---|---|
boxPosition | Vector2 | Yes |
setBoxPosition
| Argument | Type | Required | Description |
|---|---|---|---|
boxPosition | Vector2 | Yes |
setBoxPositionFrom
| Argument | Type | Required | Description |
|---|---|---|---|
boxPosition | Vector2 | Yes |
setBoxPositionFrom
| Argument | Type | Required | Description |
|---|---|---|---|
boxPosition | Vector2 | Yes |
setBoxSize
| Argument | Type | Required | Description |
|---|---|---|---|
boxSize | Size | Yes |
setBoxSize
| Argument | Type | Required | Description |
|---|---|---|---|
boxSize | Size | Yes |
setBoxSizeFrom
| Argument | Type | Required | Description |
|---|---|---|---|
boxSize | Size | Yes |
setBoxSizeFrom
| Argument | Type | Required | Description |
|---|---|---|---|
boxSize | Size | Yes |
setDrawAboveRangeSwatch
Set whether the Above range swatch should be rendered or not
| Argument | Type | Required | Description |
|---|---|---|---|
drawAboveRangeSwatch | Boolean | Yes |
setDrawBelowRangeSwatch
Set whether the Below range swatch should be rendered or not
| Argument | Type | Required | Description |
|---|---|---|---|
drawBelowRangeSwatch | Boolean | Yes |
setDrawNanAnnotation
Set whether the NaN annotation should be rendered or not.
| Argument | Type | Required | Description |
|---|---|---|---|
drawNanAnnotation | Boolean | Yes |
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()
}| Argument | Type | Required | Description |
|---|---|---|---|
generateTicks | Yes |
setOrientation
Set the orientation of the scalar bar
| Argument | Type | Required | Description |
|---|---|---|---|
orientation | Yes | '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
setRenderable
Bind this helper to an actor. Rebinds the internal actors' property, parent prop and coordinate system, and copies the actor's text styles.
| Argument | Type | Required | Description |
|---|---|---|---|
renderable | vtkScalarBarActor | Yes |
setScalarsToColors
| Argument | Type | Required | Description |
|---|---|---|---|
scalarsToColors | vtkScalarsToColors | Yes |
setTickLabelPixelOffset
Pixel offset between the bar and the tick labels, as used for this view.
| Argument | Type | Required | Description |
|---|---|---|---|
tickLabelPixelOffset | Number | Yes |
setTickLabelPixelOffset
| Argument | Type | Required | Description |
|---|---|---|---|
tickLabelPixelOffset | Yes |
setTickPositions
Normalized position along the tick segment for each tick.
| Argument | Type | Required | Description |
|---|---|---|---|
tickPositions | Array[Number] | Yes |
setTickStrings
The label drawn for each entry of getTicks().
| Argument | Type | Required | Description |
|---|---|---|---|
tickStrings | Array[String] | Yes |
setTickTextStyle
| Argument | Type | Required | Description |
|---|---|---|---|
tickStyle | IStyle | Yes |
setTicks
The scalar values the ticks are drawn at.
| Argument | Type | Required | Description |
|---|---|---|---|
ticks | Array[Number] | Yes |
setTopTitle
Whether the axis title is drawn above the bar rather than beside it.
| Argument | Type | Required | Description |
|---|---|---|---|
topTitle | Boolean | Yes |
setVisibility
updateAPISpecificData
Record the view resolution, camera and render window, and rebuild the texture atlas, bar segments and polydata when anything they depend on has changed.
| Argument | Type | Required | Description |
|---|---|---|---|
size | Vector2 | Yes | the view size in pixels |
camera | vtkCamera | Yes | |
renderWindow | Yes |
updatePolyDataForBarSegments
Rebuild the polydata holding the colored bar segments.
updatePolyDataForLabels
Rebuild the polydata holding the label quads and their texture coordinates.
updateTextureAtlas
Render every label into the texture atlas and return the resulting text measurements. Only needs to be called when the strings change.