AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.ui.table.Cell Improve this Doc

Extends: anychart.core.ui.table.Base

Table cell.

Methods Overview

Specific settings
content()Cell content settings.
Advanced Text Settings
fontVariant()Text font variant settings.
letterSpacing()Text letter spacing settings.
textDirection()Text direction settings.
textIndent()Text line height settings.
textOverflow()Text overflow settings.
useHtml()Text useHtml settings.
wordBreak()Word break mode.
wordWrap()Word-wrap mode.
Base Text Settings
fontColor()Text font color settings.
fontDecoration()Text font decoration settings.
fontFamily()Text font family settings.
fontOpacity()Text font opacity settings.
fontSize()Text font size settings.
fontStyle()Text font style settings.
fontWeight()Text font weight settings.
hAlign()Text horizontal align settings.
lineHeight()Text line height settings.
textShadow()Text font color settings.
vAlign()Text vertical align settings.
Coloring
border()Cell border settings.
fill()Fill settings.
Events
disablePointerEvents()Disable pointer events settings.
Interactivity
selectable()Text selectable option.
Size and Position
padding()Padding settings.
Miscellaneous
colSpan()Cell columns span settings.
getBounds()Returns cell bounds without padding counted (bounds which are used for borders drawing).
getCol()Returns cell column instance.
getColNum()Returns cell column number.
getRow()Returns cell row instance.
getRowNum()Returns cell row number.
rowSpan()Rows columns span settings.

Methods Description

border

Getter for cell border settings.

Returns:

anychart.core.ui.table.Border - Stroke settings.
Setter for cell border settings. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | 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.ui.table.Cell - Self instance for method chaining.

colSpan

Getter for cell columns span.

Returns:

number - Columns span.
Setter for cell columns span.

Params:

NameTypeDefaultDescription
countnumber
1
Count of cells to merge right.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

content

Getter for the cell content.

Returns:

anychart.graphics.vector.Element | anychart.core.VisualBase | string | number - The cell content.
Setter for the cell content.

Params:

NameTypeDescription
settingsanychart.graphics.vector.Element | anychart.core.VisualBase | string | numberCell content to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

disablePointerEvents

Getter for the state of disablePointerEvents option.

Returns:

boolean - If pointer events are disabled.
Setter for the text disablePointerEvents option.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fill

Getter for cell fill color.

Returns:

anychart.graphics.vector.Fill - Cell fill color.
Sets fill settings using an object, an array or a string. Learn more about coloring.

Params:

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

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.
Fill color with opacity. Fill as a string or an object.

Params:

NameTypeDescription
colorstringColor as a string.
opacitynumberColor opacity.

Returns:

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

Params:

NameTypeDescription
imageSettingsanychart.graphics.vector.FillObject with settings.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontColor

Getter for the text font color.

Returns:

string - Font color.
Setter for the text font color. https://www.w3schools.com/html/html_colors.asp

Params:

NameTypeDescription
colorstringFont color to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontDecoration

Getter for the text font decoration.

Returns:

anychart.graphics.vector.Text.Decoration | string - Font decoration.
Setter for the text font decoration.

Params:

NameTypeDefaultDescription
typeanychart.graphics.vector.Text.Decoration | string
anychart.graphics.vector.Text.Decoration#NONE
Font decoration to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontFamily

Getter for the font family.

Returns:

string - Font family.
Setter for the font family.

Params:

NameTypeDescription
familystringFont family to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontOpacity

Getter for the text font opacity.

Returns:

number - Font opacity.
Setter for the text font opacity. Double value from 0 to 1.

Params:

NameTypeDefaultDescription
opacitynumber
1
Font opacity to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontSize

Getter for text font size.

Returns:

string | number - Font size.
See listing
var vAlign = cell.vAlign();
Setter for text font size.

Params:

NameTypeDescription
sizestring | numberFont size to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontStyle

Getter for the text font style.

Returns:

anychart.graphics.vector.Text.FontStyle | string - Font style.
Setter for the text font style.

Params:

NameTypeDefaultDescription
styleanychart.graphics.vector.Text.FontStyle | string
anychart.graphics.vector.Text.FontStyle#NORMAL
Font style to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontVariant

Getter for the text font variant.

Returns:

anychart.graphics.vector.Text.FontVariant | string - Font variant.
Setter for the text font variant.

Params:

NameTypeDefaultDescription
typeanychart.graphics.vector.Text.FontVariant | string
anychart.graphics.vector.Text.FontVariant#NORMAL
Font variant to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

fontWeight

Getter for the text font weight.

Returns:

string | number - Font weight.

Params:

NameTypeDescription
weightstring | numberValue to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

getBounds

Returns cell bounds without padding counted (bounds which are used for borders drawing).

Returns:

anychart.math.Rect - Cell bounds.

getCol

Returns cell column instance.

Returns:

anychart.core.ui.table.Column - Cell column instance.

getColNum

Returns cell column number.

Returns:

number - Cell column number.

getRow

Returns cell row instance.

Returns:

anychart.core.ui.table.Row - Cell row instance.

getRowNum

Returns cell row number.

Returns:

number - Cell row number.

hAlign

Getter for the text horizontal align.

Returns:

anychart.graphics.vector.Text.HAlign | string - Text horizontal align.
See listing
var hAlign = cell.hAlign();
Setter for the text horizontal align.

Params:

NameTypeDefaultDescription
alignanychart.graphics.vector.Text.HAlign | string
anychart.graphics.vector.Text.HAlign#START
Horizontal align to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

letterSpacing

Getter for the text letter spacing.

Returns:

string | number - The letter spacing.

Params:

NameTypeDescription
spacingstring | numberLetter spacing to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

lineHeight

Getter for the text line height.

Returns:

string | number - Text line height.

Params:

NameTypeDescription
heightstring | numberLine height to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

padding

Setter for cell paddings in pixels using a single value.

Params:

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

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.
Examples for paddings
// all paddings 15px
cell.padding(15);
// all paddings 15px
cell.padding('15px');
// top and bottom 5px ,right and left 15px
cell.padding(anychart.utils.padding(5,15));
Setter for cell 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.ui.table.Cell - Self instance for method chaining.
Examples for paddings
// 1) top and bottom 10px, left and right 15px
cell.padding(10, '15px');
// 2) top 10px, left and right 15px, bottom 5px
cell.padding(10, '15px', 5);
// 3) top 10px, right 15px, bottom 5px, left 12px
cell.padding(10, '15px', '5px', 12);

rowSpan

Getter for cell rows span.

Returns:

number - Rows span.
Setter for cell rows span.

Params:

NameTypeDefaultDescription
countnumber
1
Count of cells to merge down.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

selectable

Getter for the text selectable option.

Returns:

boolean - Text selectable option.
Setter for the text selectable.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

textDirection

Getter for the text direction.

Returns:

anychart.graphics.vector.Text.Direction | string - Text direction.
Setter for the text direction.

Params:

NameTypeDefaultDescription
typeanychart.graphics.vector.Text.Direction | string
anychart.graphics.vector.Text.Direction#LTR
Text direction to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

textIndent

Getter for the text indent.

Returns:

number - Text indent.
Setter for the text indent.

Params:

NameTypeDescription
indentnumberText indent to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

textOverflow

Getter for the text overflow settings.

Returns:

anychart.graphics.vector.Text.TextOverflow | string - Text overflow settings.
Setter for the text overflow settings.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Text.TextOverflow | string
anychart.graphics.vector.Text.TextOverflow#CLIP
Value to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

textShadow

Getter for the text shadow.

Returns:

string - String representation of text shadow.
Setter for the text shadow.

Params:

NameTypeDefaultDescription
textShadowanychart.graphics.vector.TextShadow | string
'none'
Text shadow to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

useHtml

Getter for the useHtml flag.

Returns:

boolean - Value of useHTML flag.
Setter for flag useHtml.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

vAlign

Getter for the text vertical align.

Returns:

anychart.graphics.vector.Text.VAlign | string - Text vertical align.
See listing
var vAlign = cell.vAlign();
Setter for the text vertical align.

Params:

NameTypeDefaultDescription
alignanychart.graphics.vector.Text.VAlign | string
anychart.graphics.vector.Text.VAlign#TOP
Vertical align to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

wordBreak

Getter for the word-break mode.

Returns:

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

Params:

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

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.

wordWrap

Getter for the word-wrap mode.

Returns:

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

Params:

NameTypeDefaultDescription
modeanychart.enums.WordWrap | string
'break-word'
Value to set.

Returns:

anychart.core.ui.table.Cell - Self instance for method chaining.