Jump to content
Software FX Community

Adding point dynamically


Simon

Recommended Posts

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

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.

post-2613-13922398253069_thumb.jpg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...