Search code examples
angularamcharts4

amcharts 4 cursor and mouse positioning not correct


I have an angular 7 app that I am working on and don't have any issues with the chart.cursor on any other chart series except LineChart (using grouping). There seems to be an odd gap between the location of mouse and the cursor/data point it is snapping to. The gap seems to be at the bottom and right of the mouse.

The further to the right/bottom of the chart I move, the larger the gap gets, and vice versa, top/left it gets smaller. I cannot replicate this in codepen, but noticed that the data point is not aligned with the dataAxis the more I zoom in.

Is there a way to handle these gaps, or be able to use just the mouse position to interact with the chart without using a cursor? Also, just in case this is useful, it is displayed within a MatDialog.

enter image description here


Solution

  • Within the ngAfterViewInit and giving it a small timeout, seemed to correct the issue. I am guessing that the timing of loading the chart within the dialog loading had an offset of where the mouse was when each item was loading and the difference was the gap.