WPF HitTesting on Stock Candle/Bar Data?


https://www.nevron.com/Forum/Topic14236.aspx
Print Topic | Close Window

By - 3 Years Ago
In my WPF code, I'm calling

var hitElement = chartControl.HitTest(mouseEvent.Location.X, mouseEvent.Location.Y);

inside a mouse click handler, and I'm getting a DataPoint hit back correctly. This is working well.

When I click on a data point in a stock series that has OHLC data displayed as a bar or stick, will I be able, through hit testing, have any way of knowing whether the Open, Close, High or Low portion of that data point was clicked?
By Nevron Support - 3 Years Ago

  Hi,

No unfortunately this information is not available in the hit test result. You can however perform a view to scale transformation:

NChart chart = (NChart)nChartControl1.Charts[0];
NViewToScale2DTransformation view2Scale = new NViewToScale2DTransformation(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY);

NVector2DD scalePoint = new NVector2DD();
view2Scale.Transform(new NPointF(e.X, e.Y), ref scalePoint);

and determine how the point is positioned relative to the OHLC range.

We hope this helps - let us know if you have any questions.