JavaScript/jQuery Funnel API
The Funnel is a widget that visualizes a value at different stages. It helps assess value changes throughout these stages and identify potential issues. The Funnel widget conveys information using different interactive elements (tooltips, labels, legend) and enables you to create not only a funnel, but also a pyramid chart.
DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.
The following code shows how to create the Funnel widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.
jQuery
var userStatistics = [ { action: "Visited the Website", users: 9152 }, { action: "Downloaded a Trial", users: 6879 }, { action: "Contacted Support", users: 5121 }, { action: "Subscribed", users: 2224 }, { action: "Renewed", users: 1670 } ]; $(function() { $("#funnel").dxFunnel({ dataSource: userStatistics, argumentField: "action", valueField: "users" }); });
<div id="funnel"></div>
Angular
<dx-funnel [dataSource]="userStatistics" argumentField="action" valueField="users"> </dx-funnel>
import { DxFunnelModule } from "devextreme-angular"; // ... export class AppComponent { userStatistics = [ { action: "Visited the Website", users: 9152 }, { action: "Downloaded a Trial", users: 6879 }, { action: "Contacted Support", users: 5121 }, { action: "Subscribed", users: 2224 }, { action: "Renewed", users: 1670 } ]; } @NgModule({ imports: [ // ... DxFunnelModule ], // ... })
AngularJS
<div ng-controller="DemoController"> <div dx-funnel="{ dataSource: userStatistics, argumentField: 'action', valueField: 'users' }"></div> </div>
angular.module('DemoApp', ['dx']) .controller("DemoController", function ($scope) { $scope.userStatistics = [ { action: "Visited the Website", users: 9152 }, { action: "Downloaded a Trial", users: 6879 }, { action: "Contacted Support", users: 5121 }, { action: "Subscribed", users: 2224 }, { action: "Renewed", users: 1670 } ]; });
Knockout
<div data-bind="dxFunnel: { dataSource: userStatistics, argumentField: 'action', valueField: 'users' }"></div>
var viewModel = { userStatistics: [ { action: "Visited the Website", users: 9152 }, { action: "Downloaded a Trial", users: 6879 }, { action: "Contacted Support", users: 5121 }, { action: "Subscribed", users: 2224 }, { action: "Renewed", users: 1670 } ] }; ko.applyBindings(viewModel);
ASP.NET MVC Controls
@(Html.DevExtreme().Funnel() .ID("funnel") .DataSource(new List<object> { new { Action = "Visited the Website", Users = 9152 }, new { Action = "Downloaded a Trial", Users = 6879 }, new { Action = "Contacted Support", Users = 5121 }, new { Action = "Subscribed", Users = 2224 }, new { Action = "Renewed", Users = 1670 } }) .ArgumentField("Action") .ValueField("Users") )
@(Html.DevExtreme().Funnel() _ .ID("funnel") _ .DataSource(New List(Of Object) From { New With { .Action = "Visited the Website", .Users = 9152 }, New With { .Action = "Downloaded a Trial", .Users = 6879 }, New With { .Action = "Contacted Support", .Users = 5121 }, New With { .Action = "Subscribed", .Users = 2224 }, New With { .Action = "Renewed", .Users = 1670 } }) _ .ArgumentField("Action") _ .ValueField("Users") )
See Also
Configuration
This section describes options that configure the Funnel widget's contents, behavior and appearance.
Name | Description |
---|---|
adaptiveLayout |
Specifies adaptive layout options. |
algorithm |
Specifies the algorithm for building the funnel. |
argumentField |
Specifies which data source field provides arguments for funnel items. The argument identifies a funnel item and represents it on the legend. |
colorField |
Specifies which data source field provides colors for funnel items. If this field is absent, the palette provides the colors. |
dataSource |
Specifies the widget's data origin. |
disabled |
Specifies whether the widget responds to the user interaction. |
elementAttr |
Specifies the attributes to be attached to the widget's root element. |
export |
Configures the exporting and printing features. |
hoverEnabled |
Specifies whether funnel items change their style when a user pauses on them. |
inverted |
Turns the funnel upside down. |
item |
Configures funnel items' appearance. |
label |
Configures funnel item labels. |
legend |
Configures the legend. |
loadingIndicator |
Configures the loading indicator. |
margin |
Generates space around the widget. |
neckHeight |
Specifies the ratio between the height of the neck and that of the whole funnel. Accepts values from 0 to 1. Applies only if the algorithm is "dynamicHeight". |
neckWidth |
Specifies the ratio between the width of the neck and that of the whole funnel. Accepts values from 0 to 1. Applies only if the algorithm is "dynamicHeight". |
onDisposing |
A function that is executed before the widget is disposed of. |
onDrawn |
A function that is executed when the widget's rendering has finished. |
onExported |
A function that is executed after the widget is exported. |
onExporting |
A function that is executed before the widget is exported. |
onFileSaving |
A function that is executed before a file with exported widget is saved to the user's local storage. |
onHoverChanged |
A function that is executed after the pointer enters or leaves a funnel item. |
onIncidentOccurred |
A function that is executed when an error or warning occurs. |
onInitialized |
A function that is executed only once, after the widget is initialized. |
onItemClick |
A function that is executed when a funnel item is clicked or tapped. |
onLegendClick |
A function that is executed when a legend item is clicked or tapped. |
onOptionChanged |
A function that is executed after a widget option is changed. |
onSelectionChanged |
A function that is executed when a funnel item is selected or the selection is canceled. |
palette |
Sets the palette to be used to colorize funnel items. |
paletteExtensionMode |
Specifies what to do with colors in the palette when their number is less than the number of funnel items. |
pathModified |
Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. |
redrawOnResize |
Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. |
rtlEnabled |
Switches the widget to a right-to-left representation. |
selectionMode |
Specifies whether a single or multiple funnel items can be in the selected state at a time. Assigning "none" disables the selection feature. |
size |
Specifies the widget's size in pixels. |
sortData |
Specifies whether to sort funnel items. |
theme |
Sets the name of the theme the widget uses. |
title |
Configures the widget's title. |
tooltip |
Configures tooltips - small pop-up rectangles that display information about a data-visualizing widget element being pressed or hovered over with the mouse pointer. |
valueField |
Specifies which data source field provides values for funnel items. The value defines a funnel item's area. |
Methods
Name | Description |
---|---|
beginUpdate() |
Prevents the widget from refreshing until the endUpdate() method is called. |
clearSelection() |
Cancels the selection of all funnel items. |
dispose() |
Disposes of all the resources allocated to the Funnel instance. |
element() |
Gets the root widget element. |
endUpdate() |
Refreshes the widget after a call of the beginUpdate() method. |
exportTo(fileName, format) |
Exports the widget. |
getAllItems() |
Provides access to all funnel items. |
getDataSource() |
Provides access to the DataSource instance. |
getInstance(element) |
Gets the instance of a widget found using its DOM node. |
getSize() |
Gets the current widget size. |
hideLoadingIndicator() |
Hides the loading indicator. |
hideTooltip() |
Hides all widget tooltips. |
instance() |
Gets the widget's instance. Use it to access other methods of the widget. |
off(eventName) |
Detaches all event handlers from a single event. |
off(eventName, eventHandler) |
Detaches a particular event handler from a single event. |
on(eventName, eventHandler) |
Subscribes to an event. |
on(events) |
Subscribes to events. |
option() |
Gets all widget options. |
option(optionName) |
Gets the value of a single option. |
option(optionName, optionValue) |
Updates the value of a single option. |
option(options) |
Updates the values of several options. |
print() |
Opens the browser's print window. |
render() |
Redraws the widget. |
showLoadingIndicator() |
Shows the loading indicator. |
svg() |
Gets the widget's SVG markup. |
Events
Name | Description |
---|---|
disposing |
Raised before the widget is disposed of. |
drawn |
Raised when the widget's rendering has finished. |
exported |
Raised after the widget is exported. |
exporting |
Raised before the widget is exported. |
fileSaving |
Raised before a file with exported widget is saved to the user's local storage. |
hoverChanged |
Raised after the pointer enters or leaves a funnel item. |
incidentOccurred |
Raised when an error or warning occurs. |
initialized |
Raised only once, after the widget is initialized. |
itemClick |
Raised when a funnel item is clicked or tapped. |
legendClick |
Raised when a legend item is clicked or tapped. |
optionChanged |
Raised after a widget option is changed. |
selectionChanged |
Raised when a funnel item is selected or the selection is canceled. |
Item
The Item object is passed to most event handlers and callback functions in an argument's field. You can also access Item objects using the getAllItems() method.
If you have technical questions, please create a support ticket in the DevExpress Support Center.