lakshmimn Posted May 8, 2008 Report Share Posted May 8, 2008 Hi all, I need to draw vertical lines on the chart on MouseMove. The line should move whenever the cursor moves. I dont want to use CustomGridLines for this. Could you please let me know how to achieve this Quote Link to comment Share on other sites More sharing options...
Frank Posted May 8, 2008 Report Share Posted May 8, 2008 > I dont want to use CustomGridLines for this Why not? Custom Gridlines offer the easiest way to achive this. Quote Link to comment Share on other sites More sharing options...
lakshmimn Posted May 9, 2008 Author Report Share Posted May 9, 2008 The verical line should be drawn on the chart when there is a mouse over event. It should act like a vertical pointer on the chart (the line should have the height as that of the chart), and the details of each of the data points (each point on X axis) on the chart, will be shown in a small popup window. I tried the CustomGridLine, but this line does not move smoothly along each of the points on x axis, on mouse move it directly jumps to the next vertical line in the Grid. Quote Link to comment Share on other sites More sharing options...
amankazi Posted May 9, 2008 Report Share Posted May 9, 2008 Hi Frank, Can we change the cursor of the mouse to a Vertical line in side the graph area and get the X and Y axis scale data ? If Yes, please provide a work around. Quote Link to comment Share on other sites More sharing options...
Frank Posted May 9, 2008 Report Share Posted May 9, 2008 > I tried the CustomGridLine, but this line does not move smoothly along each of the points on x axis, on mouse move it directly jumps to > the next vertical line in the Grid. You can draw a custon gridline at any position in the axis, it does not have to be at one of the tickmarks/gridlines. If you were getting this behavior tit must be because something you were doing in the code that made it jump. The following code, when included in the MouseMove event of a chart will produce a vertical gridline at the position of the mouse: CustomGridLine mousePointer;if (chart1.AxisX.CustomGridLines.Count == 0) { mousePointer = new CustomGridLine();mousePointer.Color = Color.Red; // TODO: Any other customization you want to do the the gridlinechart1.AxisX.CustomGridLines.Add(mousePointer); } elsemousePointer = chart1.AxisX.CustomGridLines[0];double x = chart1.AxisX.PixelToValue(e.X);double min,max; chart1.AxisX.GetScrollView(out min, out max);x = Math.Min(x,max); x = Math.Max(x,min);mousePointer.Value = x; Quote Link to comment Share on other sites More sharing options...
templar Posted November 30, 2012 Report Share Posted November 30, 2012 This is quite an old post now but I hope someone can help with this. I have managed to get the vertical line working when I move the mouse, however I would like to somehow determine all the points at which the vertical line intersects with the series that are currently plotted on the page. For example say I have 3 series that are being plotted, where the X axis is DateTime. As I move the mouse, how do I determine Y vlues of the intersection of the vertical line with the 3 series? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.