Search results

Funnel Chart

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

razor
default.cs
@using Syncfusion.EJ2;
@section ControlsSection{   
@(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
@using Syncfusion.EJ2;
@section ControlsSection{   
@(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
@using Syncfusion.EJ2;
@section ControlsSection{   
@(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
@using Syncfusion.EJ2;
@section ControlsSection{   
@(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
@using Syncfusion.EJ2;
@section ControlsSection{   
@(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;
        }

Customization

Individual points can be customized using the pointRender event.

razor
custom.cs
@using Syncfusion.EJ2;
@section ControlsSection{   
@(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