question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No chart rendered on server-hosted project

See original GitHub issue

Alas, 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:closed
  • Created 4 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
oleksiizaparacommented, May 31, 2019

I created sample pie project for blazorserverside dotnet 3.0.100-preview5-011568 https://github.com/oleksiizapara/ChartJsBlazorSample

0reactions
mariusmunteancommented, Nov 3, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found