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 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.