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

class anychart.core.ui.Table Improve this Doc

Extends: anychart.core.VisualBaseWithBounds

Declares table element.
Note: Better to use methods in anychart.ui.table.

Methods Overview

Miscellaneous
cellBorder()Setter for cell border settings.
cellBottomBorder()Setter for cell bottom border settings.
cellEvenFill()Fill as a string or an object.
cellFill()Fill as a string or an object.
cellLeftBorder()Setter for cell left border settings.
cellOddFill()Fill as a string or an object.
cellPadding()Getter for the cell padding settings.
cellRightBorder()Setter for cell right border settings.
cellTextFactory()Setter for table cell text factory.
cellTopBorder()Setter for cell top border settings.
colWidth()Getter for column width settings.
colsCount()Getter for table columns count.
contents()Getter for table content.
draw()Draws the table.
getCell()Returns cell by its row and column number.
rowHeight()Getter for row height settings.
rowsCount()Getter for table rows count.

Methods Description

cellBorder

Getter for current cell border settings.

Returns:

anychart.graphics.vector.Stroke - Current stroke settings.
Setter for cell border settings.
Learn more about stroke settings: https://docs.anychart.com/7.3.0/General_settings/Elements_Stroke
Note: The last usage of leftBorder(), rightBorder(), topBorder() and bottomBorder() methods determines the border for the corresponding side.
Note: lineJoin settings not working here.

Params:

Name Type Default Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Fill settings or stroke settings.
thickness number
1
Line thickness.
dashpattern string
Controls the pattern of dashes and gaps used to stroke paths.
lineJoin anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCap anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellBottomBorder

Getter for current cell bottom border settings.

Returns:

anychart.graphics.vector.Stroke - Current stroke settings.
Setter for cell bottom border settings.
Learn more about stroke settings: https://docs.anychart.com/7.3.0/General_settings/Elements_Stroke
Note: The last usage of leftBorder(), rightBorder(), topBorder() and bottomBorder() methods determines the border for the corresponding side.
Note: lineJoin settings not working here.

Params:

Name Type Default Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Fill settings or stroke settings.
thickness number
1
Line thickness.
dashpattern string
Controls the pattern of dashes and gaps used to stroke paths.
lineJoin anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCap anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellEvenFill

Getter for current series fill color.

Returns:

anychart.graphics.vector.Fill - Current fill color.
Sets fill settings using an object or a string.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
null
Color as an object or a string.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.
Fill color with opacity.
Note: If color is set as a string (e.g. 'red .5') it has a priority over opt_opacity, which means: color set like this rect.fill('red 0.3', 0.7) will have 0.3 opacity.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Linear gradient fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Radial gradient fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Image fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellFill

Getter for current series fill color.

Returns:

anychart.graphics.vector.Fill - Current fill color.
Sets fill settings using an object or a string.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
null
Color as an object or a string.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.
Fill color with opacity.
Note: If color is set as a string (e.g. 'red .5') it has a priority over opt_opacity, which means: color set like this rect.fill('red 0.3', 0.7) will have 0.3 opacity.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Linear gradient fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Radial gradient fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Image fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellLeftBorder

Getter for current cell left border settings.

Returns:

anychart.graphics.vector.Stroke - Current stroke settings.
Setter for cell left border settings.
Learn more about stroke settings: https://docs.anychart.com/7.3.0/General_settings/Elements_Stroke
Note: The last usage of leftBorder(), rightBorder(), topBorder() and bottomBorder() methods determines the border for the corresponding side.
Note: lineJoin settings not working here.

Params:

Name Type Default Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Fill settings or stroke settings.
thickness number
1
Line thickness.
dashpattern string
Controls the pattern of dashes and gaps used to stroke paths.
lineJoin anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCap anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellOddFill

Getter for current series fill color.

Returns:

anychart.graphics.vector.Fill - Current fill color.
Sets fill settings using an object or a string.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
null
Color as an object or a string.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.
Fill color with opacity.
Note: If color is set as a string (e.g. 'red .5') it has a priority over opt_opacity, which means: color set like this rect.fill('red 0.3', 0.7) will have 0.3 opacity.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Linear gradient fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Radial gradient fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

Image fill.
Learn more about coloring at: https://docs.anychart.com/7.3.0/General_settings/Elements_Fill

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellPadding

Getter for the cell padding settings.

Returns:

anychart.core.utils.Padding - anychart.core.utils.Padding instance for method chaining.
Setter for the cell paddings in pixels using a single value.

Params:

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

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.
Setter for the cell paddings 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.Table - anychart.core.ui.Table instance for method chaining.

cellRightBorder

Getter for current cell right border settings.

Returns:

anychart.graphics.vector.Stroke - Current stroke settings.
Setter for cell right border settings.
Learn more about stroke settings: https://docs.anychart.com/7.3.0/General_settings/Elements_Stroke
Note: The last usage of leftBorder(), rightBorder(), topBorder() and bottomBorder() methods determines the border for the corresponding side.
Note: lineJoin settings not working here.

Params:

Name Type Default Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Fill settings or stroke settings.
thickness number
1
Line thickness.
dashpattern string
Controls the pattern of dashes and gaps used to stroke paths.
lineJoin anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCap anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

cellTextFactory

Getter for table cell text factory.

Returns:

anychart.core.ui.LabelsFactory - Current table text factory.
You can setup the default text appearance for entire table. These settings apply to cells with content set as string or number. If you want to set text appearance for the particular cell, set cell content as string first, and then feel free to get the content and tune it.

Params:

Name Type Description
value Object | boolean | null

Try it:

cellTopBorder

Getter for current cell top border settings.

Returns:

anychart.graphics.vector.Stroke - Current stroke settings.
Setter for cell top border settings.
Learn more about stroke settings: https://docs.anychart.com/7.3.0/General_settings/Elements_Stroke
Note: The last usage of leftBorder(), rightBorder(), topBorder() and bottomBorder() methods determines the border for the corresponding side.
Note: lineJoin settings not working here.

Params:

Name Type Default Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Fill settings or stroke settings.
thickness number
1
Line thickness.
dashpattern string
Controls the pattern of dashes and gaps used to stroke paths.
lineJoin anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCap anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

colWidth

Getter for column width settings.

Params:

Name Type Description
col number Column number.

Returns:

string number null - Current column width.
Setter for column width settings.
Note: Pass null to set the default value.

Params:

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

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

colsCount

Getter for table columns count.

Returns:

number - Current columns count.
Setter for table columns count..
Note: Calculated from the contents if not defined explicitly.

Params:

Name Type Default Description
value number
4
Value to set.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

contents

Getter for table content.
Note: Returns cells content ignored rowSpan and colSpan.

Returns:

Array.<Array.<(anychart.core.ui.Table.CellContent)>> - Current table content.
Setter for table content.
Note: Pass null to drop table content.

Params:

Name Type Default Description
tableValues Array.<Array.<(anychart.core.ui.Table.CellContent|string|number|undefined)>>
Values to set.
demergeCells boolean
false
Pass true to demerge all cells.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

draw

Draws the table.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

getCell

Returns cell by its row and column number.

Params:

Name Type Description
row number Row index.
col number Coumn index.

Returns:

anychart.core.ui.Table.Cell - anychart.core.ui.Table.Cell instance for method chaining.

Try it:

rowHeight

Getter for row height settings.

Params:

Name Type Description
row number Row number.

Returns:

string number null - Current column width.
Setter for row height settings.
Note: Pass null to set default value.

Params:

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

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it:

rowsCount

Getter for table rows count.

Returns:

number - Current rows count.
Setter for table rows count.
Note: Calculated from the contents if not defined explicitly.

Params:

Name Type Default Description
value number
5
Value to set.

Returns:

anychart.core.ui.Table - anychart.core.ui.Table instance for method chaining.

Try it: