$("#loadtv").on("click",function(myfunc23){
var chart4 = new TradingView.widget({
container_id: 'chart4',
"width": "100%",
"height": "100%",
"locale": "en",
"importanceFilter": "-1,0,1",
"currencyFilter": "USD"
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="loadpage">
<button id="loadtv">Show Calendar Event</button>
<div id= "tvaa" class= "tvcx tvapp row">
<div id="chart4"></div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-events.js"></script>
</div>
</div>
Hi, I am trying to open the calendar widget of tradingview in a div, when a button is clicked. for some reason this same method worked with the charting widget but it isn't working for the calendar. Help appreciated! Link to tradingview calendar widget script: https://www.tradingview.com/widget/economic-calendar/
You need to use another script such that you can then use the TradingView constructor:
<script src="//s3.tradingview.com/tv.js"></script>
The calendar widget is only one component of the ensemble. If you want to disable stuff you should check with this cheatsheet which shows available options.
For some reason the WS in this SO snippet is disallowed (403).
Therefore, you might want to check out this sample plunkr.
$("#loadtv").on("click", function() {
new TradingView.widget({
container_id: 'chart4',
width: "100%",
height: "1000px",
locale: "en",
importanceFilter: "-1,0,1",
currencyFilter: "USD",
symbol: "NASDAQ:AAPL",
interval: "D",
timezone: "America/New_York",
theme: "White",
style: 1,
toolbar_bg: "rgba(0, 0, 196, 1)",
withdateranges: true,
hide_side_toolbar: false,
allow_symbol_change: true,
details: false,
hotlist: false,
calendar: true,
news: [],
hideideas: true,
show_popup_button: true,
});
});
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//s3.tradingview.com/tv.js"></script>
<button id="loadtv">Show Calendar Event</button>
<div id="chart4"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With