Merge pull request #245 from CodexLink/feat/impl-addl-price-scale-options
feat(price-scale-options): introduce missing `PriceScaleOptions` based on Version 4.1 TV Docs
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
docs/build/**
|
||||
@ -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.
|
||||
```
|
||||
|
||||
@ -22,4 +22,4 @@ tables
|
||||
4. [Charts](#charts)
|
||||
5. [`Events`](./events.md)
|
||||
6. [`Toolbox`](#ToolBox)
|
||||
7. [`Table`](#Table)
|
||||
7. [`Table`](#Table)
|
||||
|
||||
@ -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(
|
||||
|
||||
Reference in New Issue
Block a user