Your search did not match any results.

Charts - Full Stacked Bar

This demo shows the full-stacked bar series that allows you to visualize data as columns stacked over each other. This series type is useful when you compare an individual series' values with total values an argument aggregates. The height of each bar is the full height of the chart diagram. The series values are displayed as percentages of each bar.

www.wikipedia.org
Backend API
@(Html.DevExtreme().Chart() .ID("chart") .CommonSeriesSettings(s => s .ArgumentField("Country") .Type(SeriesType.FullStackedBar) ) .Series(s => { s.Add().ValueField("Hydro").Name("Hydro-electric"); s.Add().ValueField("Oil").Name("Oil"); s.Add().ValueField("Gas").Name("Natural gas"); s.Add().ValueField("Coal").Name("Coal"); s.Add().ValueField("Nuclear").Name("Nuclear"); }) .Legend(l => l .VerticalAlignment(VerticalEdge.Top) .HorizontalAlignment(HorizontalAlignment.Center) .ItemTextPosition(Position.Right) ) .Title(t => t .Text("Energy Consumption in 2004") .Subtitle(s => s.Text("(Millions of Tons, Oil Equivalent)")) ) .Export(e => e.Enabled(true)) .Tooltip(t => t .Enabled(true) .CustomizeTooltip(@<text> function(arg) { return { text: arg.percentText + " - " + arg.valueText }; } </text>) ) .DataSource(new[] { new { Country = "USA", Hydro = 59.8, Oil = 937.6, Gas = 582.0, Coal = 564.3, Nuclear = 187.9 }, new { Country = "China", Hydro = 74.2, Oil = 308.6, Gas = 35.1, Coal = 956.9, Nuclear = 11.3 }, new { Country = "Russia", Hydro = 40.0, Oil = 128.5, Gas = 361.8, Coal = 105.0, Nuclear = 32.4 }, new { Country = "Japan", Hydro = 22.6, Oil = 241.5, Gas = 64.9, Coal = 120.8, Nuclear = 64.8 }, new { Country = "India", Hydro = 19.0, Oil = 119.3, Gas = 28.9, Coal = 204.8, Nuclear = 3.8 }, new { Country = "Germany", Hydro = 6.1, Oil = 123.6, Gas = 77.3, Coal = 85.7, Nuclear = 37.8 } }) )
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 FullStackedBar() { return View(); } } }
#chart { height: 440px; }

Bind to Data

In this demo, series is bound to data directly. See the Bind Series to Data article for information. The "country" field name is assigned to the argumentField property of the commonSeriesSettings object since the full-stacked bar chart contains series with the same argument field.

Specify Common Series Settings

To configure settings for all series in the chart, use the commonSeriesSettings object. For example specify the series type.

Customize Full Stacked Bar Chart

Use the verticalAlignment and horizontalAlignment properties of the legend object to specify the legend position in the chart. You can specify the text's position relative to the marker in a legend item in the itemTextPosition property.

To configure tooltips in the chart, use the tooltip object. To enable the tooltips, assign true to the enabled property of this object. If you want to customize a specific tooltip, assign a function to the customizeTooltip property. In this demo, the function returns the tooltip's text that shows the point's percent value and absolute value.

To allow a user to export your full-stacked bar chart into the PNG, JPEG, and SVG file or print the chart, set the export.enabled property to true. In this demo, the exporting is enabled and you can click the "Exporting/Printing" button in the chart. This button invokes a drop-down menu with export and print commands.