brijess75 Posted July 10, 2009 Report Share Posted July 10, 2009 I already havetooltips setup for the data points using the code below. string tooltipText = "";tooltipText = Convert.ToString(r.ItemArray[0]);tooltipText += "\r\n" + Convert.ToString(t.Columns.ColumnName);tooltipText += "\r\n" + Convert.ToString(value);chartFX.Points[iRow, i - 1].Text = tooltipText;chartFX.ToolTipFormat = "%L"; WhatI need is a way to have my tooltips on my data points as well astooltips for the Labels on my X Axis. When the user hovers over thelabel on the X Axis, they should see a tooltip consisting of a uniquenumber, a dash and the name for that unique number while the actuallabel on the X Axis will only show the unique number. For instance, mychart will have X Axis labels of the following: 1310132015191510 For each of these X Axis Labels, the tooltip will be like this: 1310-my line1320-your line1519-his line1510-her line Is there a way to do this? Thanks, Brijess Quote Link to comment Share on other sites More sharing options...
RandyJ Posted July 27, 2009 Report Share Posted July 27, 2009 Hi,Unfortunately, a built-in feature to specify a different tooltip for axis labels is not included. However as a workaround you can achieve the expected behavior by using the GetTip and MouseMove events. What you should do is simply store X and Y in the MouseMove event and then, during GetTip call HitTest with these values to determine the closest label. The following code snippet illustrates how to do this:private int m_lastMouseX,m_lastMouseY;private void chart1_MouseMove (object sender,HitTestEventArgs e){ m_lastMouseX = e.X; m_lastMouseY = e.Y;}private void chart1_GetTip (object sender,GetTipEventArgs e) { HitTestEventArgs a = chart1.HitTest(m_lastMouseX,m_lastMouseY); if ((a.HitType == HitType.Axis) && (a.Object == chart1.AxisX)) { int closestLabel = (int) Math.Round(a.Value); e.Text = "Long Label " + closestLabel.ToString(); }}Regards,RandyJ 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.