I have a System.Windows.Forms.DataVisualization.Charting.chart
and I want to show some information about a bar on the chart when you hover over it.
But I can't see where to set a tooltip.
I can set this chart3.Series[0].ToolTip = "hello world";
but how do I pick up which x
or y
value I am hovering over in order to modify the text?
I'm surprised nobody mentioned the simple and standard solution yet so I'm compelled to answer a 5 year-old question.
Just add chart keywords to the tooltip string. They get automatically replaced by values of the points you hover over. Something like this:
chart3.Series[0].ToolTip = "hello world from #VALX, #VAL";
These should cover almost all chart tooltip use cases. For the rare cases they don't cover, you can use what the other answers suggest.
More info: https://msdn.microsoft.com/en-us/library/dd456687.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With