Your search did not match any results.

Drill-Down Chart

This demo shows a drill-down chart that visualizes data on two hierarchical views. The main view displays the population breakdown by continent. When you click the bar, a detailed view reveals the most populated countries on the selected continent.

Bind to Data

This demo binds the drill-down chart to an array of objects. To visualize hierarchical data in the drill-down chart, filter the data source by the parentID for different drill-down views in the filterData function.

Implement View Navigation

To navigate from the main view to a detailed view, filter the data source by a different parentID in the onPointClick event handler. To navigate back, click the Back button. This action resets the data source filter. Use the isFirstLevel flag to distinguish views.

Customize the Appearance

Use the customizePoint function to change the individual point properties. This function returns an object with properties that should be changed for a certain point. In this demo, this function changes the color and hoverStyle properties.

Backend API
@(Html.DevExtreme().Chart() .ID("chart") .Series(s => { s.Add().ArgumentField("Arg") .ValueField("Val").Type(SeriesType.Bar).TagField("ParentID"); }) .Title("The Most Populated Countries by Continents") .ValueAxis( a => a.Add() .ShowZero(false) ) .CustomizePoint("customizePoint") .Legend(l => l.Visible(false)) .DataSource(d => d.Mvc().Controller("WorldPopulationData").LoadAction("Get")) .DataSourceOptions(o => o.Filter("['ParentID', '']")) .OnPointClick("pointClickHandler") ) <div class="button-container"> @(Html.DevExtreme().Button() .ID("backButton") .Text("Back") .Icon("chevronleft") .Visible(false) .OnClick("buttonClickHandler") ) </div> <script> var isFirstLevel = true, colors = ["#6babac", "#e55253"], chartContainer; $(function () { chartContainer = $("#chart"); addPointerCursor(); }); function customizePoint() { var pointSettings = { color: colors[Number(isFirstLevel)] }; if (!isFirstLevel) { pointSettings.hoverStyle = { hatching: "none" }; } return pointSettings; } function buttonClickHandler() { if (!isFirstLevel) { isFirstLevel = true; addPointerCursor(); refreshDataSource(""); this.option("visible", false); } } function pointClickHandler(e) { if (isFirstLevel) { isFirstLevel = false; removePointerCursor(chartContainer); refreshDataSource(; $("#backButton") .dxButton("instance") .option("visible", true); } } function refreshDataSource(argument) { var dataSource = chartContainer.dxChart("instance").getDataSource(); dataSource.filter(["ParentID", argument]); dataSource.load(); } function addPointerCursor() { chartContainer.addClass("pointer-on-bars"); } function removePointerCursor() { chartContainer.removeClass("pointer-on-bars"); } </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 ChartsDrillDown() { return View(); } } }
#chart { height: 440px; width: 100%; } #chart.pointer-on-bars .dxc-series rect { cursor: pointer; } .button-container { text-align: center; height: 40px; position: absolute; top: 7px; left: 0px; }