This question is locked. New answers and comments are not allowed.
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:
Thank you!!!
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!!!