React 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. |
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 handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. |
onDrawn |
A function that is executed when the widget's rendering has finished. |
onExported |
A handler for the exported event. Executed after data from the widget is exported. |
onExporting |
A handler for the exporting event. Executed before data from the widget is exported. |
onFileSaving |
A handler for the fileSaving event. Executed before a file with exported data is saved on the user's local storage. |
onHoverChanged |
A handler for the hoverChanged event. Executed after a funnel item's hover state is changed in the UI or programmatically. |
onIncidentOccurred |
A handler for the incidentOccurred event. Executed when an error or warning appears in the widget. |
onInitialized |
A handler for the initialized event. Executed only once, after the widget is initialized. |
onItemClick |
A handler for the itemClick event. Executed when a user clicks a funnel item. |
onLegendClick |
A handler for the legendClick event. Executed when a user clicks a legend item. |
onOptionChanged |
A handler for the optionChanged event. Executed after an option of the widget is changed. |
onSelectionChanged |
A handler for the selectionChanged event. Executed after a funnel item's selection state is changed in the UI or programmatically. |
palette |
Sets the palette to be used for colorizing 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 when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. |
drawn |
Raised when the widget's rendering has finished. |
exported |
Raised after data from the widget is exported. |
exporting |
Raised before data from the widget is exported. |
fileSaving |
Raised before a file with exported data is saved on the user's local storage. |
hoverChanged |
Raised after a funnel item's hover state is changed in the UI or programmatically. |
incidentOccurred |
Raised when an error or warning appears in the widget. |
initialized |
Raised only once, after the widget is initialized. |
itemClick |
Raised when a user clicks a funnel item. |
legendClick |
Raised when a user clicks a legend item. |
optionChanged |
Raised after a widget option is changed. |
selectionChanged |
Raised after a funnel item's selection state is changed in the UI or programmatically. |
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.