[英]TradingView Chart doesnt show up
can someone tell me why my TradingView Chart doesnt show up?有人能告诉我为什么我的 TradingView 图表不显示吗? I am getting an empty page with no chart showing.
我得到一个没有图表显示的空白页面。
I followed all instructions for installation here:我按照此处的所有安装说明进行操作:
https://github.com/tradingview/lightweight-charts/blob/master/docs/README.md https://github.com/tradingview/lightweight-charts/blob/master/docs/README.md
Here's my 1 page standalone file contents....这是我的 1 页独立文件内容....
<!DOCTYPE html>
<html>
<body>
<script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js">
const chart = LightweightCharts.createChart(document.body, { width: 400, height: 300 });
const lineSeries = chart.addLineSeries();
lineSeries.setData([
{ time: '2019-04-11', value: 80.01 },
{ time: '2019-04-12', value: 96.63 },
{ time: '2019-04-13', value: 76.64 },
{ time: '2019-04-14', value: 81.89 },
{ time: '2019-04-15', value: 74.43 },
{ time: '2019-04-16', value: 80.01 },
{ time: '2019-04-17', value: 96.63 },
{ time: '2019-04-18', value: 76.64 },
{ time: '2019-04-19', value: 81.89 },
{ time: '2019-04-20', value: 74.43 },
]);
</script>
</body>
</html>
You need to import the js script in the <head>
of your html page and then run your javascript in the body like this:您需要在 html 页面的
<head>
中导入 js 脚本,然后像这样在正文中运行您的 javascript:
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script> </head> <body> <script> const chart = LightweightCharts.createChart(document.body, { width: 400, height: 300 }); const lineSeries = chart.addLineSeries(); lineSeries.setData([ { time: '2019-04-11', value: 80.01 }, { time: '2019-04-12', value: 96.63 }, { time: '2019-04-13', value: 76.64 }, { time: '2019-04-14', value: 81.89 }, { time: '2019-04-15', value: 74.43 }, { time: '2019-04-16', value: 80.01 }, { time: '2019-04-17', value: 96.63 }, { time: '2019-04-18', value: 76.64 }, { time: '2019-04-19', value: 81.89 }, { time: '2019-04-20', value: 74.43 }, ]); </script> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.