This is a migrated thread and some comments may be shown as answers.

Pie chart - Error! Data binding failed. Unexpected server response - see console

2 Answers 56 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Manish
Top achievements
Rank 1
Manish asked on 12 Apr 2013, 07:17 PM
I'm trying to implement pie chart from demo link: http://demos.telerik.com/aspnet-mvc/razor/chart/piechart

I'm using .NET 4.5/MVC4/ with Telerik version (TelerikControlPanel_2012_3_1214 and Telerik_Extensions_for_ASPNET_MVC_2012_3_1018_Commercial)

Two questions:
1) I'm getting below error:
Error! Data binding failed. Unexpected server response - see console
How can I troubleshoot this error?where is telerik console?

2) Can I implement server side binding with pie chart. Any samples would be great!

Here is my code:
public ActionResult PieCharts(bool? showLabels, string align, int? startAngle, int? padding, string position)
       {
           ViewBag.showLabels = showLabels ?? true;
           ViewBag.align = Enum.Parse(typeof(ChartPieLabelsAlign), align.HasValue() ? align : "Column");
           ViewBag.position = Enum.Parse(typeof(ChartPieLabelsPosition), position.HasValue() ? position :
               "OutsideEnd"); ;
           ViewBag.startAngle = startAngle ?? 90;
           ViewBag.padding = padding ?? 60;
           BusinessLayer bl = new BusinessLayer();
           return View(bl.GetProviderSummary());
 
       }
       public ActionResult _Providers()
       {
           BusinessLayer bl = new BusinessLayer();
           return Json(bl.GetProviderSummary());
       }
@using abc;
 
@{
    ViewBag.Title = "PieCharts";
}
 
<h2>PieCharts</h2>
 
 
 
@(Html.Telerik().Chart<ProviderSummary>()
      .Name("pieChart")
      //.Theme(Html.GetCurrentTheme())
      .Title("Providers")
      .Legend(legend => legend
          .Position(ChartLegendPosition.Bottom)
      )
      .Series(series => {
          series.Pie("ProviderPercentage", "ProviderName")
                .Labels(labels => labels.Visible(true).Template("<#= value #>%")
           .Align((ChartPieLabelsAlign)ViewBag.align)
                    .Position((ChartPieLabelsPosition)ViewBag.position))
                .StartAngle((int)ViewBag.startAngle).Padding((int)ViewBag.padding);
 
      })
       
     .DataBinding(dataBinding => dataBinding
          .Ajax().Select("_Providers", "Chart")
      )
 
 
      .Tooltip(tooltip => tooltip.Visible(true).Template("<#= value #>%"))
      .HtmlAttributes(new { style = "width: 500px; height: 400px;" })
)
@section HeadContent {
    <style type="text/css">
        .example .configurator
        {
            float: right;
            margin: 0 0 0 0;
            display: inline;
        }
         
        .example .configurator ul
        {
            line-height: 1.8em;
        }
         
        .t-chart
        {
            float: left;
        }
    </style>
}

Thank you!!!

2 Answers, 1 is accepted

Sort by
0
Manish
Top achievements
Rank 1
answered on 15 Apr 2013, 10:52 PM
Hello. Anyone from Telerik support monitoring this forum?
0
T. Tsonev
Telerik team
answered on 17 Apr 2013, 08:02 AM
Hi,

The error should be visible in the browser console. The console is accessible in a manner specific for each browser:

  • Internet Explorer - Open the developer tools (F12) and choose the Script tab. The console is visible on the right.
  • Firefox - Install Firebug and enable the Console tab.
  • Chrome - Open the JavaScript console (Ctrl + Shift + J).
  • Safari - Enable the Develop menu from the Preferences / Advanced dialog. Open the error console from the Develop menu.

A pie chart demo with server binding is available here: http://demos.kendoui.com/dataviz/pie-charts/remote-data.html
The full code for the MVC version is available in the offline demos.

Response time for the forums is around 72 hours. Please, use the support ticketing system if you require response within 24 hours.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Chart
Asked by
Manish
Top achievements
Rank 1
Answers by
Manish
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or