AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.7.0 version of this document. Switch to the 8.2.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 orientation, text alignment and a background.

Title occupies the whole part of a container (depending on the orientation by the width or the height).

Try it:

Methods Overview

Specific settings
text()Title text.
Coloring
background()Background settings.
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.
rotation()Rotation settings.
width()Width settings.

Methods Description

align

Getter for the title align.

Returns:

anychart.enums.Align - The current title align.

Try it:

Setter for the title align.

Params:

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

Returns:

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

Try it:

background

Getter for the current 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
false
Value to set.

Returns:

anychart.core.ui.Title - Self instance 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 current title height.

Returns:

number string null - The current title width.

Try it:

Setter for the title height.

Params:

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

Returns:

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

Try it:

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 Default Description
allValues Array.<(number|string)> | Object
{top: 0, right: 0, bottom: 2, left: 0}
Value to set.

Returns:

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

Try it:

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
0
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);

Try it:

orientation

Getter for the current title orientation.

Returns:

anychart.enums.Orientation - The current orientation.

Try it:

Setter for the title orientation.

Params:

Name Type Default Description
value anychart.enums.Orientation | string
"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
{top: 0, right: 0, bottom: 2, left: 0}
Value to set.

Returns:

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

Try it:

Setter for the title padding 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
0
Bottom space.
value4 string | number
0
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);

Try it:

rotation

Getter for the current title rotation.

Returns:

number - The current rotation.

Try it:

Setter for the title rotation.

Params:

Name Type Description
value number Value to set.

Returns:

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

Try it:

Setter for the title rotation.

Params:

Name Type Description
value number Value to set.

Returns:

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

Try it:

text

Gets the text content for the current title.

Returns:

string - The current text content of the title.

Try it:

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.

Try it:

Setter for the title width.

Params:

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

Returns:

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

Try it: