i'm using the ms chart control and would like to do the following: Format the Y axis of chartAreas[0] to a specific format. In this case it should be a number without decimals and grouped (per thousand) with a point.
Tried it with: chart1.ChartAreas[0].AxisY.LabelStyle.Format = "{#.###}";
but that didn't give me the right result. So I tried to get the FormNumber event and tested with this:
if(e.ElementType == System.Windows.Forms.DataVisualization.Charting.ChartElementType.AxisLabels)// && e.SenderTag!=null)
{
e.LocalizedValue = e.Value.ToString("#.###", _numberFormatInfo);
}
using:
NumberFormatInfo _numberFormatInfo;
_numberFormatInfo = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();
_numberFormatInfo.NumberGroupSeparator = ".";
_numberFormatInfo.NumberDecimalSeparator = ",";
.ToString("#,0.00", _numberFormatInfo));
Didn't work out, while normally if you have something like this:
decimal myDec = 123456.789;
string test = myDec.ToString("#,0.00", _numberFormatInfo));
test would return 123.456,789 (independent of the Culture settings on the users computer).
But this does not seem to work on the ms chart control.
Can someone explain to me how to be able to do the following:
Format the Y values in chartArea[0] without decimals and with a point as a group separator.At the same time format the x values to dd-MM format (like 16-10 => 16-th of October) while the value is actually a Uint 20131016. The format must be Culture settings independent. Hope someone can help me out. Kind regards,
Matthijs