or
<style type="text/css"> @import url(css/kendo.common.min.css); @import url(css/kendo.default.min.css); @import url(css/kendo.mobile.all.min.css);</style><script src="js/jquery.min.js"></script><script src="js/kendo.all.min.js"></script><script> var app = new kendo.mobile.Application($(document.body), {platform:"wp"});</script>
@(Html.Kendo().Grid<PromotionModel>() .Name("Promotions") .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(promotion => promotion.PromotionID); model.Field(promotion => promotion.PromotionID).Editable(false); model.Field(promotion => promotion.Clicks).Editable(false); model.Field(promotion => promotion.Impressions).Editable(false); model.Field(promotion => promotion.WebsiteID).DefaultValue(1); }) .Read(read => read.Action("PromotionsRead", "Promotions", new { Area = "Administration" })) .Create(create => create.Action("PromotionsCreate", "Promotions", new { Area = "Administration" })) .Update(update => update.Action("PromotionsUpdate", "Promotions", new { Area = "Administration" })) .Destroy(destroy => destroy.Action("PromotionsDestroy", "Promotions", new { Area = "Administration" })) .Events(events => events.Error("OnError")) // Handle the "error" event ) .ClientDetailTemplateId("details-template") .Columns(columns => { columns.Bound(x => x.PromotionID); columns.Bound(x => x.Title); columns.Bound(x => x.PromotionType); columns.ForeignKey(x => x.WebsiteID, (System.Collections.IEnumerable)ViewData["Websites"], "WebsiteID", "Name"); columns.Bound(x => x.ProductCode); columns.Bound(x => x.Clicks); columns.Bound(x => x.Impressions); columns.Bound(x => x.IsVisible); columns.Command(commands => { commands.Edit(); //commands.Destroy(); commands.Custom("Delete").Click("confirmDelete"); }).Title("Commands").Width(200); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(false)) .Pageable() .Events(e => e.Edit("OnEdit")) .Sortable() .Groupable() .ColumnMenu() .Filterable())<script id="details-template" type="text/x-kendo-template"> <div class="demo-section"> @(Html.Kendo().ListView<PromotionTranslationModel>() .Name("ListView_#=PromotionID#") .ClientTemplateId("translationTemplate") .TagName("div") .DataSource(ds => ds .Model(m => m.Id("RecordID")) .PageSize(3) .Create(create => create.Action("PromotionTranslationsCreate", "PromotionTranslations", new { Area = "Administration", promotionID = "#=PromotionID#" })) .Read(read => read.Action("PromotionTranslationsRead", "PromotionTranslations", new { Area = "Administration", promotionID = "#=PromotionID#" })) .Update(update => update.Action("PromotionTranslationsUpdate", "PromotionTranslations", new { Area = "Administration", promotionID = "#=PromotionID#" })) .Destroy(destroy => destroy.Action("PromotionTranslationsDestroy", "PromotionTranslations", new { Area = "Administration", promotionID = "#=PromotionID#" })) ) .Pageable() .Editable(editable => editable.TemplateName("PromotionTranslationEditTemplate")) .ToClientTemplate() ) </div></script><script type="text/x-kendo-tmpl" id="translationTemplate"> <div class="product-view k-widget"> <div class="edit-buttons"> <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span></a> <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span></a> </div> <dl> <dt>Text</dt> <dd>#:Text#</dd> <dt>Image URL</dt> <dd>#:ImageSource#</dd> <dt>Language</dt> <dd>#:LanguageID#</dd> </dl> </div></script>@model BusinessObjects.Models.PromotionTranslationModel@using Kendo.Mvc.UI;<div class="translation-view"> <dl> <dt>Text</dt> <dd> @(Html.EditorFor(p => p.Text)) <span data-for="Text" class="k-invalid-msg"></span> </dd> <dt>Image URL</dt> <dd> @(Html.EditorFor(p => p.ImageSource)) <span data-for="ImageSource" class="k-invalid-msg"></span> </dd> <dt>Language</dt> <dd> @*@(Html.EditorFor(p => p.LanguageID))*@ @(Html.Kendo().DropDownList() .Name("color") .DataTextField("Text") .DataValueField("Value") .BindTo(new List<SelectListItem>() { new SelectListItem() { Text = "Black", Value = "1" }, new SelectListItem() { Text = "Orange", Value = "2" }, new SelectListItem() { Text = "Grey", Value = "3" } }) .Value("1") ) <span data-for="LanguageID" class="k-invalid-msg"></span> </dd> </dl> <div class="edit-buttons"> <a class="k-button k-button-icontext k-update-button" href=""><span class="k-icon k-update"></span>Save</a> <a class="k-button k-button-icontext k-cancel-button" href=""><span class="k-icon k-cancel"></span>Cancel</a> </div></div> $J($chartD).kendoStockChart({ dataSource: wData, series: [{ type: "candlestick", openField: "open", closeField: "close", highField: "high", lowField: "low", categoryField: "cat", notes:{ line: { width: 2, length: 2 }, label: { font: "10px arial" } }, tooltip:{ format: "{4}:<br /> {0:n0} -- {3:n0}" } }], categoryAxis:{ categories: cats, type: "category", labels: { font: "9px arial,sans-serif", rotation: 45,// step: 0, skip: 0 } }, valueAxis: { labels: { format: "N0" } } });console.log(wData); $J($chartD).kendoStockChart({ dataSource: wData, series: [{ type: "candlestick", openField: "open", highField: "high", lowField: "low", closeField: "close" }], categoryAxis:{ categories: cats, type: "category" }, valueAxis: { labels: { format: "N0" } } });
Consider the set of data below returned from a remote data source.
[ { activityName: "Scheduled", hourlyActivities: [ { hour: 8, activityCount: 5 }, { hour: 12, activityCount: 11 } ] }, { activityName: "Cancelled", hourlyActivities: [ { hour: 8, activityCount: 1 }, { hour: 12, activityCount: 5 } ] }]I'm trying to get a basic line chart that is grouped by activityName (displayed in legend), where the x axis is hour and the y axis is activityCount? Can I get an MVVM example on how to configure the chart and data source? I was able to achieve grouping when the data source was an array of simple objects (not grouped), but I don't know where to start when the data is grouped by the server.