How can I display the values of X-Axis and Y-Axis when the mouse is moved anywhere within the chart area (like the picture)?
The HitTest
method can not be applied for moving or it can only be applied for clicking on the chart?
Please help me. Thanks in advance.
Actually the
Hittest
method works just fine in aMouseMove
; its problem is that it will only give a hit when you are actually over aDataPoint
.The
Values
on theAxes
can be retrieved/converted from pixel coordinates by these axis-functions:Note that they will not work while the chart is busy laying out the chart elements or before it has done so.
MouseMove
is fine, though.Also note that the example displays the raw data while the x-axis labels show the data as
DateTimes
. Useor something similar to convert the values to dates!
The check for being inside the actual plotarea uses these two useful functions:
If you want to you can cache the
InnerPlotPositionClientRectangle
; you need to do so when you change the data layout or resize the chart.