I'm making some charts in C# Visual Studio 2010 and I had a quick (hopefully simple) question about formatting the labels on the X-Axis. I searched SO and Google for an answer and I'm pretty sure it has to do with simply editing the LabelStyle.Format for a chart area... But I can't figure it out! Okay, too much information, let me get on with the question
In short, my chart needs to have mileage on the x-axis and it ranges from 0 to 240,000. I would really like to spruce it up a bit and have a 'K' instead of the trailing 3 zeroes. Example: 60K, 120k, 180K, 240K.
Add or change the position of vertical axis label Click the chart, and then click the Chart Layout tab. Under Axes, click Axes > Vertical Axis, and then click the kind of axis label that you want.
Set the LabelStyle.Format property accordingly:
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "{0:0,}K";
Documentation is here: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx (Section: "The ',' Custom Specifier")
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