The right-click menu on a swt chart is displayed in a wrong position: the code that calculates the coordinates manually adjusts the position without taking care of the swt display.
The result is that the menu is shown correctly if the application only shows the chart composite (since display and chart coordinates will be the same), but if you try to use the chart in a more complex interface the menu position calculated will be relative to the whole window (if you right click in the upper left corner in the chart the menu will be displayed in the upper left corner of the WINDOW).
This can be easily fixed by avoiding the manual calculation of offsets and using the standard swt canvas.toDisplay(event.x, event.y) method in ChartComposite.
The attached patch fixes ChartComposite.java, after this change the menu is shown as expected.
Log in to post a comment.