is it possible to specify the axis to have a constant number of decimals for each displayed label?
for example, in this image:
http://picasaweb.google.com/marvin966ju ... 4684653906
the left axis shows a 0.5 increment, but whole values (24 for example), I would like to have 24.0 displayed.
I can not set ValueFormat to #0.0# because I want to be able to zoom more and go to up to X decimals.
I have tried the following:
Code: Select all
private void AdjustAxisValueFormat(Axis axis, int maxDecimals)
{
if (axis.CalcIncrement != axis.MinAxisIncrement)
{
string currentIncrement = ((decimal)axis.CalcIncrement).ToString();
int indexOfSeparator =
currentIncrement.IndexOf(".");
if (indexOfSeparator == -1)
{
axis.Labels.ValueFormat = "#0";
}
else
{
int numberOfDecimals = Math.Min(currentIncrement.Length - indexOfSeparator - 1, maxDecimals);
axis.Labels.ValueFormat = "#0.".PadRight(numberOfDecimals + "#0.".Length, '0');
}
}
}
http://picasaweb.google.com/marvin966ju ... 2323761746
Is there a simplier way to accomplish that? Or am I doing something wrong?
Thank you very much!