AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.gantt.TimeLineHeader Improve this Doc

Extends: anychart.core.VisualBaseWithBounds

Resource Chart Timeline element.

Methods Overview

Specific Settings
level()Level option.
Specific settings
drawBottomLine()Drawing of the bottom line.
drawLeftLine()Drawing of the left line.
drawRightLine()Drawing of the right line.
drawTopLine()Drawing of the top line.
format()Function to format content text.
holidays()Padding settings
overlay()Overlay element.
Advanced Text Settings
maxFontSize()Maximum font size settings.
minFontSize()Minimum font size settings.
Coloring
background()Background settings.
fill()Fill settings.
stroke()Stroke settings.
Content Text Settings
useHtml()Use HTML option.
vAlign()Text vertical align settings.
Events
listen()Adds an event listener
listenOnce()Adds a single time event listener
removeAllListeners()Removes all listeners
unlisten()Removes the listener
unlistenByKey()Removes the listener by the key
Export
print()Prints all elements.
Interactivity
enabled()Element state (enabled or disabled).
Size and Position
bottom()Bottom bound settings.
getPixelBounds()Returns pixel bounds.
height()Height settings.
left()Left bound settings.
maxHeight()Maximum height.
maxWidth()Maximum width.
minHeight()Minimum height.
minWidth()Minimum width.
padding()Padding settings
right()Right bound settings.
top()Top bound settings.
width()Width settings.
zIndex()Z-index of the element.
Text Settings
adjustFontSize()Adjusting settings.
disablePointerEvents()Pointer events settings.
fontColor()Font color settings.
fontDecoration()Font decoration setting.
fontFamily()Font family settings.
fontOpacity()Font opacity settings.
fontSize()Font size settings.
fontStyle()Font style settings.
fontVariant()Font variant settings.
fontWeight()Font weight settings.
hAlign()Text horizontal align settings.
letterSpacing()Text letter spacing settings.
lineHeight()Text line height setting.
selectable()Text selectable option.
textDirection()Text direction settings.
textIndent()Text indent settings.
textOverflow()Text overflow settings.
wordBreak()Word break mode.
wordWrap()Word-wrap mode.
Miscellaneous
levelHeight()Getter for the level height.

Methods Description

adjustFontSize

Getter for the adjusting font size.

Returns:

number - An adjusted font size.
See listing
var timeLine = chart.timeLine();
var adjustFontSize = timeLine.adjustFontSize();
Setter for the adjusting font size.

Params:

NameTypeDescription
adjustOrAdjustByWidthboolean | Array.<boolean> | ObjectIs font needs to be adjusted in case of 1 argument and adjusted by width in case of 2 arguments.
adjustByHeightbooleanIs font needs to be adjusted by height.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

background

Getter for the background.

Returns:

anychart.core.ui.Background - Background settings.
Setter for the background.

Params:

NameTypeDescription
settingsstring | Object | null | booleanBackground settings to set

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

bottom

Getter for element bottom bound settings.

Returns:

number | string | undefined - Element's bottom bound setting.
Setter for element bottom bound settings.

Params:

NameTypeDefaultDescription
bottomnumber | string | null
null
Bottom bound settings for the element.

Returns:

anychart.core.gantt.TimeLineHeader - Returns self for method chaining.

disablePointerEvents

Getter for the pointer events settings.

Returns:

boolean - The pointer events settings.
See listing
var timeLine = chart.getTimeline();
var disablePointerEvents = timeLine.disablePointerEvents();
Setter for the pointer events setting.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

drawBottomLine

Getter for the bottom line drawing flag.

Returns:

boolean - Drawing flag.
See listing
var timeline = chart.getTimeline();
var flag = timeline.drawBottomLine();
Setter for the bottom line drawing flag.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.resource.Grid - Self instance for method chaining.

drawLeftLine

Getter for the left line drawing flag.

Returns:

boolean - Drawing flag.
See listing
var timeline = chart.getTimeline();
var flag = timeline.drawLeftLine();
Setter for the left line drawing flag.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.resource.Grid - Self instance for method chaining.

drawRightLine

Getter for the right line drawing flag.

Returns:

boolean - Drawing flag.
See listing
var timeline = chart.timeline();
var flag = timeline.drawRightLine();
Setter for the right line drawing flag.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.resource.Grid - Self instance for method chaining.

drawTopLine

Getter for the top line drawing flag.

Returns:

boolean - Drawing flag.
See listing
var timeline = chart.timeline();
var flag = timeline.drawTopLine();
Setter for the top line drawing flag.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.resource.Grid - Self instance for method chaining.

enabled

Getter for the element state (enabled or disabled).

Returns:

boolean - Element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
enabledboolean
true
Enabled state to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Example.
if (!element.enabled())
   element.enabled(true);

fill

Getter for the fill color.

Returns:

anychart.graphics.vector.Fill - The fill color.
See listing
var timeLine = chart.timeLine();
var fill = timeLine.fill();
Setter for fill settings using an array or a string. Learn more about coloring.

Params:

NameTypeDescription
coloranychart.graphics.vector.Fill | Array.<(anychart.graphics.vector.GradientKey|string)>Color as an object, an array or a string.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Fill color with opacity.

Params:

NameTypeDescription
colorstringColor as a string.
opacitynumberColor opacity.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Linear gradient fill. Learn more about coloring.

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Gradient keys.
anglenumberGradient angle.
modeboolean | anychart.graphics.vector.Rect | ObjectGradient mode.
opacitynumberGradient opacity.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Radial gradient fill. Learn more about coloring.

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Color-stop gradient keys.
cxnumberX ratio of center radial gradient.
cynumberY ratio of center radial gradient.
modeanychart.graphics.math.RectIf defined then userSpaceOnUse mode, else objectBoundingBox.
opacitynumberOpacity of the gradient.
fxnumberX ratio of focal point.
fynumberY ratio of focal point.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

Params:

NameTypeDescription
imageSettingsanychart.graphics.vector.FillObject with settings.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontColor

Getter for font color settings.

Returns:

string - Font color settings.
See listing
var timeLine = chart.getTimeline();
var fontColor = timeLine.fontColor();
Setter for font color settings.

Params:

NameTypeDescription
colorstringFont color to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontDecoration

Getter for font decoration settings.

Returns:

anychart.graphics.vector.Text.Decoration - Font decoration settings.
See listing
var timeLine = chart.getTimeline();
var fontDecoration = timeLine.fontDecoration();
Setter for font decoration settings.

Params:

NameTypeDescription
typeanychart.graphics.vector.Text.Decoration | stringFont decoration to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontFamily

Getter for font family settings.

Returns:

string - Font family settings.
See listing
var timeLine = chart.getTimeline();
var fontFamily = timeLine.fontFamily();
Setter for font family settings.

Params:

NameTypeDefaultDescription
fontFamilystring
'Helvetica Neue', Helvetica, sans-serif
Font family to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontOpacity

Getter for font opacity settings.

Returns:

number - Font opacity settings.
See listing
var timeLine = chart.getTimeline();
var fontOpacity = timeLine.fontOpacity();
Setter for font opacity settings.

Params:

NameTypeDescription
opacitynumberFont opacity to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontSize

Getter for font size settings.

Returns:

number - Font size settings.
Example
var timeline = chart.getTimeline();
var fontSize = timeline.fontSize();
Setter for font size settings.

Params:

NameTypeDefaultDescription
sizenumber | string
11
Font size to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontStyle

Getter for font style settings.

Returns:

anychart.graphics.vector.Text.FontStyle - Font style settings.
See listing
var timeLine = chart.getTimeline();
var fontStyle = timeLine.fontStyle();
Setter for font style settings.

Params:

NameTypeDescription
stylestring | anychart.graphics.vector.Text.FontStyleFont style to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontVariant

Getter for font variant settings.

Returns:

anychart.graphics.vector.Text.FontVariant - Font variant settings.
See listing
var timeLine = chart.getTimeline();
var fontVariant = timeLine.fontVariant();
Setter for font variant settings.

Params:

NameTypeDescription
typestring | anychart.graphics.vector.Text.FontVariantFont variant to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

fontWeight

Getter for font weight settings.

Returns:

string | number - Font weight settings.
See listing
var timeLine = chart.getTimeline();
var fontWeight = timeLine.fontWeight();
Setter for font weight settings.

Params:

NameTypeDescription
weightstring | numberFont weight to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

format

Getter for the function content text.

Returns:

function | string - Token or function to format text.
See listing
var format = timeLine.format();
Setter for the function content text.
Learn more about using the format() method.

Params:

NameTypeDescription
formatfunction | stringFunction or string token to format content text.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

getPixelBounds

Returns pixel bounds of the element due to parent bounds and self bounds settings.

Returns:

anychart.math.Rect - Pixel bounds of the element.

hAlign

Getter for text horizontal align settings.

Returns:

anychart.graphics.vector.Text.HAlign - Horizontal align settings.
See listing
var timeLine = chart.getTimeline();
var hAlign = timeLine.hAlign();
Setter for the text horizontal align settings.

Params:

NameTypeDescription
alignstring | anychart.graphics.vector.Text.HAlignValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

height

Getter for element height settings.

Returns:

number | string | undefined - Element's height setting.
Setter for element height setting.

Params:

NameTypeDefaultDescription
heightnumber | string | null
null
Height settings for the element.

Returns:

anychart.core.gantt.TimeLineHeader - Returns self for method chaining.

holidays

Setter for holidays settings.

Params:

NameTypeDescription
settingsObjectValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

left

Getter for element left bound settings.

Returns:

number | string | undefined - Element's left bound setting.
Setter for element left bound settings.

Params:

NameTypeDefaultDescription
leftnumber | string | null
null
Left bound setting for the element.

Returns:

anychart.core.gantt.TimeLineHeader - Returns self for method chaining.

letterSpacing

Getter for text letter spacing settings.

Returns:

number - Letter spacing settings.
See listing
var timeLine = chart.getTimeline();
var letterSpacing = timeLine.letterSpacing();
Setter for text letter spacing settings.

Params:

NameTypeDescription
spacingnumber | stringLetter spacing to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

level

Getter for level settings.

Params:

NameTypeDefaultDescription
indexnumber
0
Level index.
Setter for level settings.

Params:

NameTypeDefaultDescription
settingsObject | boolean | null
true
Level settings from anychart.core.gantt.TimeLineHeader.LevelWrapper

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Setter for level settings by index.

Params:

NameTypeDefaultDescription
indexnumber
0
Level index.
settingsObject | boolean | null
true
Level settings from anychart.core.gantt.TimeLineHeader.LevelWrapper

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

levelHeight

Getter for the level height.

Returns:

number - The level height.
See listing
var header = timeline.header();
var levelHeight = header.levelHeight();
Setter for the level height.

Params:

NameTypeDescription
heightnumberLevel height.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

lineHeight

Getter for text line height settings.

Returns:

number | string - Line height settings.
See listing
var timeLine = chart.getTimeline();
var lineHeight = timeLine.lineHeight();
Setter for text line height settings.

Params:

NameTypeDefaultDescription
heightnumber | string
'normal'
Value to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method. Function that looks like:
function(event){
   // event.actualTarget - actual event target
   // event.currentTarget - current event target
   // event.iterator - event iterator
   // event.originalEvent - original event
   // event.point - event point
   // event.pointIndex - event point index
}
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

maxFontSize

Getter for the maximum font size.

Returns:

number - Maximum font size.
See listing
var maxFontSize = timeLine.maxFontSize();
Setter for the maximum font size.

Params:

NameTypeDescription
sizenumber | stringMaximum font size to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

maxHeight

Getter for the maximum height.

Returns:

number | string | null - Element's maximum height.
Setter for the maximum height.

Params:

NameTypeDefaultDescription
heightnumber | string | null
null
Maximum height to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

maxWidth

Getter for the maximum width.

Returns:

number | string | null - Element's maximum width.
Setter for the maximum width.

Params:

NameTypeDefaultDescription
widthnumber | string | null
null
Maximum width to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

minFontSize

Getter for the minimum font size.

Returns:

number - Minimum font size.
See listing
var minFontSize = timeLine.minFontSize();
Setter for the minimum font size.

Params:

NameTypeDescription
sizenumber | stringMinimum font size to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

minHeight

Getter for the minimum height.

Returns:

number | string | null - Element's minimum height.
Setter for the minimum height.

Params:

NameTypeDefaultDescription
heightnumber | string | null
null
Minimum height to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

minWidth

Getter for the minimum width.

Returns:

number | string | null - Element's minimum width.
Setter for the minimum width.

Params:

NameTypeDefaultDescription
widthnumber | string | null
null
Minimum width to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

overlay

Getter for the overlay element.

Returns:

anychart.core.gantt.Overlay - Overlay element.
See listing
var element = timeLine.overlay();
Setter for the overlay element.

Params:

NameTypeDescription
settingsObject | null | booleanValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

padding

Getter for the padding.

Returns:

anychart.core.utils.Padding - Padding.
Setter for paddings in pixels using a single value.

Params:

NameTypeDescription
paddingnull | Array.<(number|string)> | ObjectValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Examples for paddings
// all paddings 15px
timeLine.padding(15);
// all paddings 15px
timeLine.padding('15px');
// top and bottom 5px ,right and left 15px
timeLine.padding(anychart.utils.padding(5,15));
Setter for paddings in pixels using several numbers.

Params:

NameTypeDescription
value1string | numberTop or top-bottom space.
value2string | numberRight or right-left space.
value3string | numberBottom space.
value4string | numberLeft space.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Examples for paddings
// 1) top and bottom 10px, left and right 15px
timeLine.padding(10, '15px');
// 2) top 10px, left and right 15px, bottom 5px
timeLine.padding(10, '15px', 5);
// 3) top 10px, right 15px, bottom 5px, left 12px
timeLine.padding(10, '15px', '5px', 12);

print

Prints all elements on related stage.

Params:

NameTypeDefaultDescription
paperSizeOrOptionsanychart.graphics.vector.PaperSize | Object
Paper size or object with options.
landscapeboolean
false
Flag of landscape.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.
Getter for element right bound settings.

Returns:

number | string | undefined - Element's right bound setting.
Setter for element right bound setting.

Params:

NameTypeDefaultDescription
rightnumber | string | null
null
Right bound setting for the element.

Returns:

anychart.core.gantt.TimeLineHeader - Returns self for method chaining.

selectable

Getter for the text selectable option.

Returns:

boolean - Text selectable value.
See listing
var timeLine = chart.getTimeline();
var selectable = timeLine.selectable();
Setter for the text selectable option.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

stroke

Getter for the stroke.

Returns:

anychart.graphics.vector.Stroke - The stroke.
See listing
var timeLine = chart.timeLine();
var stroke = timeLine.stroke();
Setter for the stroke. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinstring | anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapstring | anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
Setter for stroke settings using an object.

Params:

NameTypeDescription
settingsObjectObject with stroke settings from anychart.graphics.vector.Stroke

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

textDirection

Getter for the text direction settings.

Returns:

anychart.graphics.vector.Text.Direction - Text direction settings.
See listing
var timeLine = chart.getTimeline();
var textDirection = timeLine.textDirection();
Setter for text direction settings.

Params:

NameTypeDescription
typestring | anychart.graphics.vector.Text.DirectionValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

textIndent

Getter for text-indent settings.

Returns:

number - Text indent settings.
See listing
var timeLine = chart.getTimeline();
var textIndent = timeLine.textIndent();
Setter for text-indent settings.

Params:

NameTypeDescription
indentnumberValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

textOverflow

Getter for text overflow settings.

Returns:

anychart.graphics.vector.Text.TextOverflow - Text overflow settings
See listing
var timeLine = chart.getTimeline();
var textOverflow = timeLine.textOverflow();
Setter for text overflow settings.

Params:

NameTypeDescription
valueanychart.graphics.vector.Text.TextOverflow | stringValue to set

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

top

Getter for element top bound settings.

Returns:

number | string | undefined - Element's top bound setting.
Setter for element top bound settings.

Params:

NameTypeDefaultDescription
topnumber | string | null
null
Top bound setting for the element.

Returns:

anychart.core.gantt.TimeLineHeader - Returns self for method chaining.

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object):boolean|undefined
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

NameTypeDescription
keyObjectThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

useHtml

Getter for the useHTML flag.

Returns:

boolean - UseHTML flag.
See listing
var timeLine = chart.getTimeline();
var useHtml = timeLine.useHtml();
Setter for the useHTML flag.

Params:

NameTypeDescription
enabledbooleanValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

vAlign

Getter for text vertical align settings.

Returns:

anychart.graphics.vector.Text.VAlign - Vertical align.
See listing
var timeLine = chart.getTimeline();
var vAlign = timeLine.vAlign();
Setter for text vertical align settings.

Params:

NameTypeDescription
alignstring | anychart.graphics.vector.Text.VAlignValue to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.

width

Getter for element width settings.

Returns:

number | string | undefined - Element's width setting.
Setter for element width setting.

Params:

NameTypeDefaultDescription
widthnumber | string | null
null
Width settings for the element.

Returns:

anychart.core.gantt.TimeLineHeader - Returns self for method chaining.

wordBreak

Getter for the word-break mode.

Returns:

anychart.enums.WordBreak | string - Word-break mode.
See listing
var wordWrap = timeLine.wordBreak();
Setter for the word-break mode.

Params:

NameTypeDefaultDescription
typeanychart.enums.WordBreak | string
'normal'
Value to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
See listing
timeLine.wordBreak('break-all');

wordWrap

Getter for the word-wrap mode.

Returns:

anychart.enums.WordWrap | string - Word-wrap mode.
See listing
var wordWrap = timeLine.wordWrap();
Setter for the word-wrap mode.

Params:

NameTypeDefaultDescription
typeanychart.enums.WordWrap | string
'normal'
Value to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.
See listing
timeLine.wordWrap('break-word');

zIndex

Getter for the Z-index of the element.

Returns:

number - Z-index.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
zIndexnumber
0
Value to set.

Returns:

anychart.core.gantt.TimeLineHeader - Self instance for method chaining.