I have successfully completed all the steps outlined in the documentation. When using CDN links, everything functions as expected and I am able to load any chart.
<script src="https://unpkg.com/chart.js/dist/Chart.min.js"></script>
<script src="https://unpkg.com/@chartisan/chartjs@^2.1.0/dist/chartisan_chartjs.umd.js"></script>
However, I have decided not to use the CDN links anymore. Instead, I removed those two lines mentioned above and installed the front-end adapter using npm install chart.js@chartisan/chartjs so that I can utilize charts without relying on CDNs. Below is my updated code:
<div id="chart" style="height: 300px;"></div>
<script>
import { Chartisan, ChartisanHooks } from '@chartisan/chartjs'//This line is causing an issue
const chart = new Chartisan({
el: '#chart',
url: "@chart('sample_chart')",
hooks: new ChartisanHooks()
.beginAtZero()
.colors()
.datasets('doughnut')
});
</script>
Upon running this code, I encounter the following error:
Uncaught SyntaxError: Cannot use import statement outside a module