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
| Argument | Type | Required | Description |
|---|---|---|---|
doUpdate | Boolean | Yes |
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.
| Argument | Type | Required | Description |
|---|---|---|---|
textSizes | ITextSizes | Yes |
createPolyDataForOneLabel
Called by updatePolyDataForLabels modifies class constants ptv3, tmpv3
| Argument | Type | Required | Description |
|---|---|---|---|
text | Yes | ||
pos | Yes | ||
xdir | Yes | ||
ydir | Yes | ||
dir | Yes | ||
offset | Yes | ||
results | Yes |
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
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
| Argument | Type | Required | Description |
|---|---|---|---|
textSizes | ITextSizes | Yes |
resetAutoLayoutToDefault
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
| 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 |
setBoxPositionFrom
| Argument | Type | Required | Description |
|---|---|---|---|
boxPosition | Vector2 | Yes |
setBoxSize
| 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
setScalarsToColors
| Argument | Type | Required | Description |
|---|---|---|---|
scalarsToColors | vtkScalarsToColors | Yes |
setTickLabelPixelOffset
| Argument | Type | Required | Description |
|---|---|---|---|
tickLabelPixelOffset | Yes |
setTickTextStyle
| Argument | Type | Required | Description |
|---|---|---|---|
tickStyle | IStyle | Yes |
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)