beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.32k stars 567 forks source link

Is it possible to run on Blazor Server? #1274

Closed changingmission closed 1 year ago

changingmission commented 1 year ago

I've used LiveCharts2 for one of my project & wasm app is running in AutoMode .net 8, its not working in first run when site connected as BlazorServer rendering.

beto-rodriguez commented 1 year ago

Short answer

Yes you can, generate the image on the server then use an <img /> tag to display the image on the client:

https://livecharts.dev/docs/WPF/2.0.0-rc1/samples.general.chartToImage#build-an-image-in-the-server-side-or-console-app

More details

The Blazor package provided on NuGet is for Blazor web assembly (or WASM), both technologies (Server and WASM) are extremely different.

On WASM, LiveCharts is running on the browser, thus we can get a nice FPS rate, and nice animations, but on Blazor server there is no practical way to run LiveCharts on the server and display it in the client (with animations and all the things of the library).

I will close this for now, but feel free to reply if you need further assistance.