How to add a click event on amchart NavigationBar?

122 views Asked by At

I want to add a click event when I click some link in Amchart Navigation Bar, my code:

chart.navigationBar = new am4charts.NavigationBar();
chart.navigationBar.events.on('hit', (ev) => {
    console.log(ev);
});

I just don't know how to get the link text I clicked. Say, I have navigation "Home > Help > Question", if I click "Home", how can I get the text "Home" from the click event, so I can do corresponding operation?

1

There are 1 answers

0
www.amitpatil.me On

This will give you text of clicked link

chart.navigationBar.events.on("hit", ev => {
   console.log(ev.target.activeLink.currentText);
},this);