External widget include in razor page.
Posted 1 year ago
by acmesoft
I want to include a trading view widget to my Index.razor component,
The code of the widget is below, as you see there is two javascripts, the first i moved to index.html, as Microsoft documentation recommends. I can put together because the graph draws in the footer. It must run inside the Index.razor component, I think i need to stop autorun in the javascript and use JSInterop or something. Can you help me to clarify what I need to do? I'm newbie in Blazor sorry if my question is too basic, but I didn't get the answer.
Thank you!
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<div id="tradingview_dacb5"></div>
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/symbols/NASDAQ-AAPL/" rel="noopener" target="_blank"><span class="blue-text">AAPL stock chart</span></a> by TradingView</div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget(
{
"autosize": true,
"symbol": "NASDAQ:AAPL",
"interval": "D",
"timezone": "Etc/UTC",
"theme": "dark",
"style": "1",
"locale": "en",
"toolbar_bg": "#f1f3f6",
"enable_publishing": false,
"allow_symbol_change": true,
"container_id": "tradingview_dacb5"
}
);
</script>
</div>
<!-- TradingView Widget END -->
Someone is typing...
Post a Reply
You must be logged in to add a new post.
Number of online users: 1