Created
May 29, 2024 01:59
-
-
Save sangelxyz/e1ed5294a60b7e7cd1b01adf7fd5b3ac to your computer and use it in GitHub Desktop.
tradingview leptos component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use leptos::*; | |
#[component] | |
pub fn TradingView(symbol: String) -> impl IntoView { | |
// Creates a reactive value to update the button | |
view! { | |
<div class="tradingview-container" style="width:100%;"> | |
<div class="tradingview-widget-container" style="height:100%;width:100%"> | |
<div class="tradingview-widget-container__widget" style="height:calc(100% - 32px);width:100%"></div> | |
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js" async inner_html=r#" | |
{ | |
"autosize": true, | |
"symbol": "NASDAQ:NVDA", | |
"interval": "D", | |
"timezone": "Etc/UTC", | |
"theme": "light", | |
"style": "1", | |
"locale": "en", | |
"allow_symbol_change": true, | |
"calendar": false, | |
"support_host": "https://www.tradingview.com" | |
}"#> | |
</script> | |
</div> | |
</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment