class anychart.standalones.Title Improve this Doc
Extends: anychart.core.ui.Title
The Title class contains methods for configuring standalones title.
Methods Overview
Specific settings | |
text() | Title text. |
Advanced Text Settings | |
fontVariant() | Font variant settings. |
letterSpacing() | Text letter spacing settings. |
textDirection() | Text direction settings. |
textIndent() | Text indent settings. |
textOverflow() | Text overflow settings. |
useHtml() | Text useHtml settings. |
wordBreak() | Word break mode. |
wordWrap() | Word-wrap mode. |
Base Text Settings | |
fontColor() | Font color settings. |
fontDecoration() | Font decoration settings. |
fontFamily() | Font family settings. |
fontOpacity() | Font opacity settings. |
fontSize() | Font size settings. |
fontStyle() | Font style settings. |
fontWeight() | Font weight settings. |
hAlign() | Text horizontal align settings. |
lineHeight() | Text line height settings. |
vAlign() | Text vertical align settings. |
Coloring | |
background() | Background settings. |
Events | |
disablePointerEvents() | Pointer events settings. |
Interactivity | |
enabled() | Element state (enabled or disabled). |
selectable() | Text selectable option. |
Size and Position | |
align() | Align settings. |
getRemainingBounds() | Returns the remaining (after title placement) part of the container. |
height() | Height settings. |
margin() | Margin settings. |
orientation() | Orientation settings. |
padding() | Padding settings. |
parentBounds() | Parent bounds settings. |
rotation() | Rotation settings. |
width() | Width settings. |
zIndex() | Z-index of the element. |
Text Settings | |
adjustFontSize() | Adjusting settings. |
maxFontSize() | Maximum font size settings. |
minFontSize() | Minimum font size settings. |
textSettings() | Text settings. |
Miscellaneous | |
container() | Getter for the title container. |
draw() | Draws title. |
Methods Description
adjustFontSize
- [false, false] - do not adjust (adjust is off )
- [true, false] - adjust width
- [false, true] - adjust height
- [true, true] - adjust the first suitable value.
Returns:
number - An adjusted font size.var adjustFontSize = title.adjustFontSize();
Note: anychart.core.ui.Title#fontSize does not work when adjusting is enabled.
Params:
Name | Type | Default | Description |
---|---|---|---|
adjustOrAdjustByWidth | boolean | Array.<boolean> | Object | true | Font needs to be adjusted in case of 1 argument and adjusted by width in case of 2 arguments. |
adjustByHeight | boolean | Font needs to be adjusted by height. |
Returns:
anychart.standalones.Title - Self instance for method chaining.align
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.enums.Align | string | 'center' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
background
Returns:
anychart.core.ui.Background - Returns the background.Try it:
- null/boolean - disable or enable title background.
- string - sets title background color value.
- object - sets title background settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | string | Object | null | boolean | false | Background settings to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.container
Try it:
Params:
Name | Type | Description |
---|---|---|
element | anychart.graphics.vector.Layer | anychart.graphics.vector.Stage | The value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
disablePointerEvents
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
draw
enabled
Returns:
boolean - Element state.var enabled = title.enabled();
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.if (!element.enabled()) element.enabled(true);
Try it:
fontColor
Returns:
string - Font color.var fontColor = title.fontColor();
https://www.w3schools.com/html/html_colors.asp
Params:
Name | Type | Description |
---|---|---|
color | string | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontDecoration
Returns:
anychart.graphics.vector.Text.Decoration | string - Font decoration.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.Decoration | string | 'none' | Font decoration to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontFamily
Params:
Name | Type | Default | Description |
---|---|---|---|
family | string | 'Verdana', Helvetica, Arial, sans-serif | Font family to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontOpacity
Params:
Name | Type | Default | Description |
---|---|---|---|
opacity | number | 1 | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontSize
Params:
Name | Type | Default | Description |
---|---|---|---|
size | string | number | 16 | Font size to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontStyle
Returns:
anychart.graphics.vector.Text.FontStyle | string - Font style.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
style | anychart.graphics.vector.Text.FontStyle | string | 'normal' | Font style to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontVariant
Returns:
anychart.graphics.vector.Text.FontVariant | string - Font variant.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.FontVariant | string | 'normal' | Font variant to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
fontWeight
Returns:
string | number - Font weight.var fontWeight = title.fontWeight();
https://www.w3schools.com/cssref/pr_font_weight.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
weight | string | number | 'normal' | Font weight to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
getRemainingBounds
Returns:
anychart.math.Rect - Parent bounds without the space used by the title.Try it:
hAlign
Returns:
anychart.graphics.vector.Text.HAlign | string - Text horizontal align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.graphics.vector.Text.HAlign | string | 'center' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
height
Params:
Name | Type | Default | Description |
---|---|---|---|
height | number | string | null | Title height to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
letterSpacing
https://www.w3schools.com/cssref/pr_text_letter-spacing.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
spacing | string | number | 'normal' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
lineHeight
https://www.w3schools.com/cssref/pr_dim_line-height.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
height | string | number | 'normal' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
margin
Returns:
anychart.core.utils.Margin - The title margin.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
allValues | string | number | Array.<(number|string)> | Object | {top: 0, right: 0, bottom: 2, left: 0} | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value1 | string | number | 0 | Top or top-bottom space. |
value2 | string | number | 0 | Right or right-left space. |
value3 | string | number | 0 | Bottom space. |
value4 | string | number | 0 | Left space. |
Returns:
anychart.standalones.Title - Self instance for method chaining.// 1) all 10px title.margin(10); // 2) top and bottom 10px, left and right 15px title.margin(10, '15px'); // 3) top 10px, left and right 15px, bottom 5px title.margin(10, '15px', 5); // 4) top 10px, right 15px, bottom 5px, left 12px title.margin(10, '15px', '5px', 12);
Try it:
maxFontSize
Returns:
number - Maximum font size.var maxFontSize = title.maxFontSize();
Params:
Name | Type | Description |
---|---|---|
size | number | string | Maximum font size to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.minFontSize
Returns:
number - Minimum font size.var minFontSize = title.minFontSize();
Params:
Name | Type | Description |
---|---|---|
size | number | string | Minimum font size to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.orientation
Returns:
anychart.enums.Orientation | string - Title orientation.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
orientation | anychart.enums.Orientation | string | 'top' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
padding
Learn more about paddings at anychart.core.Chart#padding.
Returns:
anychart.core.utils.Padding - The title padding.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
paddinge | string | number | Array.<(number|string)> | Object | {top: 0, right: 0, bottom: 2, left: 0} | Padding to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value1 | string | number | 0 | Top or top-bottom space. |
value2 | string | number | 0 | Right or right-left space. |
value3 | string | number | 0 | Bottom space. |
value4 | string | number | 0 | Left space. |
Returns:
anychart.standalones.Title - Self instance for method chaining.// 1) top and bottom 10px, left and right 15px title.padding(10, '15px'); // 2) top 10px, left and right 15px, bottom 5px title.padding(10, '15px', 5); // 3) top 10px, right 15px, bottom 5px, left 12px title.padding(10, '15px', '5px', 12);
Try it:
parentBounds
As a getter falls back to stage bounds.
Returns:
anychart.math.Rect - Parent bounds.Try it:
Params:
Name | Type | Description |
---|---|---|
bounds | anychart.math.Rect | Object | null | Parent bounds to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
left | number | Left space. |
top | number | Top space. |
width | number | A width for a title. |
height | number | A height for a title. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
rotation
Params:
Name | Type | Description |
---|---|---|
rotation | number | Rotation to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
selectable
Returns:
boolean - The text selectable option.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
text
Returns:
string - Text content of the title.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
text | string | 'Title text' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
textDirection
Returns:
anychart.graphics.vector.Text.Direction | string - Text direction.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
direction | anychart.graphics.vector.Text.Direction | string | 'ltr' | Text direction to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
textIndent
Params:
Name | Type | Default | Description |
---|---|---|---|
indent | number | 0 | Text indent to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
textOverflow
Returns:
anychart.graphics.vector.Text.TextOverflow | string - Text overflow settings.var title = chart.title(); var textOverflow = title.textOverflow();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.TextOverflow | string | "" | Text overflow settings to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
textSettings
Returns:
Object - A copy of settings object.Try it:
Params:
Name | Type | Description |
---|---|---|
name | string | Setting name. |
Returns:
string | number | boolean | undefined - Value of settings.Try it:
Params:
Name | Type | Description |
---|---|---|
objectWithSettings | Object | Settings object. Complete object looks like this:
{ 'fontSize': smth, 'fontFamily': smth, 'fontColor': smth, 'fontOpacity': smth, 'fontDecoration': smth, 'fontStyle': smth, 'fontVariant': smth, 'fontWeight': smth, 'letterSpacing': smth, 'textDirection': smth, 'lineHeight': smth, 'textIndent': smth, 'vAlign': smth, 'hAlign': smth, 'wordWrap': smth, 'wordBreak': smth, 'textOverflow': smth, 'selectable': smth, 'useHtml': smth 'textShadow':smth } |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
name | string | Setting name. |
settings | string | number | boolean | function | Text settings. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
useHtml
Returns:
boolean - Value of useHTML flag.var useHtml = title.useHtml();
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
vAlign
Returns:
anychart.graphics.vector.Text.VAlign | string - Text vertical align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.graphics.vector.Text.VAlign | string | 'top' | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
width
Params:
Name | Type | Default | Description |
---|---|---|---|
width | number | string | null | Title width to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
wordBreak
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.WordBreak | string | "normal" | Word-break mode to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
wordWrap
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.WordWrap | string | 'normal' | Word-wrap mode to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it:
zIndex
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.standalones.Title - Self instance for method chaining.Try it: