Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:26:50+00:00 2026-06-01T08:26:50+00:00

Since yesterday, I try to run a sample of code to display a chart

  • 0

Since yesterday, I try to run a sample of code to display a chart with FusionCharts and Mvc3 Razor and nothing works. Please…. help!!! 🙂

Here is what I have done:

  1. I took the projet from Libero. here

  2. After that, I used the project convertor here to upgrade the project from Mvc2 to Mvc3.

  3. When I try to run to code (F5 and show the result in browser), that works fine; all graphics are displayed correctly.

If I just create a new view with razor (.cshtml) instead of the current .aspx (replacing a view from the old syntax to the new razor) and I try to displayed the same graphic, the page is displayed correctly but without graphic. When I look into the page source with firebug or any other tools, no code is behind the scene. I also don’t have any errors while looking with the Web Developer tool in Firefox.

I just tried to add a Html.Raw in front of the code that generate the javascript to not encode the output and I have the same result. Also trying with returning HtmlString but again same result; no graphic is displayed.

The key to don’t miss in this problem is that if I try the exact same code but with an .aspx file, all is correct.

In .aspx, the code looks like this:

<%=Html.FChart("Chart01", ViewData["MyChart"], 600, 400)%>

And in .cshtml:

@{Html.FChart("Chart01", ViewData["MyChart"], 600, 400); }

And finally, the html helper to generate this bunch of code:

  private static string RenderChart(string controlId, string xmlData, FusionChartBase chart, int width, int height)
  {
     String sControlId = controlId;
     String sJsVarId = "_lib_JS_" + controlId;
     String sDivId = "_lib_DIV_" + controlId;
     String sObjId = "_lib_OBJ_" + controlId;
     String sWidth = width.ToString();
     String sHeight = height.ToString();

     StringBuilder oBuilder = new StringBuilder();

     oBuilder.AppendLine(@"<div id=""" + sDivId + @""" align=""center""></div>");

     oBuilder.AppendLine(@"<script type=""text/javascript"">");

     oBuilder.AppendLine(@"var " + sControlId + @" = (function() {");
     oBuilder.AppendLine(@"    return {");
     oBuilder.AppendLine(@"        containerId: '" + sDivId + "',");
     oBuilder.AppendLine(@"        xmlData: '',");
     oBuilder.AppendLine(@"        chartType: '',");
     oBuilder.AppendLine(@"        showChart: function() {");
     oBuilder.AppendLine();
     oBuilder.AppendFormat(@"          var chartURL = '{0}' + this.chartType.replace('Chart', '{1}');", UrlSWF, SufixSWF);
     oBuilder.AppendLine(@"            var " + sJsVarId + @" = new FusionCharts(chartURL, """ + sObjId + @""", """ + sWidth + @""", """ + sHeight + @""");");
     oBuilder.AppendLine(@"            " + sJsVarId + @".setDataXML(this.xmlData);");
     oBuilder.AppendLine(@"            " + sJsVarId + @".render(""" + sDivId + @""");");
     oBuilder.AppendLine(@"        }");
     oBuilder.AppendLine(@"    }");
     oBuilder.AppendLine(@"})();");

     oBuilder.AppendLine(@"setTimeout(function(){");
     oBuilder.AppendLine(@"    " + sControlId + @".xmlData = """ + xmlData.Replace(@"""", @"'") + @""";");
     oBuilder.AppendLine(@"    " + sControlId + @".chartType = """ + chart.ChartType + @""";");
     oBuilder.AppendLine(@"    " + sControlId + @".showChart();");
     oBuilder.AppendLine(@"},0);");

     oBuilder.AppendLine(@"</script>");

     return oBuilder.ToString();
  }

I don’t know if I must set some configuration options in the web.config or what I don’t understand in the behavior of Mvc2 compare to Mvc3, but it’s very frustrating.

If you have any idea, a big thanx in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:26:52+00:00Added an answer on June 1, 2026 at 8:26 am

    It should be @Html.FChart("Chart01", ViewData["MyChart"], 600, 400) instead of @{Html.FChart("Chart01", ViewData["MyChart"], 600, 400); }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has happened since yesterday, some razor views display like this in visual studio:
I run a high volume website and since yesterday it's not working. My server
Since yesterday, all blue dots (compiled lines) in my source code are shifted with
Since yesterday, I am analyzing one of our project with Ndepend (free for most
Since yesterday, I've been facing a compiling error for my C project. The project
Since Embarcadero's NNTP server stopped responding since yesterday, I figured I could ask here:
I have been using a demo site since yesterday and made a version on
I am trying to solve a little problem since yesterday, but no solution found
Using Xcode 4.3.2. Since yesterday, I can't upload to ITunes Store. I can't find
I am developing an app on facebook. Since yesterday the resizing worked fine with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.