I have a pie chart that is populated via a remote datasource that returns JSON. I now want to add a grid that will use the same data. When I implement the shared data source for the pie chart it calls the action to get the data but the pie chart no longer shows.
This Works:
@(Html.Kendo().Chart<PortalApp.Areas.TaskManagement.Features.Reporting.Index.Vendor> ()
.Name("chart1")
.Title(title => title
//.Text("Vendor - Total Assigned: 27564")
.Text("Vendor")
.Position(ChartTitlePosition.Top))
.Legend(legend => legend
.Visible(false)
)
.ChartArea(chart => chart
.Background("transparent")
.Height(300)
)
.SeriesColors(new string[] { "#9de219", "#90cc38", "#068c35", "#006634", "#004d38", "#033939" })
.DataSource(ds => ds.Read(read => read.Action("GetVendorGraph", "Reporting")))
//.DataSource("graphOneDS")
.Series(series =>
{
series.Pie(m => m.value, m => m.category)
.Padding(0)
.Labels(labels => labels
.Template("#= dataItem.category #: #= dataItem.value2 #")
.Background("transparent")
.Visible(true)
)
.StartAngle(210);
})
.Tooltip(tooltip => tooltip
.Visible(true)
.Template("#= dataItem.category #: #= dataItem.value #% (#= dataItem.value2 # Review Tasks Assigned)</br>Outstanding Requests: #= dataItem.value3 #</br>Outstanding Questions: #= dataItem.value4 #")
)
.Deferred(true)
)
This Doesn't
@(Html.Kendo().DataSource<PortalApp.Areas.TaskManagement.Features.Reporting.Index.Vendor>()
.Name("graphOneDS")
.Ajax(dataSource => dataSource
.Read(read => read.Action("GetVendorGraph", "Reporting"))
)
.Deferred(true)
)
@(Html.Kendo().Chart<PortalApp.Areas.TaskManagement.Features.Reporting.Index.Vendor> ()
.Name("chart1")
.Title(title => title
//.Text("Vendor - Total Assigned: 27564")
.Text("Vendor")
.Position(ChartTitlePosition.Top))
.Legend(legend => legend
.Visible(false)
)
.ChartArea(chart => chart
.Background("transparent")
.Height(300)
)
.SeriesColors(new string[] { "#9de219", "#90cc38", "#068c35", "#006634", "#004d38", "#033939" })
//.DataSource(ds => ds.Read(read => read.Action("GetVendorGraph", "Reporting")))
.DataSource("graphOneDS")
.Series(series =>
{
series.Pie(m => m.value, m => m.category)
.Padding(0)
.Labels(labels => labels
.Template("#= dataItem.category #: #= dataItem.value2 #")
.Background("transparent")
.Visible(true)
)
.StartAngle(210);
})
.Tooltip(tooltip => tooltip
.Visible(true)
.Template("#= dataItem.category #: #= dataItem.value #% (#= dataItem.value2 # Review Tasks Assigned)</br>Outstanding Requests: #= dataItem.value3 #</br>Outstanding Questions: #= dataItem.value4 #")
)
.Deferred(true)
)