Closed huy-jack closed 2 months ago
The idea is to track cursor position using cursormoved
event by logging it in some interval variable.
Then, when click
event occurs, you can refer to that variable to know where the click occurred.
var dataItem;
cursor.events.on("cursormoved", (ev) => {
var positionX = ev.target.getPrivate("positionX");
var x = xAxis.toAxisPosition(positionX);
var dataItem = xAxis.getSeriesItem(series, x);
});
chart.events.on('click', (event) => {
console.log(dataItem);
});
This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.
Question How to get the x position to get Date when clicking on the Line Chart
I also tried this but it still does not work
App info: Angular 16, Amchart 5