PINE LIBRARY
Table

Library "Table"
This library provides an easy way to convert arrays and matrixes of data into tables. There are a few different implementations of each function so you can get more or less control over the appearance of the tables. The basic rule of thumb is that all matrix rows must have the same number of columns, and if you are providing multiple arrays/matrixes to specify additional colors (background/text), they must have the same number of rows/columns as the data array. Finally, you do have the option of spanning cells across rows or columns with some special syntax in the data cell. Look at the examples to see how the arrays and matrixes need to be built before they can be used by the functions.
floatArrayToCellArray(floatArray)
Helper function that converts a float array to a Cell array so it can be rendered with the fromArray function
Parameters:
floatArray (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 (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 (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 (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 (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)
This library provides an easy way to convert arrays and matrixes of data into tables. There are a few different implementations of each function so you can get more or less control over the appearance of the tables. The basic rule of thumb is that all matrix rows must have the same number of columns, and if you are providing multiple arrays/matrixes to specify additional colors (background/text), they must have the same number of rows/columns as the data array. Finally, you do have the option of spanning cells across rows or columns with some special syntax in the data cell. Look at the examples to see how the arrays and matrixes need to be built before they can be used by the functions.
floatArrayToCellArray(floatArray)
Helper function that converts a float array to a Cell array so it can be rendered with the fromArray function
Parameters:
floatArray (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 (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 (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 (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 (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)
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
I release TradingView indicators and libraries designed to make you a better trader. For detailed info about them, head over to improve.trading
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
I release TradingView indicators and libraries designed to make you a better trader. For detailed info about them, head over to improve.trading
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.