Hover

User Interaction

When a user presses or hovers over funnel items, they change their style to the one specified by the item.hoverStyle object.

jQuery
JavaScript
$(function() {
    $("#funnelContainer").dxFunnel({
        // ...
        item: {
            hoverStyle: {
                hatching: { direction: "left" }
            }
        }
    });
});
Angular
HTML
TypeScript
<dx-funnel ... >
    <dxo-item>
        <dxo-hover-style>
            <dxo-hatching direction="left"></dxo-hatching>
        </dxo-hover-style>
    </dxo-item>
</dx-funnel>
import { DxFunnelModule } from 'devextreme-angular';
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxFunnelModule
    ],
    // ...
})

If you need to disable this feature, set the hoverEnabled option to false.

jQuery
JavaScript
$(function() {
    $("#funnelContainer").dxFunnel({
        // ...
        hoverEnabled: false
    });
});
Angular
HTML
TypeScript
<dx-funnel ...
    [hoverEnabled]="false">
</dx-funnel>
import { DxFunnelModule } from 'devextreme-angular';
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxFunnelModule
    ],
    // ...
})

API

You can change a funnel item's hover state by passing true or false to the item's hover(state) method. To check whether the funnel item is currently hovered over, call its isHovered() method.

jQuery
JavaScript
var toggleItemHoverState = function (item) {
    item.hover(!item.isHovered());
}
Angular
TypeScript
import { DxFunnelModule } from 'devextreme-angular';
// ...
export class AppComponent {
    toggleItemHoverState (item) {
        item.hover(!item.isHovered());
    }
}
@NgModule({
    imports: [
        // ...
        DxFunnelModule
    ],
    // ...
})
See Also

Events

When a funnel item's hover state is being changed, the Funnel raises the hoverChanged event that you can handle with a function. If the handling function is not going to be changed during the lifetime of the widget, assign it to the onHoverChanged option when you configure the widget. To check whether the pointer entered or left a funnel item, call the item's isHovered() method.

jQuery
JavaScript
$(function() {
    $("#funnelContainer").dxFunnel({
        // ...
        onHoverChanged: function (e) {
            if (e.item.isHovered()) {
                // Commands to execute when the pointer enters the item
            } else {
                // Commands to execute when the pointer leaves the item
            }
        }
    });
});
Angular
HTML
TypeScript
<dx-funnel ...
    (onHoverChanged)="onHoverChanged($event)">
</dx-funnel>
import { DxFunnelModule } from 'devextreme-angular';
// ...
export class AppComponent {
    onHoverChanged (e) {
        if (e.item.isHovered()) {
            // Commands to execute when the pointer enters the item
        } else {
            // Commands to execute when the pointer leaves the item
        }
    };
}
@NgModule({
    imports: [
        // ...
        DxFunnelModule
    ],
    // ...
})

If you are going to change the event handler at runtime or if you need to attach several handlers to the hoverChanged event, subscribe to this event using the on(eventName, eventHandler) method. This approach is more typical of jQuery.

JavaScript
var hoverChangedHandler1 = function (e) {
    // First handler of the "hoverChanged" event
};

var hoverChangedHandler2 = function (e) {
    // Second handler of the "hoverChanged" event
};

$("#funnelContainer").dxFunnel("instance")
    .on("hoverChanged", hoverChangedHandler1)
    .on("hoverChanged", hoverChangedHandler2);
See Also