Your search did not match any results.
Charts

Auto-Calculated Bar Width

Documentation
When values for a series are not specified or are set to zero, bars that represent these values will not be visible within the chart. You can populate these empty region by extending neighboring bars via the equalBarWidth property set to false.
@(Html.DevExtreme().Chart() .ID("chart") .Palette(VizPalette.Soft) .EqualBarWidth(false) .CommonSeriesSettings(s => s .ArgumentField("State") .Type(SeriesType.Bar) ) .Series(s => { s.Add().ValueField("Oil").Name("Oil Production"); s.Add().ValueField("Gas").Name("Gas Production"); s.Add().ValueField("Coal").Name("Coal Production"); }) .Legend(l => l .VerticalAlignment(VerticalEdge.Bottom) .HorizontalAlignment(HorizontalAlignment.Center) ) .Export(e => e.Enabled(true)) .Title("Percent of Total Energy Production") .DataSource(new List<object> { new { State = "China", Oil = 4.95, Gas = 2.85, Coal = 45.56 }, new { State = "Russia", Oil = 12.94, Gas = 17.66, Coal = 4.13 }, new { State = "USA", Oil = 8.51, Gas = 19.87, Coal = 15.84 }, new { State = "Iran", Oil = 5.3, Gas = 4.39 }, new { State = "Canada", Oil = 4.08, Gas = 5.4 }, new { State = "Saudi Arabia", Oil = 12.03 }, new { State = "Mexico", Oil = 3.86 } }) )
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; 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 AutoCalculatedBarWidth() { return View(); } } }
#chart { height: 440px; }