18

I am using MS Chart control to draw graphs on Winform.

I want to show the current (x,y) Value as tooltip on Mousedown on chartarea.

How do I do that?

Gaddigesh
  • 1,953
  • 8
  • 30
  • 41

3 Answers3

23

From the chart samples (Samples Environments for Microsoft Chart Controls)

// Set ToolTips for Data Point Series
chart1.Series[0].ToolTip = "Percent: #PERCENT";

// Set ToolTips for legend items
chart1.Series[0].LegendToolTip = "Income in #LABEL  is #VAL million";

// Set ToolTips for the Data Point labels
chart1.Series[0].LabelToolTip = "#PERCENT";

// Set ToolTips for second Data Point
chart1.Series[0].Points[1].ToolTip = "Unknown";
zeFrenchy
  • 6,541
  • 1
  • 27
  • 36
  • 1
    That works.... additionally I wanted to get value when user does mousdown anywhere in the chartarea ,I could do it through this statement.. val=Convert.ToInt32(chart1.ChartAreas["chartAreaFlows"].AxisX.PixelPositionToValue(e.X)); – Gaddigesh Nov 16 '11 at 12:21
  • 1
    This supplied link is broken. Maybe this is similar and helpful https://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=1591 – B H Jun 30 '16 at 18:32
7

If you want to show tooltips with maximum and minimum values in Range type charts, the following code can be used.

Chart1.Series["Series1"].ToolTip = "Min:#VALY1, Max:#VALY2";
Jason Sturges
  • 15,855
  • 14
  • 59
  • 80
Adnan Caglar
  • 71
  • 1
  • 1
6

This tooltip will appear on mouseover. I'm not sure if you can set it for mousedown event.

Chart1.Series["Series1"].ToolTip = "#VALY, #VALX";
user898311
  • 71
  • 3