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

class anychart.core.ui.Title Improve this Doc

Extends: anychart.core.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.
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.
rotation()Title rotation. Set null or NaN to automatic rotation due to title orientation.
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.core.ui.Title - Self instance for method chaining.

Try it:

background

Getter for the title background.

Returns:

anychart.core.ui.Background - Returns the current background.

Try it:

Setter for the title background.

Params:

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

Returns:

anychart.core.ui.Title - Self instance for method chaining.

Try it:

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.core.ui.Title - Self instance for method chaining.
Example
title.height('200px');

margin

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

Returns:

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

Params:

Name Type Description
allValues Array.<(number|string)> | Object Value to set.

Returns:

anychart.core.ui.Title - Self instance 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.core.ui.Title - Self instance for method chaining.
Example
// 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);

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.core.ui.Title - Self instance for method chaining.

Try it:

padding

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

Returns:

anychart.core.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.core.utils.Space
null
Value to set.

Returns:

anychart.core.ui.Title - Self instance 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.core.ui.Title - Self instance for method chaining.
Example
// 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);

rotation

Title rotation. Set null or NaN to automatic rotation due to title orientation.

Params:

Name Type Description
value number

Returns:

anychart.core.ui.Title number -

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.core.ui.Title - Self instance 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.core.ui.Title - Self instance for method chaining.
Example
title.width('200px');