- Added async methods to polygon. - The `requests` library is no longer required, with `urllib` being used instead. - Added the `get_bar_data` function, which returns a dataframe of aggregate data from polygon. - Opened up the `subscribe` and `unsubscribe` functions Enhancements: - Tables will now scroll when the rows exceed table height. Bugs: - Fixed a bug preventing async functions being used with horizontal line event. - Fixed a bug causing the legend to show duplicate lines if the line was created after the legend. - Fixed a bug causing the line hide icon to persist within the legend after deletion (#75) - Fixed a bug causing the search box to be unfocused when the chart is loaded.
51 lines
1.1 KiB
Markdown
51 lines
1.1 KiB
Markdown
# Subcharts
|
|
|
|
## Grid of 4
|
|
|
|
```python
|
|
import pandas as pd
|
|
from lightweight_charts import Chart
|
|
|
|
if __name__ == '__main__':
|
|
chart = Chart(inner_width=0.5, inner_height=0.5)
|
|
chart2 = chart.create_subchart(position='right', width=0.5, height=0.5)
|
|
chart3 = chart.create_subchart(position='left', width=0.5, height=0.5)
|
|
chart4 = chart.create_subchart(position='right', width=0.5, height=0.5)
|
|
|
|
chart.watermark('1')
|
|
chart2.watermark('2')
|
|
chart3.watermark('3')
|
|
chart4.watermark('4')
|
|
|
|
df = pd.read_csv('ohlcv.csv')
|
|
chart.set(df)
|
|
chart2.set(df)
|
|
chart3.set(df)
|
|
chart4.set(df)
|
|
|
|
chart.show(block=True)
|
|
|
|
```
|
|
___
|
|
## Synced Line Chart
|
|
|
|
```python
|
|
import pandas as pd
|
|
from lightweight_charts import Chart
|
|
|
|
if __name__ == '__main__':
|
|
chart = Chart(inner_width=1, inner_height=0.8)
|
|
chart.time_scale(visible=False)
|
|
|
|
chart2 = chart.create_subchart(width=1, height=0.2, sync=True)
|
|
line = chart2.create_line()
|
|
|
|
df = pd.read_csv('ohlcv.csv')
|
|
df2 = pd.read_csv('rsi.csv')
|
|
|
|
chart.set(df)
|
|
line.set(df2)
|
|
|
|
chart.show(block=True)
|
|
```
|