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.31k stars 533 forks source link

Chart preview 1.0.0-preview1: Unhandled exception rendering component: Cannot read properties of undefined (reading 'tooltips') #3481

Closed sturlath closed 2 years ago

sturlath commented 2 years ago

I´m trying to use Chart from version 1 preview 1 (I´m stuck with preview 1 because of ABP.io framework) but I´m hitting this error and was wondering if there was a way to go around it (without having to go to preview 2)?

If I just copy the code for the first example in the preview docs I get this error

image

rit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Cannot read properties of undefined (reading 'tooltips')
      TypeError: Cannot read properties of undefined (reading 'tooltips')
          at https://localhost:44307/_content/Blazorise.Charts/charts.js?v=1.0.0.0:12:25
Microsoft.JSInterop.JSException: Cannot read properties of undefined (reading 'tooltips')
TypeError: Cannot read properties of undefined (reading 'tooltips')
    at https://localhost:44307/_content/Blazorise.Charts/charts.js?v=1.0.0.0:12:25
   at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.IJSObjectReference, Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
   at Blazorise.Charts.JSChartModule.<Initialize>d__1`2[[System.Double, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Blazorise.Charts.LineChartOptions, Blazorise.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Blazorise.Charts.BaseChart`4.<OnAfterRenderAsync>d__2[[Blazorise.Charts.LineChartDataset`1[[System.Double, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Blazorise.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Double, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Blazorise.Charts.LineChartOptions, Blazorise.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Blazorise.Charts.LineChartModel, Blazorise.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

You can try it out in the demo project I have.

If this is something that is fixed in preview-2 or is not possible to fix in preview-1 this can be closed because then I will need to wait for ABP.io to update.

stsrki commented 2 years ago

Are you sure that ABP is updated to use Blazorise 1.0 preview? We have refactored Charts to work with charts.js v3.x and the old code would not work as they are not compatible.

sturlath commented 2 years ago

No abp.io has not been updated but should that interfere with the Blazorise Chart? I have usually used the latest Blazor stuff without updating abp.io.

Its just abp.io's Grid that I was having problems with since that is their component that wraps yours.

Here I´m just using Chart vanilla albeit preview-1 (not nr 2) and am getting this error. As you can see here the only Blazorise nuget packages are from you not them (I think).

stsrki commented 2 years ago

Blazorise v1 is working with charts v3.x. You have also included v3 in your project https://github.com/sturlath/BlazoriseVideo/blob/just_like_the_demo/src/BlazoriseVideo.Blazor/wwwroot/index.html#L25

But, ABP is still no Blazorise v0.9.x, and charts v2.x. That's the problem.

sturlath commented 2 years ago

Yes ok I now see that _Import.razor points to these

@using Volo.Abp.BlazoriseUI
@using Volo.Abp.BlazoriseUI.Components

So some abp.io package drags them in. I missed that.. OK then I´m just stuck with this until they update to version 1 (or preview) in their release/preview package. This is a difficult period to be in.. It looks like I will go to production with lots of preview packages this month 🤠.. no guts no glory they say....

stsrki commented 2 years ago

I could try updating their packages after the v1.0 release. At least the open-source version. The ABP commercial version is locked for me.

sturlath commented 2 years ago

Would be awesome if you could give it a go! I guess they will then quickly update their commercial packages. They will probably have a patch soon (hopefully after your release) and then a preview of the 5.2 version due March 8 .