Hi,
I have a scatter chart and I use the DataItemOver event to get the datapoint that is "highlighted".
I want to be able to add a vertical line that goes from this point all the way to X axis and a horizontal line that goes from this point all the way to Y axis.
I can get the coordinates of the axis with the StartPoint property of the axis.
I need to get the coordinates (X,Y) of the DataPoint. How can I get that information?
Thanks,
Imad
You can do something like this:Point MouseLocation { get; set; }Point PointLocation { get; set; }double X { get; set; }double Y { get; set; }
in Form_Load:ultraChart1.DataItemOver += (o, args) => { object[] values = args.Primitive.Value as object[]; X = (double)values[0]; Y = (double)values[1]; PointLocation = MouseLocation; ultraChart1.InvalidateLayers();};
ultraChart1.MouseMove += (o, args) => MouseLocation = args.Location;
in FillSceneGraph event you can either use PointLocation to draw the lines, or you can use axis mapping functions to convert X and Y properties to screen coordinates.
Max,
Do you mind explaining a bit more on the axis mapping functions, please?
I am in need of a similar function.
Redraw a column chart based on a users mouse down/mouse drag/mouse up event in the chart area.
Thanks
Anil
Got it from another post, suggested by you.!!
Got it this way..
IAdvanceAxis xAxis;
IAdvanceAxis yAxis;
....
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
valid =
true;
if (e.Grid.Count == 0) return;
xAxis = (
IAdvanceAxis)e.Grid["X"];
yAxis = (
IAdvanceAxis)e.Grid["Y"];
...
..
}
private void ultraChart1_MouseDown(object sender, MouseEventArgs e)
mouseDown =
private
if (mouseDown)
Debug.WriteLine("Current point: " + xAxis.MapInverse(e.X) + ", " + yAxis.MapInverse(e.Y));
void ultraChart1_MouseMove(object sender, MouseEventArgs e)