Class StackLabels
- All Implemented Interfaces:
Serializable
- Since:
- 6.0.1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlign()getStyle()getX()getY()voidsetAlign(HorizontalAlign align) Defines the horizontal alignment of the stack total label.voidsetEnabled(Boolean enabled) Enable or disable the stack total labels.voidA format string for the data label.voidsetFormatter(String _fn_formatter) Sets the JavaScript function of theformatteroption, as the source code of the function.voidsetFormatterFunction(ChartFunction formatter) Sets the function of theformatteroption, declared in aJsDefinitioninterface.voidsetRotation(Number rotation) Rotation of the labels in degrees.voidCSS styles for the label.voidsetTextAlign(String textAlign) The text alignment for the label.voidsetUseHTML(Boolean useHTML) Whether to use HTML to render the labels.voidsetVerticalAlign(VerticalAlign verticalAlign) Defines the vertical alignment of the stack total label.voidThe x position offset of the label relative to the left of the stacked bar.voidThe y position offset of the label relative to the tick position on the axis.
-
Constructor Details
-
StackLabels
public StackLabels() -
StackLabels
-
-
Method Details
-
getAlign
- See Also:
-
setAlign
Defines the horizontal alignment of the stack total label. Can be one of"left","center"or"right". The default value is calculated at runtime and depends on orientation and whether the stack is positive or negative. -
getEnabled
- See Also:
-
setEnabled
Enable or disable the stack total labels.Defaults to: false
-
getFormat
- See Also:
-
setFormat
A format string for the data label. Available variables are the same as forformatter.Defaults to: {total}
-
getFormatter
-
setFormatter
Sets the JavaScript function of theformatteroption, as the source code of the function.The browser compiles the function from this string, which a Content Security Policy without
unsafe-evalblocks: in the strict CSP mode, sending a chart configuration that has a function throws aContentSecurityPolicyViolationException. Where a format string is enough, usesetFormat(String), which needs no JavaScript.Setting a function this way clears a function set with
setFormatterFunction(ChartFunction), which works without compiling JavaScript in the browser.- Parameters:
_fn_formatter- the source code of the JavaScript function
-
getFormatterFunction
- See Also:
-
setFormatterFunction
Sets the function of theformatteroption, declared in aJsDefinitioninterface. The browser runs the function from the frontend bundle, so it works under a Content Security Policy withoutunsafe-eval.Setting a function this way clears a function set with
setFormatter(String).A chart exported to SVG with
SVGGeneratordoes not have the function. Neither does a chart state saved or restored withChartAiController.- Parameters:
formatter- the function, ornullto remove it- Since:
- 25.4
-
getRotation
- See Also:
-
setRotation
Rotation of the labels in degrees.Defaults to: 0
-
getStyle
- Since:
- 18.0
- See Also:
-
setStyle
CSS styles for the label.
In styled mode, the styles are set in the
.highcharts-stack-labelclass.Defaults to: { "color": "#000000", "fontSize": "11px", "fontWeight": "bold", "textShadow": "1px 1px contrast, -1px -1px contrast, -1px 1px contrast, 1px -1px contrast" }
- Since:
- 18.0
-
getTextAlign
- See Also:
-
setTextAlign
The text alignment for the label. Whilealigndetermines where the texts anchor point is placed with regards to the stack,textAligndetermines how the text is aligned against its anchor point. Possible values are"left","center"and"right". The default value is calculated at runtime and depends on orientation and whether the stack is positive or negative. -
getUseHTML
- See Also:
-
setUseHTML
Whether to use HTML to render the labels.Defaults to: false
-
getVerticalAlign
- See Also:
-
setVerticalAlign
Defines the vertical alignment of the stack total label. Can be one of"top","middle"or"bottom". The default value is calculated at runtime and depends on orientation and whether the stack is positive or negative. -
getX
- See Also:
-
setX
The x position offset of the label relative to the left of the stacked bar. The default value is calculated at runtime and depends on orientation and whether the stack is positive or negative. -
getY
- See Also:
-
setY
The y position offset of the label relative to the tick position on the axis. The default value is calculated at runtime and depends on orientation and whether the stack is positive or negative.
-