<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CaptainCodeMonkey.com - All Your Booty Are Belong To Us! &#187; Easy Bar Graph</title>
	<atom:link href="http://www.captaincodemonkey.com/blog/tag/easy-bar-graph/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.captaincodemonkey.com/blog</link>
	<description></description>
	<lastBuildDate>Tue, 24 Aug 2010 14:26:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Easy PHP and Html Bar Graph</title>
		<link>http://www.captaincodemonkey.com/blog/2008/02/25/easy-php-and-html-bar-graph/</link>
		<comments>http://www.captaincodemonkey.com/blog/2008/02/25/easy-php-and-html-bar-graph/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 16:10:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Easy Bar Graph]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.aprogrammingpro.com/2008/02/25/easy-php-and-html-bar-graph/</guid>
		<description><![CDATA[I want to show you a quick and simple way to create a bar graph using HTML. You need a graphic file that&#8217;s just 1 pixel wide and 5 px tall. Make it whatever color you want your bars to be. I named mine CountBar.gif. In my example, I have an array of data for [...]]]></description>
			<content:encoded><![CDATA[<p>I want to show you a quick and simple way to create a bar graph using HTML.</p>
<p>You need a graphic file that&#8217;s just 1 pixel wide and 5 px tall.  Make it whatever color you want your bars to be.   I named mine CountBar.gif.</p>
<p>In my example, I have an array of data for each month, containing sales.  The key part to the whole concept can be seen here: (the table was created prior to this code block, and is ended after, I am just showing you the relevant section.</p>
<p>Basically, we loop through each month, $arrMonths contains the string values of each month like &#8220;January&#8221;, ect.  $arrResults[$i]; contains the sales values for each corresponding month.  (don&#8217;t get confused by my arrays, just focus on the concept).</p>
<p>The Key part is here:  We set the width of the graphic equal to the amount of sales for the month divided by a static variable (we use this to keep the widths in a relative range, in this case, i know my sales data ranges from 0-50,000 so I want the width of my graph to go from 0-500 pixels)</p>
<p><strong>&lt;img src=&#8221;countBar.gif&#8221; width=&#8221;&lt;?php echo intval($arrResults[$i] / 100);<br />
$total += $arrResults[$i]; ?&gt;&#8221; height=&#8221;5&#8243; class=&#8221;chart&#8221;&gt; </strong></p>
<blockquote><p>&lt;?php</p>
<p>$total = 0;</p>
<p>for ($i = 0; $i &lt; 12; $i++) {<br />
?&gt;<br />
&lt;tr&gt;<br />
&lt;td width=&#8221;15%&#8221; height=&#8221;12&#8243; align=&#8221;left&#8221; valign=&#8221;middle&#8221;&gt;&lt;?php echo $arrMonths[$i + 1].&#8221;     &#8220;;?&gt;&lt;/td&gt;&lt;td width=&#8221;15%&#8221; height=&#8221;12&#8243; align=&#8221;left&#8221; valign=&#8221;middle&#8221;&gt;$&lt;?php echo &#8221; &#8220;.$arrResults[$i]; ?&gt;: &lt;/td&gt;<br />
&lt;td width=&#8221;70%&#8221; height=&#8221;12&#8243;&gt;&lt;img src=&#8221;countBar.gif&#8221; width=&#8221;&lt;?php echo intval($arrResults[$i] / 100);<br />
$total += $arrResults[$i]; ?&gt;&#8221; height=&#8221;5&#8243; class=&#8221;chart&#8221;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php<br />
}<br />
?&gt;</p></blockquote>
<p>And you can get something like this: ( i have marked out the  actual values on purpose)<img src="http://www.aprogrammingpro.com/Untitled-1.gif" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.captaincodemonkey.com/blog/2008/02/25/easy-php-and-html-bar-graph/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
