Search code examples
lightningchart

How to get X value of chart in lightningchart on mousemove


i want to get x value of chart when mouse is moved over the chart

 chart[key].onSeriesBackgroundMouseMove((obj, ev)=>{

console.log('test');
    const point = obj.engine.clientLocation2Engine(ev.clientX, ev.clientY)
    const onScale = translatePoint(point, obj.engine.scale, {x:obj.getDefaultAxisX(), y:obj.getDefaultAxisY()})
    
    }

above code works only when i keep mouse over empty area , if mouse is moved over line series this function is not called.P.s there are multiple line series in chart.


Solution

  • Series have their own events, or alternatively you can disable them from mouse tracking entirely with setMouseInteractions(false)