From 6df0e4fd45e5484fe3a24dbc9d5b25642570384e Mon Sep 17 00:00:00 2001 From: louisnw Date: Mon, 9 Oct 2023 17:42:52 +0100 Subject: [PATCH] update docs update setup/conf --- docs/source/conf.py | 2 +- docs/source/reference/abstract_chart.md | 4 ++-- docs/source/reference/tables.md | 19 ++++++++++++++++++- setup.py | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 0c42a53..c56dafa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -3,7 +3,7 @@ project = 'lightweight-charts-python' copyright = '2023, louisnw' author = 'louisnw' -release = '1.0.17.7' +release = '1.0.18' extensions = [ "myst_parser", diff --git a/docs/source/reference/abstract_chart.md b/docs/source/reference/abstract_chart.md index a7099eb..5722392 100644 --- a/docs/source/reference/abstract_chart.md +++ b/docs/source/reference/abstract_chart.md @@ -273,7 +273,7 @@ ___ -```{py:method} legend(visible: bool, ohlc: bool, percent: bool, lines: bool, color: COLOR, font_size: int, font_family: str) +```{py:method} legend(visible: bool, ohlc: bool, percent: bool, lines: bool, color: COLOR, font_size: int, font_family: str, text: str) Configures the legend of the chart. ``` @@ -334,7 +334,7 @@ ___ -```{py:method} create_table(width: NUM, height: NUM, headings: Tuple[str], widths: Tuple[float], alignments: Tuple[str], position: FLOAT, draggable: bool, func: callable) -> Table +```{py:method} create_table(width: NUM, height: NUM, headings: Tuple[str], widths: Tuple[float], alignments: Tuple[str], position: FLOAT, draggable: bool, return_clicked_cells: bool, func: callable) -> Table Creates and returns a [`Table`](https://lightweight-charts-python.readthedocs.io/en/latest/tables.html) object. diff --git a/docs/source/reference/tables.md b/docs/source/reference/tables.md index 091aef2..88e2d70 100644 --- a/docs/source/reference/tables.md +++ b/docs/source/reference/tables.md @@ -1,6 +1,6 @@ # `Table` -`````{py:class} Table(width: NUM, height: NUM, headings: Tuple[str], widths: Tuple[float], alignments: Tuple[str], position: FLOAT, draggable: bool, func: callable) +`````{py:class} Table(width: NUM, height: NUM, headings: Tuple[str], widths: Tuple[float], alignments: Tuple[str], position: FLOAT, draggable: bool, return_clicked_cells: bool, func: callable) Tables are panes that can be used to gain further functionality from charts. They are intended to be used for watchlists, order management, or position management. It should be accessed from the `create_table` common method. @@ -18,6 +18,9 @@ The `Table` and `Row` objects act as dictionaries, and can be manipulated as suc `draggable` : If `True`, then the window can be dragged to any position within the window. +`return_clicked_cells` +: If `True`, an additional parameter will be emitted to the `func` given, containing the heading name of the clicked cell. + `func` : If given, this will be called when a row is clicked, returning the `Row` object in question. ___ @@ -101,6 +104,11 @@ ___ ````{py:class} Footer + +```{tip} +All of these methods can be applied to the `header` parameter. +``` + Tables can also have a footer containing a number of text boxes. To initialize this, call the `footer` attribute with the number of textboxes to be used: ```python @@ -114,6 +122,15 @@ table.footer[1] = 'Text Box 2' table.footer[2] = 'Text Box 3' ``` +When calling footer, the `func` parameter can also be used to convert each textbox into a button: + +```python +def on_footer_click(table, box_index): + print(f'Box number {box_index+1} was pressed.') + +table.footer(3, func=on_footer_click) +``` + ```` diff --git a/setup.py b/setup.py index 4a85edd..0dae59b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='lightweight_charts', - version='1.0.17.7', + version='1.0.18', packages=find_packages(), python_requires='>=3.8', install_requires=[