Jump to content
Software FX Community

Adding point dynamically


Simon
 Share

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...