Could not find 'ChartJsInterop.setupChart
LeiYangGH opened this issue · 3 comments
Describe the bug
I can clone the git repo and run the samples, but when include and run in my own project, got exception.
Which Blazor project type is your bug related to?
- Server-Side
Which charts does this bug apply to?
ChartJs.Blazor.LineChart
To Reproduce
Steps to reproduce the behavior:
- ChartJs.Blazor.Fork 2.0.2 install by nuget
- Copy almost all code from https://github.com/mariusmuntean/ChartJs.Blazor/blob/master/ChartJs.Blazor.Samples/Client/Pages/Charts/Line/Basic.razor.
- only the data is made my own.
LineDataset<int> dataset1 = new LineDataset<int>(my own list<int>)
- See error.
Expected behavior
Can run and show chart.
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Could not find 'ChartJsInterop.setupChart' ('ChartJsInterop' was undefined).
Error: Could not find 'ChartJsInterop.setupChart' ('ChartJsInterop' was undefined).
at http://localhost:5000/_framework/blazor.server.js:1:67713
at Array.forEach ()
at e.findFunction (http://localhost:5000/_framework/blazor.server.js:1:67673)
at v (http://localhost:5000/_framework/blazor.server.js:1:69415)
at http://localhost:5000/_framework/blazor.server.js:1:70361
at new Promise ()
at e.beginInvokeJSFromDotNet (http://localhost:5000/_framework/blazor.server.js:1:70334)
at http://localhost:5000/_framework/blazor.server.js:1:26441
at Array.forEach ()
at e.invokeClientMethod (http://localhost:5000/_framework/blazor.server.js:1:26411)
sorrty i missed some js.
Hi @LeiYangGH
I am getting the same error,
what js were you missing?
Hi @LeiYangGH
I am getting the same error,
what js were you missing?
At least this: <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js"></script>