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

Impossible to use charts #289

Closed Flearz closed 4 years ago

Flearz commented 4 years ago

Hello, I got issue using charts. I create a new WASM Blazor (3.0.0-preview9.19465.2) project and I follow the Blazorise installation steps conscientiously (I'm not sure I understood the "static files" part, but I looked at your test project and the same index.html... ). Then I install the charts but when I write the test code in my page, firstly I got "CS011: 'generatedCounter.OnAfterRenderAsync()' " and If I comment this my chart doesn't draw when I click "Redraw". Thanks in advance

stsrki commented 4 years ago

Make sure that you add static files to index.html <script src="_content/Blazorise.Charts/blazorise.charts.js"></script>

Also maybe you're missing a line @using Blazorise.Charts from _Imports.razor file

Flearz commented 4 years ago

Thanks for your answer, I did this, but it is still not working, a friend who's using charts too used it in version 3.0.0-preview9.19457.4 and it is working (With a lot of errors in the browser console). I will upload my project on my github pages if you want to have a look (flearz.github.io). Thanks in advance.

stsrki commented 4 years ago

Please upload your project so I can get a better look.

Flearz commented 4 years ago

It's done, https://github.com/Flearz/flearz.github.io in source

stsrki commented 4 years ago

Just add this and it should work

protected override async Task OnAfterRenderAsync( bool firstRender )
{
    if ( firstRender )
    {
        await HandleRedraw();
    }
}
Flearz commented 4 years ago

Woaw, fixed it, maybe it would be good to change it too in the example code on your website. Thank you :)

stsrki commented 4 years ago

Docs updated!