Axis labels with consistent decimals
Posted: Mon Jul 12, 2010 6:54 pm
Is there a way to get an axis to display tick labels with a consistent number of decimal places without having to examine the data range of the data and guess at what the code might do to lay things out?
We're plotting values on custom Axes with Automatic set to true. The problem we have currently is that while axes with a wide range of values look reasonably good, axes whose series have a small range of values (e.g. values fall between 1 and 3) have tick labels which go e.g. "1.1", "1.35", "1.5", "1.65", etc. The inconsistent number of decimal places staggers the labels and makes them look very bad. The format codes offered for AxisLabels.ValueFormat force you to choose between always presenting two decimal places (terrible for cases where we don't need them) or the above setting where trailing zeros are removed, and there doesn't seem to be a reasonable way to examine axis ranges or the difference between successive tick values to apply an appropriate ValueFormat before the labels are drawn. Am I missing something that would allow me to do this?
We're plotting values on custom Axes with Automatic set to true. The problem we have currently is that while axes with a wide range of values look reasonably good, axes whose series have a small range of values (e.g. values fall between 1 and 3) have tick labels which go e.g. "1.1", "1.35", "1.5", "1.65", etc. The inconsistent number of decimal places staggers the labels and makes them look very bad. The format codes offered for AxisLabels.ValueFormat force you to choose between always presenting two decimal places (terrible for cases where we don't need them) or the above setting where trailing zeros are removed, and there doesn't seem to be a reasonable way to examine axis ranges or the difference between successive tick values to apply an appropriate ValueFormat before the labels are drawn. Am I missing something that would allow me to do this?