<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Computing Graph Limits</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Barney</title>
		<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/comment-page-1/#comment-321</link>
		<dc:creator>Barney</dc:creator>
		<pubDate>Fri, 07 Apr 2006 16:08:33 +0000</pubDate>
		<guid isPermaLink="false">http://barneyb.com/barneyblog/?p=151#comment-321</guid>
		<description>Adam, that&#039;s good stuff.  I&#039;ll have to tune my solution a little on that.  I don&#039;t know why the heck I didn&#039;t think of using logarithms, but that should make things much more straightforward.
</description>
		<content:encoded><![CDATA[<p>Adam, that's good stuff.  I'll have to tune my solution a little on that.  I don't know why the heck I didn't think of using logarithms, but that should make things much more straightforward.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Ness</title>
		<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/comment-page-1/#comment-320</link>
		<dc:creator>Adam Ness</dc:creator>
		<pubDate>Fri, 07 Apr 2006 15:53:31 +0000</pubDate>
		<guid isPermaLink="false">http://barneyb.com/barneyblog/?p=151#comment-320</guid>
		<description>I did up some formulas for this a few years ago, using CFCHART. I was always using a minimum value of 0, so you might need to adjust it, but here&#039;s the psuedocode:

&lt;cfset orderOfMag = int(log10(maxValue))&gt;
&lt;cfif orderOfMag gt 1 and (maxValue/10^orderOfmag) lt 5&gt;
  &lt;cfset totalMax = (int(maxValue/10^orderOfMag)*4+1)/4 * 10^orderOfMag&gt;
  &lt;cfset gridLineCount = int(totalmax/10^orderOfMag)*4+1&gt;
&lt;cfelseif orderOfMag gt -1 or (maxValue/10^orderOfmag) gt 5&gt;
  &lt;cfset totalMax = (int(maxValue/10^orderOfMag)*2+1)/2 * 10^orderOfMag&gt;
  &lt;cfset gridLineCount = int(totalmax/10^orderOfMag)*2+1&gt;
&lt;cfelse&gt;
  &lt;cfset totalMax = (int(maxValue/10^orderOfMag)*4+1)/4 * 10^orderOfMag&gt;
  &lt;cfset gridLineCount = int(totalmax/10^orderOfMag)*4+1&gt;
&lt;/cfif&gt;</description>
		<content:encoded><![CDATA[<p>I did up some formulas for this a few years ago, using CFCHART. I was always using a minimum value of 0, so you might need to adjust it, but here's the psuedocode:</p>
<p>&lt;cfset orderOfMag = int(log10(maxValue))&gt;<br />
&lt;cfif orderOfMag gt 1 and (maxValue/10^orderOfmag) lt 5&gt;<br />
  &lt;cfset totalMax = (int(maxValue/10^orderOfMag)*4+1)/4 * 10^orderOfMag&gt;<br />
  &lt;cfset gridLineCount = int(totalmax/10^orderOfMag)*4+1&gt;<br />
&lt;cfelseif orderOfMag gt -1 or (maxValue/10^orderOfmag) gt 5&gt;<br />
  &lt;cfset totalMax = (int(maxValue/10^orderOfMag)*2+1)/2 * 10^orderOfMag&gt;<br />
  &lt;cfset gridLineCount = int(totalmax/10^orderOfMag)*2+1&gt;<br />
&lt;cfelse&gt;<br />
  &lt;cfset totalMax = (int(maxValue/10^orderOfMag)*4+1)/4 * 10^orderOfMag&gt;<br />
  &lt;cfset gridLineCount = int(totalmax/10^orderOfMag)*4+1&gt;<br />
&lt;/cfif&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick McElhaney</title>
		<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/comment-page-1/#comment-319</link>
		<dc:creator>Patrick McElhaney</dc:creator>
		<pubDate>Fri, 07 Apr 2006 14:20:23 +0000</pubDate>
		<guid isPermaLink="false">http://barneyb.com/barneyblog/?p=151#comment-319</guid>
		<description>It sounds like you want your interval to be 10^n, where n is a whole number. 

Gotta run, but I hope that helps you move a little bit closer.</description>
		<content:encoded><![CDATA[<p>It sounds like you want your interval to be 10^n, where n is a whole number. </p>
<p>Gotta run, but I hope that helps you move a little bit closer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barney</title>
		<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/comment-page-1/#comment-318</link>
		<dc:creator>Barney</dc:creator>
		<pubDate>Thu, 06 Apr 2006 20:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://barneyb.com/barneyblog/?p=151#comment-318</guid>
		<description>An interesting turn of scope; I think it&#039;s still the same question, but maybe not.  I&#039;m thinking ceiling((high - low) / intervalCount) is what you&#039;re looking for.  However, if high and low are 21,753 and 23,543, it&#039;s going to be arbitrary, because ceiling operates at the decimal point, and those numbers won&#039;t yield meaningful factional parts.

This is the same problem that I had to begin with: devising a general solution for finding the limits.  There&#039;s something lurking in there with scaling the ceiling call (some factor of the range), but I can&#039;t put my finger on it.

Here&#039;s a better description of what I do currently:

compute the range of values, create the smallest number with 1 non-zero digit that is strictly larger than the range, divide that by the number of intervals, and then find the next smallest and next largest intervals below and above the actual range.  So for 21753 and 23543, the range is 1790, the 1-sig-fig number is 2000, 10 intervals yields 200 per interval, and the tightest boundaries are 21600 and 23600 (which, as you&#039;d expect, are 2000 apart).

That worked really well in this case, but when there&#039;s a jump right at the end, not so much.  Consider 21,500 to 23,501: range is 2001, 1-sig-fig number is 3000, so 300 per interval, with boundaries of 21,300 and 23,700, which are NOT 3000 apart.

However, what I&#039;m now realizing is that perhaps forcing the number of intervals is what my problem is.  The algorithm does yield a good range, just not one that can be broken in the right number of parts.  But that number doesn&#039;t really matter.  What does 10 versus eight intervals really matter?</description>
		<content:encoded><![CDATA[<p>An interesting turn of scope; I think it's still the same question, but maybe not.  I'm thinking ceiling((high &#8211; low) / intervalCount) is what you're looking for.  However, if high and low are 21,753 and 23,543, it's going to be arbitrary, because ceiling operates at the decimal point, and those numbers won't yield meaningful factional parts.</p>
<p>This is the same problem that I had to begin with: devising a general solution for finding the limits.  There's something lurking in there with scaling the ceiling call (some factor of the range), but I can't put my finger on it.</p>
<p>Here's a better description of what I do currently:</p>
<p>compute the range of values, create the smallest number with 1 non-zero digit that is strictly larger than the range, divide that by the number of intervals, and then find the next smallest and next largest intervals below and above the actual range.  So for 21753 and 23543, the range is 1790, the 1-sig-fig number is 2000, 10 intervals yields 200 per interval, and the tightest boundaries are 21600 and 23600 (which, as you'd expect, are 2000 apart).</p>
<p>That worked really well in this case, but when there's a jump right at the end, not so much.  Consider 21,500 to 23,501: range is 2001, 1-sig-fig number is 3000, so 300 per interval, with boundaries of 21,300 and 23,700, which are NOT 3000 apart.</p>
<p>However, what I'm now realizing is that perhaps forcing the number of intervals is what my problem is.  The algorithm does yield a good range, just not one that can be broken in the right number of parts.  But that number doesn't really matter.  What does 10 versus eight intervals really matter?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/comment-page-1/#comment-317</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Thu, 06 Apr 2006 19:59:46 +0000</pubDate>
		<guid isPermaLink="false">http://barneyb.com/barneyblog/?p=151#comment-317</guid>
		<description>Make that 0 to 80.</description>
		<content:encoded><![CDATA[<p>Make that 0 to 80.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>https://www.barneyb.com/barneyblog/2006/04/06/computing-graph-limits/comment-page-1/#comment-316</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Thu, 06 Apr 2006 19:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://barneyb.com/barneyblog/?p=151#comment-316</guid>
		<description>Instead of trying to calculate bounds first, try to determine a good interval first. For instance, if your values range from 8 - 76, you might find that 10 is a good interval. Then you can base the chart bounds on that inverval. You could make the chart go from 80.

I don&#039;t have a good function on hand to find a good interval, but it shouldn&#039;t be too hard to write one.</description>
		<content:encoded><![CDATA[<p>Instead of trying to calculate bounds first, try to determine a good interval first. For instance, if your values range from 8 &#8211; 76, you might find that 10 is a good interval. Then you can base the chart bounds on that inverval. You could make the chart go from 80.</p>
<p>I don't have a good function on hand to find a good interval, but it shouldn't be too hard to write one.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
