In this demo, the Chart widget is populated with data taken from a simple JavaScript array. It is the easiest way to provide data for the widget, and it is the right choice if you do not need to get data from the server or update data dynamically.
Feel free to share demo-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
x
Send Feedback
Thank you! We appreciate your feedback.
@(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;
using System.Linq;
namespace DevExtreme.NETCore.Demos.Controllers {
public class ChartsController : Controller {
public ActionResult SimpleArray() {
return View();
}
}
}