这是我第一次使用剑道饼图....不知道什么是错的。
查看代码:
@(Html.Kendo().Chart<PharmaIntel_New.Models.PipeLinePieChart>()
.Name("PipeLinePipeChart")
.Legend(legend => legend
.Visible(false))
.DataSource(ds =>
{
ds.Read(read => read.Action("DrawPieChart", "PipeLineScreen").Data("PieChartData"));
})
.Series(series => series
.Pie(model => model.DrugVendorName, model => model.NetPresentValue, model => model.Color)
.Padding(0))
.Tooltip(tooltip => tooltip
.Visible(true)
.Shared(true)
//.Format("{0:N0}")
//.Template("#= category # - #= kendo.format('{0:P}', percentage)#")))
控制器代码:
public ActionResult DrawPieChart([DataSourceRequest] DataSourceRequest request, string pipeName, string pipeLineId)
{
List<PipeLinePieChart> pipeLinePieChartList = new List<PipeLinePieChart>();
PipeLinePieChart pipeLinePieChartObj;
pipeLinePieChartObj = new PipeLinePieChart();
pipeLinePieChartObj.DrugVendorName = drugVendorItem;
pipeLinePieChartObj.Color = "#ccc";
pipeLinePieChartObj.NetPresentValue = pipeLineSummaryItem.NetPresentValue;
pipeLinePieChartList.Add(pipeLinePieChartObj);
return Json(pipeLinePieChartList, JsonRequestBehavior.AllowGet);
}