diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e35662d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +docs/build/** diff --git a/docs/source/reference/abstract_chart.md b/docs/source/reference/abstract_chart.md index 13067d6..dcca55c 100644 --- a/docs/source/reference/abstract_chart.md +++ b/docs/source/reference/abstract_chart.md @@ -12,7 +12,6 @@ ___ Sets the initial data for the chart. - Columns should be named: : `time | open | high | low | close | volume` @@ -206,7 +205,7 @@ ___ -```{py:method} price_scale(mode: PRICE_SCALE_MODE, align_labels: bool, border_visible: bool, border_color: COLOR, text_color: COLOR, entire_text_only: bool, ticks_visible: bool, scale_margin_top: float, scale_margin_bottom: float) +```{py:method} price_scale(auto_scale: bool, mode: PRICE_SCALE_MODE, invert_scale: bool, align_labels: bool, scale_margin_top: float, scale_margin_bottom: float, border_visible: bool, border_color: COLOR, text_color: COLOR, entire_text_only: bool, visible: bool, ticks_visible: bool, minimum_width: float) Price scale options for the chart. ``` diff --git a/docs/source/reference/index.md b/docs/source/reference/index.md index c0c38e3..364f165 100644 --- a/docs/source/reference/index.md +++ b/docs/source/reference/index.md @@ -22,4 +22,4 @@ tables 4. [Charts](#charts) 5. [`Events`](./events.md) 6. [`Toolbox`](#ToolBox) -7. [`Table`](#Table) \ No newline at end of file +7. [`Table`](#Table) diff --git a/lightweight_charts/abstract.py b/lightweight_charts/abstract.py index 926c3b4..41575e9 100644 --- a/lightweight_charts/abstract.py +++ b/lightweight_charts/abstract.py @@ -2,7 +2,7 @@ import asyncio import os from base64 import b64decode from datetime import datetime -from typing import Union, Literal, List +from typing import Union, Literal, List, Optional import pandas as pd from .table import Table @@ -648,19 +648,25 @@ class Candlestick(SeriesCommon): self.update(bar, _from_tick=True) def price_scale( - self, mode: PRICE_SCALE_MODE = 'normal', align_labels: bool = True, border_visible: bool = False, - border_color: str = None, text_color: str = None, entire_text_only: bool = False, - ticks_visible: bool = False, scale_margin_top: float = 0.2, scale_margin_bottom: float = 0.2): + self, auto_scale: bool = True, mode: PRICE_SCALE_MODE = 'normal', invert_scale: bool = False, + align_labels: bool = True, scale_margin_top: float = 0.2, scale_margin_bottom: float = 0.2, + border_visible: bool = False, border_color: Optional[str] = None, text_color: Optional[str] = None, + entire_text_only: bool = False, visible: bool = True, ticks_visible: bool = False, minimum_width: int = 0 + ): self.run_script(f''' {self.id}.series.priceScale().applyOptions({{ + autoScale: {jbool(auto_scale)}, mode: {price_scale_mode(mode)}, + invertScale: {jbool(invert_scale)}, alignLabels: {jbool(align_labels)}, + scaleMargins: {{top: {scale_margin_top}, bottom: {scale_margin_bottom}}}, borderVisible: {jbool(border_visible)}, {f'borderColor: "{border_color}",' if border_color else ''} {f'textColor: "{text_color}",' if text_color else ''} entireTextOnly: {jbool(entire_text_only)}, + visible: {jbool(visible)}, ticksVisible: {jbool(ticks_visible)}, - scaleMargins: {{top: {scale_margin_top}, bottom: {scale_margin_bottom}}} + minimumWidth: {minimum_width} }})''') def candle_style(