I have been trying to get this supposedly very easy to install "lightweight-charts" package going (link to GitHub page), but something is always standing in the way. Of the two install options, the first one quarrels with Firefox, which tries to impose some ridiculous certificate standard about my localhost loaded script files before allowing .js files, about which I can not even hang exceptions since Firefox will first 'search for information of the page' before allowing me to click the greyed out "add an exception" button. (and of course, it can never find a local page with web searches..)
The second option, "installation"/referencing via CDN seems just to be blocked because I get
"Uncaught ReferenceError: LightweightCharts is not defined"
...even when previously loading the package in the head.
Here is a screenshot of the very simple page.
const chart = LightweightCharts.createChart(document.getElementById('lwc'), { 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 },
]);
<html>
<head>
<title>Turtle</title>
<script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script>
</head>
<body>
<h1>Chart</h1>
<div id="lwc"></div>
<script src="lwc.js"></script>
</body>
</html>
...which is just the example they have on their Github with the subtle change of using .getElementById instead of .body.
But not only does it not work at all, but I also found someone making a video of doing exactly the same thing as me, and it worked first try!
So, if I had to guess, I would say something might be blocking the internet connection to this file somehow, causing the SCR in the title to never be cited.
I tried to run Firefox in safe mode and loaded this on Chrome as well to make sure it wasn't an add-on, but both failed. Then I attempted to run the page via a python server, but with the same results. I have been searching here for 2 hours without finding more relevant information too. What can I make of this?
question from:
https://stackoverflow.com/questions/65943167/lightweight-charts-uncaught-referenceerror-lightweightcharts-is-not-defined