Casa_Table

A powerful library for creating customizable tables from data arrays and matrices.
Features flexible formatting options including:
- Multiple function implementations for different levels of control
- Consistent column counts required across matrix rows
- Matching dimensions needed for color arrays/matrices
- Cell spanning capabilities across rows/columns
- Rich examples demonstrating proper data structure setup
The library makes it easy to transform your data into professional-looking
tables while maintaining full control over their visual appearance.
floatArrayToCellArray(floatArray)
Helper function that converts a float array to a Cell array so it can be rendered with the fromArray function
Parameters:
floatArray (array<float>): (array<float>) the float array to convert to a Cell array.
Returns: array<Cell> The Cell array to return.
stringArrayToCellArray(stringArray)
Helper function that converts a string array to a Cell array so it can be rendered with the fromArray function
Parameters:
stringArray (array<string>): (array<string>) the array to convert to a Cell array.
Returns: array<Cell> The Cell array to return.
floatMatrixToCellMatrix(floatMatrix)
Helper function that converts a float matrix to a Cell matrix so it can be rendered with the fromMatrix function
Parameters:
floatMatrix (matrix<float>): (matrix<float>) the float matrix to convert to a string matrix.
Returns: matrix<Cell> The Cell matrix to render.
stringMatrixToCellMatrix(stringMatrix)
Helper function that converts a string matrix to a Cell matrix so it can be rendered with the fromMatrix function
Parameters:
stringMatrix (matrix<string>): (matrix<string>) the string matrix to convert to a Cell matrix.
Returns: matrix<Cell> The Cell matrix to return.
fromMatrix(CellMatrix, position, verticalOffset, transposeTable, textSize, borderWidth, tableNumRows, blankCellText)
Takes a CellMatrix and renders it as a table.
Parameters:
CellMatrix (matrix<Cell>): (matrix<Cell>) The Cells to be rendered in a table
position (string): (string) Optional. The position of the table. Defaults to position.top_right
verticalOffset (int): (int) Optional. The vertical offset of the table from the top or bottom of the chart. Defaults to 0.
transposeTable (bool): (bool) Optional. Will transpose all of the data in the matrices before rendering. Defaults to false.
textSize (string): (string) Optional. The size of text to render in the table. Defaults to size.small.
borderWidth (int): (int) Optional. The width of the border between table cells. Defaults to 2.
tableNumRows (int): (int) Optional. The number of rows in the table. Not required, defaults to the number of rows in the provided matrix. If your matrix will have a variable number of rows, you must provide the max number of rows or the function will error when it attempts to set a cell value on a row that the table hadn't accounted for when it was defined.
blankCellText (string): (string) Optional. Text to use cells when adding blank rows for vertical offsetting.
fromMatrix(dataMatrix, position, verticalOffset, transposeTable, textSize, borderWidth, tableNumRows, blankCellText)
Renders a float matrix as a table.
Parameters:
dataMatrix (matrix<float>): (matrix_float) The data to be rendered in a table
position (string): (string) Optional. The position of the table. Defaults to position.top_right
verticalOffset (int): (int) Optional. The vertical offset of the table from the top or bottom of the chart. Defaults to 0.
transposeTable (bool): (bool) Optional. Will transpose all of the data in the matrices before rendering. Defaults to false.
textSize (string): (string) Optional. The size of text to render in the table. Defaults to size.small.
borderWidth (int): (int) Optional. The width of the border between table cells. Defaults to 2.
tableNumRows (int): (int) Optional. The number of rows in the table. Not required, defaults to the number of rows in the provided matrix. If your matrix will have a variable number of rows, you must provide the max number of rows or the function will error when it attempts to set a cell value on a row that the table hadn't accounted for when it was defined.
blankCellText (string): (string) Optional. Text to use cells when adding blank rows for vertical offsetting.
fromMatrix(dataMatrix, position, verticalOffset, transposeTable, textSize, borderWidth, tableNumRows, blankCellText)
Renders a string matrix as a table.
Parameters:
dataMatrix (matrix<string>): (matrix_string) The data to be rendered in a table
position (string): (string) Optional. The position of the table. Defaults to position.top_right
verticalOffset (int): (int) Optional. The vertical offset of the table from the top or bottom of the chart. Defaults to 0.
transposeTable (bool): (bool) Optional. Will transpose all of the data in the matrices before rendering. Defaults to false.
textSize (string): (string) Optional. The size of text to render in the table. Defaults to size.small.
borderWidth (int): (int) Optional. The width of the border between table cells. Defaults to 2.
tableNumRows (int): (int) Optional. The number of rows in the table. Not required, defaults to the number of rows in the provided matrix. If your matrix will have a variable number of rows, you must provide the max number of rows or the function will error when it attempts to set a cell value on a row that the table hadn't accounted for when it was defined.
blankCellText (string): (string) Optional. Text to use cells when adding blank rows for vertical offsetting.
fromArray(dataArray, position, verticalOffset, transposeTable, textSize, borderWidth, blankCellText)
Renders a Cell array as a table.
Parameters:
dataArray (array<Cell>): (array<Cell>) The data to be rendered in a table
position (string): (string) Optional. The position of the table. Defaults to position.top_right
verticalOffset (int): (int) Optional. The vertical offset of the table from the top or bottom of the chart. Defaults to 0.
transposeTable (bool): (bool) Optional. Will transpose all of the data in the matrices before rendering. Defaults to false.
textSize (string): (string) Optional. The size of text to render in the table. Defaults to size.small.
borderWidth (int): (int) Optional. The width of the border between table cells. Defaults to 2.
blankCellText (string): (string) Optional. Text to use cells when adding blank rows for vertical offsetting.
fromArray(dataArray, position, verticalOffset, transposeTable, textSize, borderWidth, blankCellText)
Renders a string array as a table.
Parameters:
dataArray (array<string>): (array_string) The data to be rendered in a table
position (string): (string) Optional. The position of the table. Defaults to position.top_right
verticalOffset (int): (int) Optional. The vertical offset of the table from the top or bottom of the chart. Defaults to 0.
transposeTable (bool): (bool) Optional. Will transpose all of the data in the matrices before rendering. Defaults to false.
textSize (string): (string) Optional. The size of text to render in the table. Defaults to size.small.
borderWidth (int): (int) Optional. The width of the border between table cells. Defaults to 2.
blankCellText (string): (string) Optional. Text to use cells when adding blank rows for vertical offsetting.
fromArray(dataArray, position, verticalOffset, transposeTable, textSize, borderWidth, blankCellText)
Renders a float array as a table.
Parameters:
dataArray (array<float>): (array_float) The data to be rendered in a table
position (string): (string) Optional. The position of the table. Defaults to position.top_right
verticalOffset (int): (int) Optional. The vertical offset of the table from the top or bottom of the chart. Defaults to 0.
transposeTable (bool): (bool) Optional. Will transpose all of the data in the matrices before rendering. Defaults to false.
textSize (string): (string) Optional. The size of text to render in the table. Defaults to size.small.
borderWidth (int): (int) Optional. The width of the border between table cells. Defaults to 2.
blankCellText (string): (string) Optional. Text to use cells when adding blank rows for vertical offsetting.
debug(message, position)
Renders a debug message in a table at the desired location on screen.
Parameters:
message (string): (string) The message to render.
position (string): (string) Optional. The position of the debug message. Defaults to position.middle_right.
Cell
Type for each cell's content and appearance
Fields:
content (series string)
bgColor (series color)
textColor (series color)
align (series string)
colspan (series int)
rowspan (series int)
Back to version 5 , because of some troubles
Biblioteca Pine
Siguiendo fielmente el espíritu de TradingView, el autor ha publicado este código Pine como una biblioteca de código, permitiendo que otros programadores de Pine en nuestra comunidad puedan volver a utilizarlo. ¡Un brindis por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en publicaciones se rige por las Normas internas.
Exención de responsabilidad
Biblioteca Pine
Siguiendo fielmente el espíritu de TradingView, el autor ha publicado este código Pine como una biblioteca de código, permitiendo que otros programadores de Pine en nuestra comunidad puedan volver a utilizarlo. ¡Un brindis por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en publicaciones se rige por las Normas internas.