No chart rendered on server-hosted project
See original GitHub issueAlas, not having any luck with a brand-new server-hosted Blazor project. I have added the nuget package to both client and server projects and followed the instructions in GitHub and on the wiki to add the example PieChart.
A couple of observations which might provide clues…
- env.WebRootPath is actually null when I run my server project. I’ve tried using this code…
if (string.IsNullOrWhiteSpace(env.WebRootPath))
{
env.WebRootPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "wwwroot");
}
ChartJsBlazor.AddStaticResourcesToWebRootPath(env.WebRootPath);
but the chart is still not displayed.
- I can’t find any way to get PieChartAnimation so have just commented out the “Animation=” assignment in the example code.
I’ve also tried the linker.xml fix suggested in #20 but this makes no difference.
I notice that the startup code in program.cs is quite different between the sample code in GitHub (which does work!) and my actual server project. Mine looks like…
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseConfiguration(new ConfigurationBuilder()
.AddCommandLine(args)
.Build())
.UseStartup<Startup>()
.Build();
}
Maybe this is a framework version problem?
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Highcharts not rendering data after build is deployed
Highcharts is not displaying graphs once deployed but the same is working fine on local host. I am using Highcharts version 9.1.2 for...
Read more >Render charts on the server side in UI for ASP.NET MVC
I have been using Kendo to drawing charts at the web client side. However, sometimes I need draw chart on the server side(MVC...
Read more >Server-side rendering a D3 chart with React 16
With React 16, we can fix that using server-side rendering and the new ReactDOM.hydrate feature. The idea is to serve a fully rendered...
Read more >What Is Server-side Rendering And How Does It Improve ...
Server -side rendering ensures that website content appears quickly, without first having to download and run application code.
Read more >Server Side Rendering - Cross Platform - How To Guides
Server Side Rendering. Normally, Apache ECharts TM renders the chart dynamically in the browser and will re-render after user interactions.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I created sample pie project for blazorserverside dotnet 3.0.100-preview5-011568 https://github.com/oleksiizapara/ChartJsBlazorSample
Yes, the server-side samples work equally well to the client-side samples. I’m closing the issue.
As always don’t hesitate to reopen it if you encounter problems.