VisualBasic.net framework 4.0 Windows 7 uses chart controls to display candle feet.
At this time, I would like to detect which candle feet were clicked by clicking the mouse on the chart for each candle foot, chart.series.item().
Could you please let me know if there is any information that can give me a hint?
Thank you for your cooperation.
vb.net
The Chart
control provides the HitTest
method, which allows you to specify coordinates on the control to examine the objects drawn at that location.Take advantage of this in the Click
event
'Find cursor position
Dimpos=DirectCast(e, MouseEventArgs).Location
// DETERMINATION OF ELEMENTS IN CURSOR POSITION
Dim result=Chart1.HitTest(pos.X, pos.Y, ChartElementType.DataPoint)
// determine if there are applicable data points
If result.ChartElementType=ChartElementType.DataPoint Then
Dimdp=result.Series (result.PointIndex)
// appropriate treatment
You can distinguish DataPoint
by performing a hit test with and looking at the results ChartElementType
, Series
, PointIndex
.If MouseEventArgs
is not available, Chart1.PointToClient(MousePosition)
will prompt for cursor position.
578 Understanding How to Configure Google API Key
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
917 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
582 PHP ssh2_scp_send fails to send files as intended
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.