Class CrosshairLabel
- All Implemented Interfaces:
Serializable
A label on the axis next to the crosshair.
In
styled mode, the label is styled with the
.highcharts-crosshair-label class.
- Since:
- 6.0.1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlign()getShape()voidsetAlign(HorizontalAlign align) Alignment of the label compared to the axis.voidsetBackgroundColor(Color backgroundColor) The background color for the label.voidsetBorderColor(Color borderColor) The border color for the crosshair labelvoidsetBorderRadius(Number borderRadius) The border corner radius of the crosshair label.voidsetBorderWidth(Number borderWidth) The border width for the crosshair label.voidsetEnabled(Boolean enabled) voidA format string for the crosshair 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.voidsetPadding(Number padding) Padding inside the crosshair label.voidThe shape to use for the label box.
-
Constructor Details
-
CrosshairLabel
public CrosshairLabel() -
CrosshairLabel
-
-
Method Details
-
getAlign
- See Also:
-
setAlign
Alignment of the label compared to the axis. Defaults toleftfor right-side axes,rightfor left-side axes andcenterfor horizontal axes. -
getBackgroundColor
- Since:
- 18.0
- See Also:
-
setBackgroundColor
The background color for the label. Defaults to the related series color, or#666666if that is not available.- Since:
- 18.0
-
getBorderColor
- Since:
- 18.0
- See Also:
-
setBorderColor
The border color for the crosshair label- Since:
- 18.0
-
getBorderRadius
- See Also:
-
setBorderRadius
The border corner radius of the crosshair label.Defaults to: 3
-
getBorderWidth
- Since:
- 18.0
- See Also:
-
setBorderWidth
The border width for the crosshair label.Defaults to: 0
- Since:
- 18.0
-
getFormat
- See Also:
-
setFormat
A format string for the crosshair label. Defaults to{value}for numeric axes and{value:%b %d, %Y}for datetime axes. -
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
-
getPadding
- See Also:
-
setPadding
Padding inside the crosshair label.Defaults to: 8
-
getShape
- See Also:
-
setShape
The shape to use for the label box.Defaults to: callout
-
getEnabled
- See Also:
-
setEnabled
-