Search code examples
c#winformschartsmschart

Format number in chart tooltip


I am using WinForm charting library. The chart shows tooltip after adding the following code:

series.ToolTip = "#VALY";

However, the number appears as 12345.6789. How can I format it to show 12,345 only?

Edit: It is documented in the below link. Not sure which format to use to show comma and hide decimal digits.

https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/dd456687(v=vs.100)


Solution

  • The following code fix was required:

    series.ToolTip = "#VALY{#,###}";