C# Date/Numerical Axis Scale
<p>I'm developing a histogram container class and I'm trying to determine where the cut off points should be for the bins.  I'd like the cutoff points to be nice looking numbers, in much that same way that graphs are scaled.  </p>

<p>To distill my request into a basic question: Is there a basic method by which data axis labels can be determined from a list of numbers.</p>

<p>For example:</p>

<pre><code>Array{1,6,8,5,12,15,22}
</code></pre>

<p>It would make sense to have 5 bins.</p>

<pre><code>Bin Start    Count
0              1
5              3
10             2
15             0
20             1
</code></pre>

<p>The bin start stuff is identical to selecting axis labels on a graph in this instance.</p>

<p>For the purpose of this question I don't really care about bins and the histogram, I'm more interested in the graph scale axis label portion of the question.</p>

<p>I will be using C# 4.0 for my app, so nifty solution using linq are welcome.</p>

<p>I've attempted stuff like this in the distant past using some log base 10 scaling stuff, but I never got it to work in great enough detail for this application.  I don't want to do log scaling, I just used base 10 to round to nearest whole numbers. I'd like it to work for large numbers and very small numbers and possibly dates too; although dates can be converted to doubles and parsed that way.</p>

<p>Any resources on the subject would be greatly appreciated.</p>
