I have added two OHLCSeries to my chart. And the AutoCursor snaps between them. What event should I be listening to in order to capture when the AutoCursor has snapped to a new target? How do I figure out which of my two Series is being targeted? How do I figure out which item in my original dataset is being targeted (the dataset I added to the series using the add function)? Thanks
It's not pretty, but I found a solution here: https://lightningchart.com/lightningchart-js-interactive-examples/edit/lcjs-example-0703-customHTMLCursor.html?isList=true
chart.onSeriesBackgroundMouseMove((_, event) => {
// Get mouse location
const mouseLocationClient = {
x: event.clientX,
y: event.clientY,
};
// Translate mouse location to coordinate system for solving data points from series, and translating to Axes.
const mouseLocationEngine = chartL.engine.clientLocation2Engine(
mouseLocationClient.x,
mouseLocationClient.y,
);
// Translate mouse location to X Axis.
const mouseLocationAxisX = translatePoint(mouseLocationEngine, dashboard.engine.scale, {
x: chartL.getDefaultAxisX(),
y: chartL.getDefaultAxisY(),
}).x;
// Use mouseLocationAxisX to match with index in your original data sets
});