Top
You are looking at an outdated 7.1.1 version of this document. Switch to the 8.0.1 version to see the up to date information.

class anychart.elements.Title Improve this Doc

Extends: anychart.elements.Text

Title element class.
Title can be a part of an other complex element, such as a chart, a legend or an axis, as well a self-sufficient element.
A title have a positione, text alignment and a background.

Try it:

Methods Overview

Miscellaneous
align()Getter for the title align.
background()Getter for the title background.
draw()Render the title content.
getRemainingBounds()Returns the remaining (after title placement) part of the container.
height()Getter for the title height.
margin()Getter for the current title margin.
orientation()Getter for the title orientation.
padding()Getter for the current title padding.
parentBounds()Returns bounds for positioning.
text()Gets the text content for the current title.
width()Getter for the title width.

Methods Description

align

Getter for the title align.

Returns:

anychart.enums.Align - The current title align.
Setter for the title align.

Params:

Name Type Default Description
value anychart.enums.Align | string
anychart.enums.Align.CENTER
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

background

Getter for the title background.

Returns:

anychart.elements.Background - Returns the current background.

Try it:

Setter for the title background.

Params:

Name Type Default Description
value anychart.elements.Background
null
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

draw

Render the title content.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

getRemainingBounds

Returns the remaining (after title placement) part of the container.

Returns:

anychart.math.Rect - Parent bounds without the space used by the title.

Try it:

height

Getter for the title height.

Returns:

number string null - The current title width.
Setter for the title height.
Note: If null is passed the height is calcualted automatically.

Params:

Name Type Default Description
value number | string | null
null
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

margin

Getter for the current title margin.
Learn more about margins at anychart.Chart#margin.

Returns:

anychart.utils.Margin - The current title margin.
Setter for the title margin in pixels using one value.

Params:

Name Type Description
allValues string | number | anychart.utils.Space Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.
Setter for the title margin in pixels using several numbers.

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
10
Bottom space.
value4 string | number
0
Left space.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

orientation

Getter for the title orientation.

Returns:

anychart.enums.Orientation - The orientation or the title for method chaining.
Setter for the title orientation.

Params:

Name Type Default Description
value anychart.enums.Orientation | string
anychart.enums.Orientation.TOP
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

padding

Getter for the current title padding.
Learn more about paddings at anychart.Chart#padding.

Returns:

anychart.utils.Padding - The current title padding.
Setter for the title padding in pixels using single value.

Params:

Name Type Default Description
value string | number | anychart.utils.Space
null
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.
Setter for the title padding in pixels using several numbers.

Params:

Name Type Description
value1 string | number Top or top-bottom space.
value2 string | number Right or right-left space.
value3 string | number Bottom space.
value4 string | number Left space.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

parentBounds

Returns bounds for positioning.

Returns:

anychart.math.Rect - Current parent bounds.
Sets bound for positioning.

Params:

Name Type Default Description
value anychart.math.Rect
null
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

text

Gets the text content for the current title.

Returns:

string - The current text content of the title.
Sets the text content for the title.

Params:

Name Type Default Description
value string
'Title text'
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it:

width

Getter for the title width.

Returns:

number string null - The current title width.
Setter for the title width.
Note: If null is passed the width is calcualted automatically.

Params:

Name Type Default Description
value number | string | null
null
Value to set.

Returns:

anychart.elements.Title - An instance of anychart.elements.Title class for method chaining.

Try it: