In short, I need to be able to do XY-Hit Test on primitives. I've attached a screen shot and although the cursor is missing I hope you understand what I'm trying to accomplish..
I've overriden the mousedown, mouseup, mousemove and onpaint methods and can therefore draw a "selection region" in the chart. The purpose is to be able to draw a selection and get a list of chart items that are within that region. That information is later used to do further drilling in the dataset. Drilling by only selection one data point is _not_ an option in my application.
So, how do I accomplish true XY-hit testing? I've found no information on the forum/web and having spent hours testing and digging the source has not gotten me anywhere.
Please Help. :)
Hi,
I am happy that you were able to resolve your inquiry. Thank you for posting this information on the forum thread. I am sure other developers will find this information useful.
Please let me know if you have additional questions regarding Primitive Hit Testing for the UltraChart.
Solved it..
As previously stated, I use UltraChart as the base class for a new user control in which I override MouseDown, MouseMove and MouseUp to be able to render the selection.
In MouseUp I ended up doing the following;
1. Use reflection to access the internal member ChartCore from the UltraChart base class.
2. Get the number of rows and columns from the data-part of the chart layer.
3. Get hold of the X and Y-axises (IAdvanceAxis) from the grid-part of the chart layer.
4. Loop the rows and columns.
5. Get the numeric value (in my case always a double) from row and column using GetValue() in the data part of the chart layer.
6. Use IAdvanceAxis.Map for the X and Y axis to get the x and y coordinates for each data point.
7. Perform a hit test on each data point in correlation to the selected region.
8. If any data points where within the boundaries of the selcetion, raise the (new) ItemSelected-event and pass a list of RowColumnItem-objects which basically only contains the row and column index of each data point that was selected.
Now I can use that data to "drill down" into my dataset. :)