我是编程新手,但我想为我的手机创建一个简单的UWP应用程序,只是为了查看运行中的外汇图表-遗憾的是,这个-没有太多相关的应用程序。
我真的很喜欢TradingView的WebCharts,他们提供了实时的web小部件,适合这项任务:)
是否可以在UWP应用程序中显示这些内容?
示例:
<!-- TradingView Widget BEGIN -->
<script type="text/javascript" src="https://d33t3vvu2t2yu5.cloudfront.net/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"width": 980,
"height": 610,
"symbol": "NASDAQ:AAPL",
"interval": "D",
"timezone": "Etc/UTC",
"theme": "White",
"style": "1",
"locale": "en",
"toolbar_bg": "#f1f3f6",
"enable_publishing": false,
"allow_symbol_change": true,
"hideideas": true,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650"
});
</script>
<!-- TradingView Widget END -->感谢您的回答:)
哑光
发布于 2016-10-19 13:36:36
TradingView的WebCharts js针对的是网络应用程序。它不是100%适合UWP(JS)应用。
我做了一个演示,发现TradingView的JS库中的document.write会使UWP(JS)应用程序崩溃。
因此,作为在UWP中使用TradingView的个人解决方案。您可以执行以下步骤:
UWP从https://d33t3vvu2t2yu5.cloudfront.net/tv.js下载WebCharts js库并将js库添加到您的项目中。(UWP不支持远程js
package.appxmanifest文件->Content URIs tag->add https://dwq4do82y8xi7.cloudfront.net,如下所示:
document.write(widgetHtml)。如下所示修改结果行:/*document.write(widgetHtml)*/document.getElementById("container").innerHTML=widgetHtml
Div with id="container" to html:现在你可以在UWP App中运行WebCharts了。
下面是完整的演示:TradingViewSample。
https://stackoverflow.com/questions/40103242
复制相似问题