Jump to content
Software FX Community

Value from Xaxis based on mouse position


Bober02
 Share

Recommended Posts

Hey all,

 I am trying to get a value from xAxis by checking (somehow) current pixel value of the mouse position e.g. by using hitTest. It works ok for decimal values on X axis, but what if I have dates? I get back double value of e.g. 62089563 for a date... how can I actually use chartFX to get value from XAxis (actual DateTime object) from pixel position (or a similar technique) ?

Link to comment
Share on other sites

If you are using PixelToValue note that we return a DataUnit which have intrinsic castings to dates so you can write the following

DateTime d = chart1.AxisY.PixelToValue(300);

If you are using other API that returns a double you can use the following code

DateTime d2 = DataUnit.DoubleToDate(500);

Also note that most of our data-related properties are DataUnit so you can pass a DateTime directly to AxisY.Min/Max etc.

JuanC

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...