Screenshot & Save¶
import pandas as pd
from lightweight_charts import Chart
if __name__ == '__main__':
chart = Chart()
df = pd.read_csv('ohlcv.csv')
chart.set(df)
chart.show()
img = chart.screenshot()
with open('screenshot.png', 'wb') as f:
f.write(img)
Important
The screenshot command can only be executed after the chart window is open. Therefore, either block must equal False, the screenshot should be triggered with a callback, or async_show should be used.
Important
This example can only be used with the standard Chart object.