ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Crosshair Type cursor with labels at X and Y
Posted by Chuck on May-27-2020 03:37
Jeff,

Do you have any example VB.NET code for an example of the mouse cursor as a Crosshair type cursor running the full width and height of the chart with Price and DateTime labels at each end?

Also, is there a way to programmatically Position the cursor to a specific DateTime and/or Price?

Thank you for your help.
Chuck

  Re: Crosshair Type cursor with labels at X and Y
Posted by Peter Kwan on May-27-2020 18:35
Hi Chuck,

There is an example for a crosshair type cursor at:

https://www.advsofteng.com/doc/cdnet.htm#crosshair.htm

Basically, in the MouseMovePlotArea event handler, you just draw a horizontal and a vertical line at the mouse position. This is the crosshair cursor. You can obtain the data value at the mouse position by using XYChart.getXValue and XYChart.getYValue. You can then draw two text boxes at the axis positions for the labels you want.

By "position the cursor to a specific DateTime and/or Price", I assume you mean to position the crosshiar cursor that is drawn by the above code. For this case, instead of starting from the mouse pixel coordinates and obtaining the data values, you can start from the provided x and y data values and use XYChart.getXCoor and XYChart.getYCoor to get back the pixel coordinates. You can then draw the crosshair and the labels in the same way.

Regards
Peter Kwan

  Re: Crosshair Type cursor with labels at X and Y
Posted by Chuck on May-27-2020 18:42
Thank you Peter, this is perfect. This tool is very enjoyable to work with and I appreciate all your help.

Best,
Chuck