Im trying to use ChartJsBlazor with my Blazor WebAssemply project in Visual Studio and I've pretty must just copied the guide from the "Getting Started" section (https://github.com/mariusmuntean/ChartJs.Blazor).
But when I run it, i get this error in the browser:
"blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer\[100\]
Unhandled exception rendering component: Could not find 'ChartJsInterop.setupChart' ('ChartJsInterop' was undefined).
Error: Could not find 'ChartJsInterop.setupChart' ('ChartJsInterop' was undefined).
...
"
Im using the NuGet packet ChartJs.Blazor.Fork (2.0.2) - And I've added the static assets to my index.html like this: "
<body>
<div id="app">
<svg class="loading-progress">
<circle r="40%" cx="50%" cy="50%" />
<circle r="40%" cx="50%" cy="50%" />
</svg>
<div class="loading-progress-text"></div>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="." class="reload">Reload</a>
<span class="dismiss">🗙</span>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
<script src="_content/ChartJs.Blazor.Fork/ChartJsBlazorInterop.js"></script>
</body>
My razor page code i just a replica of the "Getting startet" PieChart configuration. I have verified using the developer tool in the browser that the "ChartJsBlazorInterop.js" exists, but its empty...
I've followed the "Getting started guide step up step and i just wont work! What am I missing? I've tried adding the static assets in different orders but with no succes.
Essential the issue is: That the browser downloads an empty version of the Script "ChartJsBlazorInterop.js", when its expected to download a functional "ChartJsBlazorInterop.js" script - So the Chart can render.
ChartJsBlazorInterop.jsfile on your dev machine?ChartJs.Blazor.Forkagain. In my tests, I had to justdotnet add package ChartJs.Blazor.Forkand then starting the default/skeleton app (without any reference to chart.js) I was able to see the correct .js file athttp://localhost:xxxx/_content/ChartJs.Blazor.Fork/ChartJsBlazorInterop.js