3

I wrote the following Winforms code:

chart1.ChartAreas[0].AxisX.LabelStyle.Format = "M/d H:mm ";

This makes my X-axis seen as, for example 11/25 8:00. But when I provide the tooltip for the datapoints it just provides the date and not the format "M/d H:mm". Here is my code:

chart1.Series[0].ToolTip = "Computer Name: #SERIESNAME \nDate & Time: #VALX  \nLevel: #VALY";` 

And the tooltip result which I got was this:

Computer Name: COMP NAME
Date & Time: 11/25/2013
Level: 4

I want the "Date & Time" value as " 11/25 8:00", which is being showed in the X-axis but not in the #VALX tooltip.

2 Answers2

4

Try this: #VALX{M/d H:mm}.
So your code will be:

chart1.Series[0].ToolTip = "Computer Name: #SERIESNAME \nDate & Time: #VALX{M/d H:mm}  \nLevel: #VALY";
Dmitry
  • 13,797
  • 6
  • 32
  • 48
1

I think you should try LabelToolTip property instead of Tooltip, when dealing with data points, at least that's what documentation hints

Yurii
  • 4,811
  • 7
  • 32
  • 41