These are my code
- class="demo-section k-content wide">
- @(Html.Kendo().Chart(Model)
- .Name("chart22")
- .Title("Bar Chart")
- .DataSource(dataSource =>
- {
- dataSource.Read(read => read.Action("AcccountNameBind", "Account"));
- // ds.Filter(filter => filter.Add(model => model.User_Email).IsEqualTo(User_Email));
- })
- .SeriesColors(new string[] { "#03a9f4", "#ff9800", "#fad84a", "#4caf50" })
- .Series(series =>
- {
- series.Bar(
- model => model.AccountId,
- model => model.AccountName
- );
- }) //.Tooltip(tooltip => tooltip.
- // Template("${ User_Email } - ${ Userid }%").Visible(true)
- // )
- .CategoryAxis(axis => axis
- .Name("series-axis")
- .Line(line => line.Visible(false))
- )
- .CategoryAxis(axis => axis
- .Name("label-axis")
- .Categories(m => m.AccountName)
- )
- .ValueAxis(axis => axis
- .Numeric()
- .Labels(labels => labels.Format("{0}"))
- .AxisCrossingValue(0, int.MinValue)
- )
- )
- public ActionResult AcccountNameBind()
- {
- try
- {
- var data = GetAccountData().ToList();
- var query = (from a in data
- select new
- {
- a.AccountId,
- a.AccountName,
- }).ToList();
- if (query.Count > 0)
- {
- return Json(query, JsonRequestBehavior.AllowGet);
- }
- else
- {
- return null;
- }
- }
- catch (Exception ex)
- {
- return Json(ex.Message);
- }
- }
Sachin SinghPosted Oct 22, 2020, 10:16 AM
Bhavna ChaudhriPosted Oct 22, 2020, 10:47 AM
Mageshwaran RPosted Oct 22, 2020, 10:31 AM