Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.26k stars 526 forks source link

Using Blazorise Charts - Could not find 'blazoriseCharts' in 'window' #288

Closed andrewwilkin closed 4 years ago

andrewwilkin commented 4 years ago

Not sure where I'm going wrong, probably something I'm doing for sure. Trying to create a Sparkline bar chart, before I connect real data want to see how it looks but get this error in the console: blazor.webassembly.js:1 WASM: Microsoft.JSInterop.JSException: Could not find 'blazoriseCharts' in 'window'.

I've done the following:

Have looked through the example code here and cannot see anything obvious though am using BarChart instead of Chart: https://github.com/stsrki/Blazorise/blob/master/Tests/Blazorise.Demo/Pages/Tests/ChartsPage.razor

I can see the canvas generated in the source. Can you point me to the likely error of my ways please :)

stsrki commented 4 years ago

You also need to add path to the charts js. See here This is now a preferred way to handle static files for razor class libraries.

It seems I will also need to mention this in documentation for chart extension.

andrewwilkin commented 4 years ago

Thanks - that works now 👍

Is there much control over how the chart appears? As wanted to create a Sparkline chart so no axis, labels, etc?

stsrki commented 4 years ago

I guess it can be done, but you would probably need to look at the official chartjs documentation for that kind of stuff.

stsrki commented 4 years ago

Added to documentation