Simon Posted April 25, 2007 Report Share Posted April 25, 2007 Hi, I want to implement a function that will add point dynamically in my chart by clicking anywhere in the chart. To do this, I need to get the mouse coordinate relative to my axis. I found some methods in HitTestEventArgs, like AbsoluteLocation and Location but I don't know how to convert this location in my axis coordinate. Any idea? Thanks Simon Quote Link to comment Share on other sites More sharing options...
Frank Posted April 25, 2007 Report Share Posted April 25, 2007 Axis.PixelToValue will convert your location to the logical equivalent for that axis. Normally, for a chart with just one Y-Axis and one X-Axis you will do: double x = chart.AxisX.PixelToValue(e.Location.X); double y = chart.AxisY.PixelToValue(e.Location.Y); This may change if you have multiple axes/panes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.