I'd like to be able to determine which x-axis and y-axis value corresponds to a given mouse coordinate of the chart control. That is, I want to be able to map mouse coordinates on the chart control to data coordinates. Is this possible?
Thanks!
fm
Also, can you point me to samples, docs, demos, feature lists, etc. that show chart interactivity? I'm having trouble getting a feel for "the Infragistics way" of doing chart interactivity; specifically, with line charts.
Thanks, but that's not going to help me much. I need to be able to do coordinate transforms between line chart data coordinates and screen pixel coordinates. The support is there for bar charts, but with line charts, you have to hover over the data vertices to get any interactivity. Unfortunately, this isn't going to work for me - I need to be able to transform any given screen pixel into data coordinates regardless of whether or not there's a data point at the screen coordinate in question; that is, I need to be able to hover (or click) anywhere in the chart's data area, including blank space, and get data coordinates.
Thanks,
IAdvanceAxis xAxis;IAdvanceAxis yAxis;
private void ultraChart1_MouseMove(object sender, MouseEventArgs e){ if (xAxis == null || yAxis == null) return;
Debug.WriteLine("Current point: " + xAxis.MapInverse(e.X) + ", " + yAxis.MapInverse(e.Y));}
Thanks for your answer !
I noticed that FillSceneGraph is called multiple times, my problem was that I was simply not getting the grid object from the proper ChartLayer.
I fought that using ChartLayers[0] as you suggested would work because I needed the axes from my first layer, but what happened is that Visual Studio 2008 designer added multiple layers when I played with the chart wizard. So I ended up with nearly 60 chart layers :s I removed them and now everything's fine.
Thanks again.
FillSceneGraph can fire multiple times based on how you created your chart. It's possible for the axes to be uninitialized on one of the initial passes through FillSceneGraph. However, in my attempts, I got properly initialized axes. So if this doesn't work for you, I would need more information about your chart. Sample code will help as well.
I did like you said but the two axes I get from grid["X"] and grid["Y"] seem to be "uninitialized", I mean all values like min or max are equal to 0 and are not those I set in the AxisItem objects I'm using as axes in the layers.
I searched in documentation but didn't find anything :( is there anywhere else I could look ?
Thanks
For composite charts you have to get the Grid from the chart layer itself and not from event args. Like so:Hashtable grid = ultraChart1.CompositeChart.ChartLayers[0].ChartLayer.Grid;
Hello,
I have the same need as floyd_may, I tried to use the code you provided but I keep getting "e.Grid.Count = 0" in the FillSceneGraph method, so the xAxis and yAxis objects are never assigned.
I may add that I have data plotted in my chart, a composite chart in fact, containing multiple scatter charts
Any idea ?
Thanks !