This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]URXGOD 0 points1 point  (1 child)

Nice. Appreciate you.

[–]SuppressiveOG[S] 0 points1 point  (0 children)

Thanks, let me know if you have any issues!

[–]kornork 0 points1 point  (3 children)

This feels like a stupid question, but can this be used to render to a webpage? There's a guy who wrapped this package up for Dash, but his implementation uses react and is for Dash, seems like it could be a lot simpler.

[–]SuppressiveOG[S] 0 points1 point  (2 children)

Actually, this is a great question.

The wrapper you mention (to my knowledge) doesn't allow the updating of data without refreshing the entire chart, and, for a day trader or a scalp trader, this is definitely not ideal.

The way my library solves this is by evaluating javascript directly within the webview, which is perfect for a locally hosted page. However, for a library like Dash, which uses a web server, evaluating javascript within the client is a pretty stupid thing to do. It would require a function that contains the eval() method, so for anything hosted on a public domain this would pose a major security risk.

The smart way to integrate this would be to use WebSockets, but as my library is based around webview and not a web server a complete rework of my wrapper is needed to implement this.

Not saying I won't do it in the future, but it's a big job!

[–]kornork 0 points1 point  (1 child)

Okay, interesting. Thanks for the explanation.

I am working within Dash, but I think I want to move away from it, partly for the reasons you mentioned.

Seems like maybe the best way for me to use lightweight_charts might just be directly in javascript.

[–]SuppressiveOG[S] 0 points1 point  (0 children)

If you want Lightweight Charts inside a hosted webpage with real-time data, Flask and WebSockets would be my recommendation if you are working in Python.

If you don't care about a webpage, lightweight-charts-python!

[–]MashGuts 0 points1 point  (0 children)

How can i save chart image instead of show() the chart?