Enhancements:

- Hotkeys can now use any character, and modifier keys are not required.
- Refactored the colors of the topbar, searchbox, toolbox, and widgets for consistency.
- Toolbox/interval refactoring and simplification.
- Histograms now show up in the legend, and will use shorthand notation by default (e.g 34k rather than 34000).
This commit is contained in:
louisnw
2023-09-24 15:09:45 +01:00
parent 43eab9854d
commit d43e7c24e7
9 changed files with 303 additions and 256 deletions

View File

@ -3,7 +3,7 @@ import os.path
project = 'lightweight-charts-python'
copyright = '2023, louisnw'
author = 'louisnw'
release = '1.0.17.2'
release = '1.0.17.6'
extensions = [
"myst_parser",

View File

@ -27,6 +27,7 @@ if __name__ == '__main__':
```
___
## Synced Line Chart
```python
@ -48,3 +49,47 @@ if __name__ == '__main__':
chart.show(block=True)
```
___
## Grid of 4 with maximize buttons
```python
import pandas as pd
from lightweight_charts import Chart
# ascii symbols
FULLSCREEN = '■'
CLOSE = '×'
def on_max(target_chart):
button = target_chart.topbar['max']
if button.value == CLOSE:
[c.resize(0.5, 0.5) for c in charts]
button.set(FULLSCREEN)
else:
for chart in charts:
width, height = (1, 1) if chart == target_chart else (0, 0)
chart.resize(width, height)
button.set(CLOSE)
if __name__ == '__main__':
main_chart = Chart(inner_width=0.5, inner_height=0.5)
charts = [
main_chart,
main_chart.create_subchart(position='top', width=0.5, height=0.5),
main_chart.create_subchart(position='left', width=0.5, height=0.5),
main_chart.create_subchart(position='right', width=0.5, height=0.5),
]
df = pd.read_csv('examples/1_setting_data/ohlcv.csv')
for i, c in enumerate(charts):
chart_number = str(i+1)
c.watermark(chart_number)
c.topbar.textbox('number', chart_number)
c.topbar.button('max', FULLSCREEN, False, align='right', func=on_max)
c.set(df)
charts[0].show(block=True)
```