All docs
V22.1
24.1
23.2
23.1
22.2
22.1
21.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

jQuery Funnel - User Interaction

A user can interact with the legend by hovering the pointer over legend items. This causes the onHoverChanged event handler to execute. Refer to the Funnel Item Hover Events topic for details.

In addition, a user can click legend items. The UI component does not react to this by default, but you can instruct it to by handling the legendClick event. If the handling function is not going to be changed at runtime, assign it to the onLegendClick property when you configure the UI component.

jQuery

Otherwise, or if you need several handlers for the legendClick event, subscribe to it using the on(eventName, eventHandler) method.

JavaScript
$(function() {
    $("#funnelContainer").dxFunnel({
        // ...
        onLegendClick: function (e) {
            var item = e.item;
            // Event handling commands go here
        }
    });

    // ===== or =====
    var legendClickEventHandler1 = function (e) {
        var item = e.item;
        // First handler of the "legendClick" event
    };

    var legendClickEventHandler2 = function (e) {
        var item = e.item;
        // Second handler of the "legendClick" event
    };

    $("#funnelContainer").dxFunnel("instance")
        .on("legendClick", legendClickEventHandler1)
        .on("legendClick", legendClickEventHandler2);
});
Angular
HTML
TypeScript
<dx-funnel ...
    (onLegendClick)="onLegendClick($event)">
</dx-funnel>
import { DxFunnelModule } from "devextreme-angular";
// ...
export class AppComponent {
    onLegendClick (e) {
        var item = e.item;
        // Event handling commands go here
    }
}
@NgModule({
    imports: [
        // ...
        DxFunnelModule
    ],
    // ...
})
Vue
App.vue
<template> 
    <DxFunnel ...
        @legend-click="onLegendClick" 
     />
</template>

<script>
import DxFunnel from 'devextreme-vue/funnel';

export default {
    components: {
        DxFunnel
    },
    methods: {
        onLegendClick (e) {
            var item = e.item;
            // Event handling commands go here
        }
    }
}
</script>
React
App.js
import React from 'react';
import Funnel from 'devextreme-react/funnel';

class App extends React.Component {
    render() {
        return (
            <Funnel ...
                onLegendClick={this.onLegendClick} 
             />
        );
    }
    onLegendClick(e) {
        var item = e.item;
        // Event handling commands go here
    }
}

export default App;
See Also