Topic: getPointDataAtEvent Showing the yaxis value show how to get the xaxis value or the index position in bar chart

AFA premium asked 3 years ago


Expected behavior How to get the Xaxis value or Index position after click on the any of the bar in Bar chart. Actual behavior getPointDataAtEvent Showing only yaxis Data on it. Resources (screenshots, code snippets etc.)


Arkadiusz Idzikowski staff answered 3 years ago


@AFA You can try to get information about the data index from the click event:

  public chartClicked(e: any): void {
    const data = this.chart.getPointDataAtEvent(e);
    const dataIndex = e.active[0]._index;
    console.log(data);
    console.log(dataIndex);
  }


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB4 8.2.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No