Search results

Funnel Chart

To render a funnel series, use the series type as Funnel.

razor
default.cs
@Html.EJS().AccumulationChart("container").Series(series =>
            {
                series.DataSource(ViewBag.dataSource)
                      .XName("xValue")
                      .YName("yValue")
                      .Name("Browser")
                      .Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel).Add();
            })
            .EnableSmartLabels(true)
            .Title("Mobile Browser Statistics")
            .LegendSettings(ls => ls.Visible(false)).Render()
)
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelChartData { xValue = "Chrome", yValue = 37 },
                new FunnelChartData { xValue = "UC Browser", yValue = 17 },
                new FunnelChartData { xValue = "iPhone", yValue = 19 },
                new FunnelChartData { xValue = "Others", yValue = 4  },
                new FunnelChartData { xValue = "Opera", yValue = 11 },
                new FunnelChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
        }

Size

The size of the funnel chart can be customized by using the width and height properties.

razor
size.cs
@Html.EJS().AccumulationChart("container").Series(series =>
            {
                series.DataSource(ViewBag.dataSource)
                      .XName("xValue")
                      .YName("yValue")
                      .Name("Browser")
                      .Width("60%")
                      .Height("80%")
                      .Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel).Add();
            })
            .EnableSmartLabels(true)
            .Title("Mobile Browser Statistics")
            .LegendSettings(ls => ls.Visible(false)).Render()
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelChartData { xValue = "Chrome", yValue = 37 },
                new FunnelChartData { xValue = "UC Browser", yValue = 17 },
                new FunnelChartData { xValue = "iPhone", yValue = 19 },
                new FunnelChartData { xValue = "Others", yValue = 4  },
                new FunnelChartData { xValue = "Opera", yValue = 11 },
                new FunnelChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
        }

Neck Size

The funnel’s neck size can be customized by using the neckWidth and neckHeight properties.

razor
neck-size.cs
@Html.EJS().AccumulationChart("container").Series(series =>
            {
                series.DataSource(ViewBag.dataSource)
                      .XName("xValue")
                      .YName("yValue")
                      .Name("Browser")
                      .NeckWidth("15%")
                      .NeckHeight("18%")
                      .Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel).Add();
            })
            .EnableSmartLabels(true)
            .Title("Mobile Browser Statistics")
            .LegendSettings(ls => ls.Visible(false)).Render()
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelChartData { xValue = "Chrome", yValue = 37 },
                new FunnelChartData { xValue = "UC Browser", yValue = 17 },
                new FunnelChartData { xValue = "iPhone", yValue = 19 },
                new FunnelChartData { xValue = "Others", yValue = 4  },
                new FunnelChartData { xValue = "Opera", yValue = 11 },
                new FunnelChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
        }

Gap Between the Segments

Funnel chart provides options to customize the space between the segments by using the gapRatio property of the series. It ranges from 0 to 1.

razor
gap.cs
@Html.EJS().AccumulationChart("container").Series(series =>
            {
                series.DataSource(ViewBag.dataSource)
                      .XName("xValue")
                      .YName("yValue")
                      .Name("Browser")
                      .GapRatio(0.08)
                      .Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel).Add();
            })
            .EnableSmartLabels(true)
            .Title("Mobile Browser Statistics")
            .LegendSettings(ls => ls.Visible(false)).Render()
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelChartData { xValue = "Chrome", yValue = 37 },
                new FunnelChartData { xValue = "UC Browser", yValue = 17 },
                new FunnelChartData { xValue = "iPhone", yValue = 19 },
                new FunnelChartData { xValue = "Others", yValue = 4  },
                new FunnelChartData { xValue = "Opera", yValue = 11 },
                new FunnelChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
        }

Explode

Points can be exploded on mouse click by setting the explode property to true. You can also explode the point on load using explodeIndex. Explode distance can be set by using explodeOffset property.

razor
explode.cs
@Html.EJS().AccumulationChart("container").Series(series =>
            {
                series.DataSource(ViewBag.dataSource)
                      .XName("xValue")
                      .YName("yValue")
                      .Name("Browser")
                      .Explode(true)
                      .ExplodeOffset("10%")
                      .ExplodeIndex(0)
                      .Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel).Add();
            })
            .EnableSmartLabels(true)
            .Title("Mobile Browser Statistics")
            .LegendSettings(ls => ls.Visible(false)).Render()
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelChartData { xValue = "Chrome", yValue = 37 },
                new FunnelChartData { xValue = "UC Browser", yValue = 17 },
                new FunnelChartData { xValue = "iPhone", yValue = 19 },
                new FunnelChartData { xValue = "Others", yValue = 4  },
                new FunnelChartData { xValue = "Opera", yValue = 11 },
                new FunnelChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
        }

Smart Data Label

It provides the data label smart arrangement of the funnel and pyramid series. The overlap data label will be placed on left side of the funnel/pyramid series.

razor
data-label.cs
@(Html.EJS().AccumulationChart("container")
                    .Series(sr =>
                    {
                        sr.Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel)
                               .XName("xValue")
                               .YName("yValue")
                               .DataLabel(dl => dl.Visible(true).Name("text").Position(Syncfusion.EJ2.Charts.AccumulationLabelPosition.Inside).Font(ft => ft.FontWeight("600")))
                               .Width("60%")
                               .Height("80%")
                               .NeckWidth("15%")
                               .GapRatio(0.03)
                               .NeckHeight("18%")
                               .Explode(true)
                               .DataSource(ViewBag.dataSource).Add();
                    })
                    .EnableSmartLabels(true)
                     .Tooltip(tp => tp.Enable(true).Format("${point.x} <br/>Composition: <b>${point.y}%</b>"))
                     .LegendSettings(leg => leg.Visible(false))
                     .Load("load").Resized("resize")
                     .Title("Top population countries in the world 2017").Render()
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelData { xValue = "China", yValue = 1409517397, text = "China" },
                new FunnelData { xValue = "India", yValue = 1339180127, text = "India" },
                new FunnelData { xValue = "United States", yValue = 324459463, text = "United States" },
                new FunnelData { xValue = "Indonesia", yValue = 263991379, text = "Indonesia" },
                new FunnelData { xValue = "Brazil", yValue = 209288278, text = "Brazil" },
                new FunnelData { xValue = "Pakistan", yValue = 197015955, text = "Pakistan" },
                new FunnelData { xValue = "Nigeria", yValue = 190886311, text = "Nigeria" },
                new FunnelData { xValue = "Bangladesh", yValue = 164669751, text = "Bangladesh" },
                new FunnelData { xValue = "Russia", yValue = 143989754, text = "Russia" },
                new FunnelData { xValue = "Mexico", yValue = 129163276, text = "Mexico" },
                new FunnelData { xValue = "Japan", yValue = 127484450, text = " Japan" },
                new FunnelData { xValue = "Ethiopia", yValue = 104957438, text = "Ethiopia" },
                new FunnelData { xValue = "Philippines", yValue = 104918090, text = "Philippines" },
                new FunnelData { xValue = "Egypt", yValue = 97553151, text = "Egypt" },
                new FunnelData { xValue = "Vietnam", yValue = 95540800, text = "Vietnam" },
                new FunnelData { xValue = "Germany", yValue = 82114224, text = "Germany" }

            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
            public string text;
        }

Customization

Individual points can be customized using the pointRender event.

razor
custom.cs
@Html.EJS().AccumulationChart("container").Series(series =>
            {
                series.DataSource(ViewBag.dataSource)
                      .XName("xValue")
                      .YName("yValue")
                      .Name("Browser")
                      .Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel).Add();
            })
            .EnableSmartLabels(true)
            .PointRender("pointRender")
            .Title("Mobile Browser Statistics")
            .LegendSettings(ls => ls.Visible(false)).Render()

<script>
            var pointRender = function (args) {
                if ((args.point.xValue as string).indexOf('iPhone') > -1) {
                    args.fill = '#f4bc42';
                     }
                       else {
                     args.fill = '#597cf9';
                     }
            };
</script>
public ActionResult Index()
        {
            List<FunnelChartData> chartData = new List<FunnelChartData>
            {

                new FunnelChartData { xValue = "Chrome", yValue = 37 },
                new FunnelChartData { xValue = "UC Browser", yValue = 17 },
                new FunnelChartData { xValue = "iPhone", yValue = 19 },
                new FunnelChartData { xValue = "Others", yValue = 4  },
                new FunnelChartData { xValue = "Opera", yValue = 11 },
                new FunnelChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class FunnelChartData
        {
            public string xValue;
            public double yValue;
        }

See Also