<?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>Sentia &#124; Sydney IT Consultancy, Software Development, Ruby on Rails, Web Application Development, Rails Development, Test Driven Development, Microsoft.Net, Asp.Net , Agile, Continuous Integration Training, iPhone development &#187; helpers</title>
	<atom:link href="http://www.sentia.com.au/tag/helpers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sentia.com.au</link>
	<description>Sentia company website and blog about all things development, Ruby on Rails, Microsoft .Net, ASP.Net, C#.Net, Agile web development, Test Driven Development</description>
	<lastBuildDate>Fri, 27 Aug 2010 05:10:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rendering google style pie chart in your rails app</title>
		<link>http://www.sentia.com.au/2009/03/rendering-google-pie-chart-in-rails/</link>
		<comments>http://www.sentia.com.au/2009/03/rendering-google-pie-chart-in-rails/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 10:25:08 +0000</pubDate>
		<dc:creator>Michael Cindric</dc:creator>
				<category><![CDATA[google api]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.sentia.com.au/?p=105</guid>
		<description><![CDATA[Google has some of the best charts on the web. If you ever wanted to have cool pie charts like google here is a simple way to do it. Simply add the following to your application_helper.rb file.

  def google_pie_chart(data, options = {})
    options[:width] &#124;&#124;= 250
    options[:height] &#124;&#124;= 100
 [...]]]></description>
			<content:encoded><![CDATA[<p>Google has some of the best charts on the web. If you ever wanted to have cool pie charts like google here is a simple way to do it. Simply add the following to your application_helper.rb file.</p>
<pre class="brush: ruby;">
  def google_pie_chart(data, options = {})
    options[:width] ||= 250
    options[:height] ||= 100
    options[:colors] = %w(0DB2AC F5DD7E FC8D4D FC694D FABA32 704948 968144 C08FBC ADD97E)
    dt = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.&quot;
    options[:divisor] ||= 1

    while (data.map { |k,v| v }.max / options[:divisor] &gt;= 4096) do
      options[:divisor] *= 10
    end

    opts = {
      :cht =&gt; &quot;p&quot;,
      :chd =&gt; &quot;e:#{data.map{|k,v|v=v/options[:divisor];dt[v/64..v/64]+dt[v%64..v%64]}}&quot;,
      :chl =&gt; &quot;#{data.map { |k,v| CGI::escape(k + &quot; (#{v})&quot;)}.join('|')}&quot;,
      :chs =&gt; &quot;#{options[:width]}x#{options[:height]}&quot;,
      :chco =&gt; options[:colors].slice(0, data.length).join(',')
    }

    image_tag(&quot;http://chart.apis.google.com/chart?#{opts.map{|k,v|&quot;#{k}=#{v}&quot;}.join('&amp;amp;')}&quot;)
  rescue
  end
</pre>
<p>Once you have that in then in your view its as simple as below to render a nice pie chart. Go ahead have a piece.</p>
<pre class="brush: ruby;">

 &lt;%=  google_pie_chart([[&quot;Rails&quot;,80],[&quot;.Net&quot;,10],[&quot;Java&quot;,10]) %&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentia.com.au/2009/03/rendering-google-pie-chart-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
