Funnel chart in ASP.NET MVC Accumulation Chart Component
4 Apr 202524 minutes to read
To render a funnel series, use the series Type as Funnel.
@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.
@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.
@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.
@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.
@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.
@(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.
@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;
}Mode
The Funnel chart supports both Standard and Trapezoidal modes of rendering. The default value of the FunnelMode is Standard.
Standard
The Standard funnel mode follows the traditional funnel shape, with the width continuously narrowing down to a point at the bottom.
@Html.EJS().AccumulationChart("container").Series(series =>
{
series.DataSource(ViewBag.dataSource)
.XName("XValue")
.YName("YValue")
.Width("60%")
.Height("80%")
.FunnelMode(Syncfusion.EJ2.Charts.FunnelModes.Standard)
.Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel)
.Add();
}).Render()public ActionResult Index()
{
List<FunnelChartData> chartData = new List<FunnelChartData>
{
new FunnelChartData { XValue = "Renewed", YValue = 18.20, Text = "Renewed 18.20%" },
new FunnelChartData { XValue = "Subscribe", YValue = 27.3, Text = "Subscribe 27.3%" },
new FunnelChartData { XValue = "Support", YValue = 55.9, Text = "Support 55.9%" },
new FunnelChartData { XValue = "Downloaded", YValue = 76.8, Text = "Downloaded 76.8%" },
new FunnelChartData { XValue = "Visited", YValue = 100, Text = "Visited 100%" }
};
ViewBag.dataSource = chartData;
return View();
}
public class FunnelChartData
{
public string XValue;
public double YValue;
public string Text;
}Trapezoidal
The Trapezoidal mode is a modified funnel shape where the width narrows, but features a flattened or parallel section near the top, creating a trapezoidal appearance. This mode helps compare different data points more clearly while maintaining a funnel-like structure.
@Html.EJS().AccumulationChart("container").Series(series =>
{
series.DataSource(ViewBag.dataSource)
.XName("XValue")
.YName("YValue")
.Width("60%")
.Height("80%")
.FunnelMode(Syncfusion.EJ2.Charts.FunnelModes.Trapezoidal)
.Type(Syncfusion.EJ2.Charts.AccumulationType.Funnel)
.Add();
}).Render()public ActionResult Index()
{
List<FunnelChartData> chartData = new List<FunnelChartData>
{
new FunnelChartData { XValue = "Renewed", YValue = 18.20, Text = "Renewed 18.20%" },
new FunnelChartData { XValue = "Subscribe", YValue = 27.3, Text = "Subscribe 27.3%" },
new FunnelChartData { XValue = "Support", YValue = 55.9, Text = "Support 55.9%" },
new FunnelChartData { XValue = "Downloaded", YValue = 76.8, Text = "Downloaded 76.8%" },
new FunnelChartData { XValue = "Visited", YValue = 100, Text = "Visited 100%" }
};
ViewBag.dataSource = chartData;
return View();
}
public class FunnelChartData
{
public string XValue;
public double YValue;
public string Text;
}