or
@model ChartCollection
@{
ViewBag.Title =
"Dashboard"
;
}
<h2>
Dashboard
</h2>
@Html.Partial(
"_Report1"
, Model[
"ValidationResults"
])
@Html.Partial(
"_Report2"
, Model[
"ClientComponents"
])
public
class
ChartCollection : Dictionary<
string
, IChart>
{
}
01.
public
class
HomeController : Controller
02.
{
03.
public
ActionResult Index()
04.
{
05.
ViewBag.Message =
"Welcome to ASP.NET MVC!"
;
06.
07.
return
View();
08.
}
09.
10.
public
ActionResult About()
11.
{
12.
ChartCollection charts =
new
ChartCollection();
13.
14.
IChart chart;
15.
16.
/// How do I duplicate this logic in the Controller?
17.
@(Html.Kendo().Chart()
18.
.Name(
"ClientComponents"
)
19.
.Title(
"Components"
)
20.
.DataSource(ds =>
21.
{
22.
ds.Model(model =>
23.
{
24.
foreach
(DataColumn col
in
Model.QueryResults.Columns)
25.
{
26.
model.Field(col.ColumnName, col.DataType);
27.
}
28.
});
29.
}
30.
)
31.
.Legend(legend => legend.Visible(
true
).Position(ChartLegendPosition.Bottom))
32.
.Series(series => series.Bar(
new
int
[] {2,4,6}).Name(
"MyValues"
))
33.
.CategoryAxis(yaxis => yaxis.Categories(
new
string
[] {
"Hello"
,
"World"
}))
34.
.Tooltip(tip => tip.Visible(
true
)) )
35.
36.
/// Add the IChart to the ChartCollection
37.
charts.Add(chart.Name, chart)
38.
return
View(charts);
39.
}
40.
}
<
div
data-role
=
"view"
data-title
=
"Test View"
id
=
"testView"
>
<
div
>
<
input
type
=
"search"
value
=
""
id
=
"searchfor"
class
=
"k-textbox"
placeholder
=
"Search..."
/>
</
div
>
<
div
data-role
=
"scroller"
>
<
ul
data-role
=
"listview"
id
=
"customersListview"
data-type
=
"group"
></
ul
>
</
div
>
</
div
>
<
div
id
=
"grid"
></
div
>
<
script
>
var remoteDataSource = new kendo.data.DataSource(
{
transport:
{
read: {
type: "POST",
dataType: "json",
url: "/home/getopportunities/"
}
},
pageSize: 4
})
$("#grid").kendoGrid(
{
dataSource: remoteDataSource,
columns: [
{
title: "Title",
headerAttributes: {
style: "text-align:center"
},
attributes: {
"class": "table-cell"
},
width: 600,
filterable: true
},
{
title: "Activity Type",
headerAttributes: {
},
attributes: {
"class": "table-cell",
style: "text-align:center"
},
width: 100,
filterable: true
},
{
title: "Specialty",
filterable: true,
headerAttributes: {
style: "text-align:center"
},
attributes: {
"class": "table-cell",
style: "text-align:center"
}
},
{
title: "Total Credits",
format: "{0}",
headerAttributes: {
style: "text-align:center"
},
attributes: {
"class": "table-cell",
style: "text-align:center"
}
}
],
height: 430,
scrollable: true,
sortable: true,
pageable: true,
filterable: {
extra: false,
operators: {
string: {
contains: "Contains",
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
},
number: {
eq: "Is equal to",
neq: "Is not equal to",
gte: "Greater Than",
lte: "Less Than"
}
}
}
});
</
script
>
[
{
"ActivityID"
:367,
"Title"
:
"Non Webinar Test For Calendar"
,
"ActivityType"
:
"Other"
,
"TotalCredits"
:2,
"Specialty"
:
"[AB] [AE]"
},
{
"ActivityID"
:370,
"Title"
:
"Stage - Test SI Changes Part II"
,
"ActivityType"
:
"Other"
,
"TotalCredits"
:2,
"Specialty"
:
"[NE]"
},
{
"ActivityID"
:374,
"Title"
:
"Webinar Test Event For Calendar"
,
"ActivityType"
:
"Webinar"
,
"TotalCredits"
:2,
"Specialty"
:
"[FE] [NE] "
},
{
"ActivityID"
:401,
"Title"
:
"Module #1 Webinar: Learn Stuff"
,
"ActivityType"
:
"Webinar"
,
"TotalCredits"
:2,
"Specialty"
:
"[AB] "
,},
{
"ActivityID"
:403,
"Title"
:
"Module #3 Webinar: Learn Even More Stuff"
,
"ActivityType"
:
"Webinar"
,
"TotalCredits"
:2,
"Specialty"
:
"[AB] [AE]"
,}
]