@(Html.DevExtreme().Chart()
.ID("chart")
.DataSource(new JS("populationData"))
.Series(s => s
.Add()
.Type(SeriesType.Bar)
)
.Legend(l => l.Visible(false))
.ArgumentAxis(a => a
.TickInterval(10)
.Label(l => l
.Format(f => f
.Type(Format.Decimal)
)
)
)
.Title("World Population by Decade")
)
<script src="~/data/populationData.js"></script>
using DevExtreme.AspNet.Data;
using DevExtreme.AspNet.Mvc;
using DevExtreme.NETCore.Demos.Models;
using DevExtreme.NETCore.Demos.Models.SampleData;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace DevExtreme.NETCore.Demos.Controllers {
public class ChartsController : Controller {
public ActionResult SimpleArray() {
return View();
}
}
}
var populationData = [{
arg: 1950,
val: 2525778669
}, {
arg: 1960,
val: 3026002942
}, {
arg: 1970,
val: 3691172616
}, {
arg: 1980,
val: 4449048798
}, {
arg: 1990,
val: 5320816667
}, {
arg: 2000,
val: 6127700428
}, {
arg: 2010,
val: 6916183482
}];
#chart {
height: 440px;
}