dynamic sizing (size=s,m,l) and height ratio
This commit is contained in:
@ -10,7 +10,7 @@ class Panel:
|
||||
self.histogram = histogram if histogram is not None else []
|
||||
self.title = title
|
||||
|
||||
def chart(panes: list[Panel], sync=False, title=''):
|
||||
def chart(panes: list[Panel], sync=False, title='', size="m"):
|
||||
"""Function to fast render a chart with multiple panes.
|
||||
|
||||
Args:
|
||||
@ -47,15 +47,20 @@ def chart(panes: list[Panel], sync=False, title=''):
|
||||
```
|
||||
|
||||
"""
|
||||
numpanes = len(panes)
|
||||
size_to_dimensions = {
|
||||
's': (800, 400),
|
||||
'm': (1000, 600),
|
||||
'l': (1300, 800)}
|
||||
width, height = size_to_dimensions.get(size, (1000, 600))
|
||||
height_ratio = 1 / len(panes)
|
||||
main_title_set = False
|
||||
for index, pane in enumerate(panes):
|
||||
subchartX = None
|
||||
if index == 0:
|
||||
chartX = JupyterChart(width=1000, height=600, inner_width=1, inner_height=0.5, leftScale=bool(pane.left))
|
||||
chartX = JupyterChart(width=width, height=height, inner_width=1, inner_height=height_ratio, leftScale=bool(pane.left))
|
||||
active_chart = chartX
|
||||
else:
|
||||
subchartX = chartX.create_subchart(position='right', width=1, height=0.5, sync=sync, leftScale=bool(pane.left))
|
||||
subchartX = chartX.create_subchart(position='right', width=1, height=height_ratio, sync=sync, leftScale=bool(pane.left))
|
||||
active_chart = subchartX
|
||||
|
||||
if pane.ohlcv is not None:
|
||||
|
||||
Reference in New Issue
Block a user