lightweight-charts-python
lightweight-charts-python copied to clipboard
sync more than two charts together
Expected Behavior
Navigation is consistent between all charts.
Screencast from 05-17-2024 11:34:41 PM.webm
Current Behaviour
The subcharts are not synced when navigating and scrilling.
Reproducible Example
import os.path
import polars as pl
from lightweight_charts import Chart
import config
if __name__ == '__main__':
symbol = 'AMD'
df = pl.read_csv(os.path.join(config.int_full, f'{symbol}.csv')).tail(210)
df = df.rename({
'timestamp': 'time'
})
chart = Chart(inner_width=1, inner_height=.5)
chart.legend(True)
chart.watermark(symbol)
chart.layout()
wap = chart.create_line('wap', price_line=False)
pandas = df.to_pandas()
chart.set(pandas)
wap.set(pandas)
feature_chart = chart.create_subchart(position='below', width=1, height=0.3, sync=True)
feature_chart.legend(True)
# Creating the lines
f_o = feature_chart.create_line('f_o', color='blue', price_line=False)
f_wap = feature_chart.create_line('f_wap', price_line=False)
dataframe = df.select('time', 'f_o', 'f_wap', 'y').to_pandas()
# Setting the lines to the chart
f_o.set(pandas)
f_wap.set(pandas)
predictor_chart = chart.create_subchart(position='below', width=1, height=.2, sync=True)
predictor_chart.legend(True)
y = predictor_chart.create_line('y', price_line=False)
y.set(pandas)
chart.show(block=True)
Environment
- OS:
- Library: