<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>OnRails.org: Graphs with Gruff</title>
    <link>http://onrails.org/articles/2006/02/20/graphs-with-gruff</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Ruby On Rails and related matters.</description>
    <item>
      <title>Graphs with Gruff</title>
      <description>&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="http://static.flickr.com/41/102254185_44b05dcd34.jpg?v=0" alt="" /&gt;&lt;/td&gt;
&lt;td valign="top"&gt;&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;GraphController&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;BaseTimeController&lt;/span&gt;
   &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;pages&lt;/span&gt;
      &lt;span class="ident"&gt;g&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Gruff&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Pie&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;&lt;span class="punct"&gt;(&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;500x350&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt;
      &lt;span class="ident"&gt;g&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;title&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;All Pages&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; 
      &lt;span class="attribute"&gt;@current_user&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;pages&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;each&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
        &lt;span class="ident"&gt;g&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;data&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;title&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="ident"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;total&lt;/span&gt;&lt;span class="punct"&gt;])&lt;/span&gt; 
      &lt;span class="keyword"&gt;end&lt;/span&gt;
      &lt;span class="ident"&gt;send_data&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;g&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;to_blob&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; 
                &lt;span class="symbol"&gt;:disposition&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;inline&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; 
                &lt;span class="symbol"&gt;:type&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;image/png&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; 
                &lt;span class="symbol"&gt;:filename&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;timers.png&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
Pretty easy! Wasn&amp;#8217;t it. Note the code above shows only the first of the graphs. Now if only I could find out how to set the minimum of the Bar chart to 0 instead of the minimum of the serie. Any help is appreciated?
&lt;/td&gt;
&lt;/table&gt;</description>
      <pubDate>Mon, 20 Feb 2006 12:10:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:961f5a52-ea2f-46b6-aa48-2de5a56f2cdb</guid>
      <author>Daniel Wanja</author>
      <link>http://onrails.org/articles/2006/02/20/graphs-with-gruff</link>
      <category>Ruby On Rails</category>
    </item>
    <item>
      <title>"Graphs with Gruff" by Daniel Wanja</title>
      <description>&lt;p&gt;Font sizes can be generaly changed as follows&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;      g = Gruff::Pie.new(&amp;quot;500x350&amp;quot;)
      g.title = &amp;quot;All Projects&amp;quot; 
      g.legend_font_size = 12
      g.marker_font_size = 12
      g.title_font_size = 14&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;However the PieChart has a fixed size for the marker_font_size. This is maybe the issue you have.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;  @d.pointsize = scale_fontsize(20)&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;I haven&amp;#8217;t checked if there was any change lately in the Gruff graph. If not then your are stuck with the predefined font size for the markers, unless you fix the Pie chart implementation.&lt;/p&gt;


	&lt;p&gt;Now if anyone knows better, please let me know.&lt;/p&gt;


	&lt;p&gt;Hope this helps.&lt;/p&gt;</description>
      <pubDate>Thu, 31 Aug 2006 11:28:51 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0a2ba3ab-1c15-4361-bb5d-91473fe5bce3</guid>
      <link>http://onrails.org/articles/2006/02/20/graphs-with-gruff#comment-142</link>
    </item>
    <item>
      <title>"Graphs with Gruff" by joseph</title>
      <description>&lt;p&gt;How can I changed the pie label text size&lt;/p&gt;</description>
      <pubDate>Thu, 31 Aug 2006 09:14:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6ff8dd3b-e048-40a2-a6e9-4453ad224f8d</guid>
      <link>http://onrails.org/articles/2006/02/20/graphs-with-gruff#comment-141</link>
    </item>
    <item>
      <title>"Graphs with Gruff" by Daniel Wanja</title>
      <description>Awesome, thanks man. The solution from the source ;-) I checked it out and it now works as advertised, just add   g.minimum_value = 0 to the Gruff::Bar before rendering it (g.to_blob).

(Now if just find out how to enable 'textile' for the comments I would post the results here rather than creating a new blog entry!)</description>
      <pubDate>Fri, 14 Apr 2006 06:46:12 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6371e0eb-ad0c-453e-9e01-86949da8460b</guid>
      <link>http://onrails.org/articles/2006/02/20/graphs-with-gruff#comment-52</link>
    </item>
    <item>
      <title>"Graphs with Gruff" by topfunky</title>
      <description>Setting minimums is in svn now and will be released in a few days.</description>
      <pubDate>Wed, 12 Apr 2006 09:14:02 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:a8981224-0b98-4517-87a4-ab2a698a994f</guid>
      <link>http://onrails.org/articles/2006/02/20/graphs-with-gruff#comment-50</link>
    </item>
  </channel>
</rss>
