简体   繁体   中英

Pop up box in a chart c# Form

Right so I have a Form with a chart displaying data in series as bars, want I want to be able to do is to mouse over a bar and get more in depth detail. I am working out the best way to be able to mouse over a specific bar as right now I just have an event for hovering over the entire chart. not sure how to do that, I also am looking for some kind of little pop up box to appear when i mouse over, not a message box, a small box of text to appear in front of the chart to display the data, I think I will need my own custom form for that. So any help with either working out how to mouse over a specific bar with an event or how to help with a small display box?

You can just use the ToolTip property of the Chart.Series[i] object. No other objects or event handlers are needed.

Work around Steps before writing the custom Chart

  1. Drag and drop a "ToolTip" control in your form.
  2. On "MouseHover" event of your Chart Control Use the following line of code to display the data dynamically on the ToolTip.

    toolTip1.SetToolTip(chart1 //Bascially the id Value of the Control, "Hello" // String Value be displayed on the ToolTip );

Some other Visual Properties of the ToolTip to make it look good

toolTip1.ToolTipTitle = "Details";
toolTip1.UseFading = true;
toolTip1.UseAnimation = true;
toolTip1.IsBalloon = true;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM