PINE LIBRARY
SimpleTable

A library for when you just want to get a table up with the least hassle.
The function `f_drawTableFromColumns()`, is intended to be the simplest possible way to draw a table with the least code in the calling script. Just pass in between one and ten arrays that contain the strings you want to show. Each string array represents one column. That's it. You get a table back.
If you want to style the table you can optionally pass colours, size, and whether the table has a header row that should be displayed differently.
An example usage section demonstrates creating a three-column table.
The function automatically sizes the table based on the number of non-na arrays and the maximum column length.
Optional styling parameters cover table position, text size, text alignment, text colour, cell background, header background, header text, and border width. If you don't supply any of these arguments, the table uses some sensible default values.
The table is created and updated on the last bar only, with caching to avoid unnecessary redraws.
Column shrink detection clears the table only when required, preventing stale cell content.
This is not a full-fledged table management library; there are already lots of those published. It is (I believe and hope) the easiest library to use. For example, you don't need to supply a matrix, or a user-defined type full of settings. The library wraps the input arrays into a map, and uses a user-defined type, but internally, so you don't need to worry about it. Just supply one or more arrays with some text.
f_drawTableFromColumnArrays(_a_col1, _a_col2, _a_col3, _a_col4, _a_col5, _a_col6, _a_col7, _a_col8, _a_col9, _a_col10, _position, _textSize, _textAlign, _textColor, _cellBgColor, _headerBgColor, _headerTextColor, _hasHeaderRow, _borderWidth)
Renders a table using up to ten string arrays. The table size is derived from the number of non-na arrays and the maximum length across the supplied arrays.
Parameters:
_a_col1 (array<string>): (array<string>) Column 1 values. Supply na to omit.
_a_col2 (array<string>): (array<string>) Column 2 values. Supply na to omit.
_a_col3 (array<string>): (array<string>) Column 3 values. Supply na to omit.
_a_col4 (array<string>): (array<string>) Column 4 values. Supply na to omit.
_a_col5 (array<string>): (array<string>) Column 5 values. Supply na to omit.
_a_col6 (array<string>): (array<string>) Column 6 values. Supply na to omit.
_a_col7 (array<string>): (array<string>) Column 7 values. Supply na to omit.
_a_col8 (array<string>): (array<string>) Column 8 values. Supply na to omit.
_a_col9 (array<string>): (array<string>) Column 9 values. Supply na to omit.
_a_col10 (array<string>): (array<string>) Column 10 values. Supply na to omit.
_position (string): (TablePosition) Table position on the chart. Default is top right.
_textSize (string): (TableTextSize) Text size for all cells. Default is normal.
_textAlign (string): (TableTextAlign) Horizontal alignment for all cells. Default is left.
_textColor (color): (color) Text colour for all cells. Default is chart foreground color.
_cellBgColor (color): (color) Background colour for all cells. Uses a default if na. Default is gray 90%.
_headerBgColor (color): (color) Background colour for the header row. Uses a default if na. Default is gray 75%.
_headerTextColor (color): (color) Text colour for the header row. Uses a default if na.
_hasHeaderRow (bool): (bool) If true, row 0 is treated as a header. Default is true.
_borderWidth (int): (int) Table border width. Must be non-negative. Default is 1.
Returns: The table object, so the caller can store the table ID if required.
The function `f_drawTableFromColumns()`, is intended to be the simplest possible way to draw a table with the least code in the calling script. Just pass in between one and ten arrays that contain the strings you want to show. Each string array represents one column. That's it. You get a table back.
If you want to style the table you can optionally pass colours, size, and whether the table has a header row that should be displayed differently.
An example usage section demonstrates creating a three-column table.
The function automatically sizes the table based on the number of non-na arrays and the maximum column length.
Optional styling parameters cover table position, text size, text alignment, text colour, cell background, header background, header text, and border width. If you don't supply any of these arguments, the table uses some sensible default values.
The table is created and updated on the last bar only, with caching to avoid unnecessary redraws.
Column shrink detection clears the table only when required, preventing stale cell content.
This is not a full-fledged table management library; there are already lots of those published. It is (I believe and hope) the easiest library to use. For example, you don't need to supply a matrix, or a user-defined type full of settings. The library wraps the input arrays into a map, and uses a user-defined type, but internally, so you don't need to worry about it. Just supply one or more arrays with some text.
f_drawTableFromColumnArrays(_a_col1, _a_col2, _a_col3, _a_col4, _a_col5, _a_col6, _a_col7, _a_col8, _a_col9, _a_col10, _position, _textSize, _textAlign, _textColor, _cellBgColor, _headerBgColor, _headerTextColor, _hasHeaderRow, _borderWidth)
Renders a table using up to ten string arrays. The table size is derived from the number of non-na arrays and the maximum length across the supplied arrays.
Parameters:
_a_col1 (array<string>): (array<string>) Column 1 values. Supply na to omit.
_a_col2 (array<string>): (array<string>) Column 2 values. Supply na to omit.
_a_col3 (array<string>): (array<string>) Column 3 values. Supply na to omit.
_a_col4 (array<string>): (array<string>) Column 4 values. Supply na to omit.
_a_col5 (array<string>): (array<string>) Column 5 values. Supply na to omit.
_a_col6 (array<string>): (array<string>) Column 6 values. Supply na to omit.
_a_col7 (array<string>): (array<string>) Column 7 values. Supply na to omit.
_a_col8 (array<string>): (array<string>) Column 8 values. Supply na to omit.
_a_col9 (array<string>): (array<string>) Column 9 values. Supply na to omit.
_a_col10 (array<string>): (array<string>) Column 10 values. Supply na to omit.
_position (string): (TablePosition) Table position on the chart. Default is top right.
_textSize (string): (TableTextSize) Text size for all cells. Default is normal.
_textAlign (string): (TableTextAlign) Horizontal alignment for all cells. Default is left.
_textColor (color): (color) Text colour for all cells. Default is chart foreground color.
_cellBgColor (color): (color) Background colour for all cells. Uses a default if na. Default is gray 90%.
_headerBgColor (color): (color) Background colour for the header row. Uses a default if na. Default is gray 75%.
_headerTextColor (color): (color) Text colour for the header row. Uses a default if na.
_hasHeaderRow (bool): (bool) If true, row 0 is treated as a header. Default is true.
_borderWidth (int): (int) Table border width. Must be non-negative. Default is 1.
Returns: The table object, so the caller can store the table ID if required.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
🆓 All my free scripts: is.gd/simplefree
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
🆓 All my free scripts: is.gd/simplefree
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.