<?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: JRuby + JFreeChart = Sparklines</title>
	<atom:link href="http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/feed/" rel="self" type="application/rss+xml" />
	<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/</link>
	<description>Keith on XML, Publishing, Ruby, Birds, &#038; San Francisco</description>
	<lastBuildDate>Wed, 09 Sep 2009 14:05:30 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: punk21</title>
		<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/comment-page-1/#comment-119</link>
		<dc:creator>punk21</dc:creator>
		<pubDate>Wed, 18 Jun 2008 04:22:31 +0000</pubDate>
		<guid isPermaLink="false">http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/#comment-119</guid>
		<description>Hey guys, Having problem while drawing Sparkline Charts then chk this out &lt;a href=&quot;http://visifire.com&quot; rel=&quot;nofollow&quot;&gt;visifire&lt;/a&gt; an amazing charting component which is powered by silverlight offered under open source</description>
		<content:encoded><![CDATA[<p>Hey guys, Having problem while drawing Sparkline Charts then chk this out <a href="http://visifire.com" rel="nofollow">visifire</a> an amazing charting component which is powered by silverlight offered under open source</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: slonkak</title>
		<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/comment-page-1/#comment-118</link>
		<dc:creator>slonkak</dc:creator>
		<pubDate>Thu, 17 Apr 2008 18:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/#comment-118</guid>
		<description>Would you be so kind as to help our a Ruby/Java noob?  Say I just created a default, blank rails app in my jRuby install.  I have the jfreechart and jcommon JARs in my classpath.  What all do I  have to do to get your code to work and start producing charts.  I don&#039;t know Ruby (nor the MVC framework), I don&#039;t know Java, and I most certainly don&#039;t know how Java works with jRuby.  I would like to learn, but since I learn by example, and most examples on the net are very incomplete, I&#039;m having a hard time.  Could you provide any assistance?</description>
		<content:encoded><![CDATA[<p>Would you be so kind as to help our a Ruby/Java noob?  Say I just created a default, blank rails app in my jRuby install.  I have the jfreechart and jcommon JARs in my classpath.  What all do I  have to do to get your code to work and start producing charts.  I don&#8217;t know Ruby (nor the MVC framework), I don&#8217;t know Java, and I most certainly don&#8217;t know how Java works with jRuby.  I would like to learn, but since I learn by example, and most examples on the net are very incomplete, I&#8217;m having a hard time.  Could you provide any assistance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith</title>
		<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/comment-page-1/#comment-106</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Thu, 12 Jul 2007 14:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/#comment-106</guid>
		<description>What&#039;s the actual error you&#039;re getting/can you post more of the code you&#039;re using?

&lt;a href=&quot;http://kfahlgren.com/blog/2007/07/12/stacked-bar-charts-in-jruby-using-jfreechart/&quot; rel=&quot;nofollow&quot;&gt;Hope this helps&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>What&#8217;s the actual error you&#8217;re getting/can you post more of the code you&#8217;re using?</p>
<p><a href="http://kfahlgren.com/blog/2007/07/12/stacked-bar-charts-in-jruby-using-jfreechart/" rel="nofollow">Hope this helps</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mdweezer</title>
		<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/comment-page-1/#comment-105</link>
		<dc:creator>mdweezer</dc:creator>
		<pubDate>Thu, 12 Jul 2007 12:28:26 +0000</pubDate>
		<guid isPermaLink="false">http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/#comment-105</guid>
		<description>Keith,

I appreciate the response, I kept getting &quot;addValue&quot; incorrect method errors...  I&#039;m building stacked bar charts with the data.  I&#039;m using data scraped from a database, I just used those values to figure out how to actually add data to the dataset.  Not quite sure what I was doing wrong but I&quot;ll see what I can do.  Again, I appreciate it, thanks!</description>
		<content:encoded><![CDATA[<p>Keith,</p>
<p>I appreciate the response, I kept getting &#8220;addValue&#8221; incorrect method errors&#8230;  I&#8217;m building stacked bar charts with the data.  I&#8217;m using data scraped from a database, I just used those values to figure out how to actually add data to the dataset.  Not quite sure what I was doing wrong but I&#8221;ll see what I can do.  Again, I appreciate it, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith</title>
		<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/comment-page-1/#comment-104</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Wed, 11 Jul 2007 22:40:03 +0000</pubDate>
		<guid isPermaLink="false">http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/#comment-104</guid>
		<description>mdweezer:

I haven&#039;t the foggiest idea what you&#039;re actually trying to do, but:

&lt;pre&gt;# Mostly inspired by http://left.subtree.org/2007/01/15/creating-sparklines-with-jfreechart/
# have JFreeChart in your classpath, obviously, as well as jcommon.jar
require &#039;java&#039;

module Graph
  class Sparkline
    include_class &#039;java.io.File&#039;
    include_class &#039;org.jfree.chart.ChartUtilities&#039;
    include_class &#039;org.jfree.chart.JFreeChart&#039;
    include_class &#039;org.jfree.data.category.DefaultCategoryDataset&#039;
    include_class &#039;org.jfree.chart.ChartFactory&#039;
    include_class &#039;org.jfree.chart.plot.PlotOrientation&#039;

    def initialize(width=200, height=80, data=[])
      @width = width
      @height = height
      dataset = create_sample_data() if data.empty?
      @chart = create_chart(dataset)
    end

    def render_to_file(filename, format=&quot;png&quot;)
      javafile = java.io.File.new(filename)
      ChartUtilities.saveChartAsPNG(javafile, @chart, @width, @height)
    end

    private
    def create_sample_data
      dataset = DefaultCategoryDataset.new
      dataset.addValue(1, &quot;Closed&quot;, &quot;&quot;)
      dataset.addValue(1, &quot;InVerfication&quot;, &quot;&quot;)
      dataset.addValue(2, &quot;Delivered&quot;, &quot;&quot;)
      dataset.addValue(2, &quot;On-hold&quot;, &quot;&quot;)
      dataset.addValue(3, &quot;In-work&quot;, &quot;&quot;)
      dataset.addValue(3, &quot;Rejected&quot;, &quot;&quot;)
      dataset.addValue(3, &quot;Duplicate&quot;, &quot;&quot;)
      dataset.addValue(3, &quot;Assigned&quot;, &quot;&quot;)
      dataset.addValue(4, &quot;Submitted&quot;, &quot;&quot;)

      return dataset
    end

    def create_chart(dataset)
      chart = ChartFactory.createWaterfallChart(&quot;Phase&quot;,&quot;Name&quot;, &quot;&quot;, dataset, PlotOrientation::VERTICAL, true, true, false)
      return chart    
    end
  end # class Sparkline  
end # class Graph

sp = Graph::Sparkline.new
puts &quot;Rendering sparkline&quot;
sp.render_to_file(&quot;sparkline.png&quot;)&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>mdweezer:</p>
<p>I haven&#8217;t the foggiest idea what you&#8217;re actually trying to do, but:</p>
<pre># Mostly inspired by <a href="http://left.subtree.org/2007/01/15/creating-sparklines-with-jfreechart/" rel="nofollow">http://left.subtree.org/2007/01/15/creating-sparklines-with-jfreechart/</a>
# have JFreeChart in your classpath, obviously, as well as jcommon.jar
require 'java'

module Graph
  class Sparkline
    include_class 'java.io.File'
    include_class 'org.jfree.chart.ChartUtilities'
    include_class 'org.jfree.chart.JFreeChart'
    include_class 'org.jfree.data.category.DefaultCategoryDataset'
    include_class 'org.jfree.chart.ChartFactory'
    include_class 'org.jfree.chart.plot.PlotOrientation'

    def initialize(width=200, height=80, data=[])
      @width = width
      @height = height
      dataset = create_sample_data() if data.empty?
      @chart = create_chart(dataset)
    end

    def render_to_file(filename, format="png")
      javafile = java.io.File.new(filename)
      ChartUtilities.saveChartAsPNG(javafile, @chart, @width, @height)
    end

    private
    def create_sample_data
      dataset = DefaultCategoryDataset.new
      dataset.addValue(1, "Closed", "")
      dataset.addValue(1, "InVerfication", "")
      dataset.addValue(2, "Delivered", "")
      dataset.addValue(2, "On-hold", "")
      dataset.addValue(3, "In-work", "")
      dataset.addValue(3, "Rejected", "")
      dataset.addValue(3, "Duplicate", "")
      dataset.addValue(3, "Assigned", "")
      dataset.addValue(4, "Submitted", "")

      return dataset
    end

    def create_chart(dataset)
      chart = ChartFactory.createWaterfallChart("Phase","Name", "", dataset, PlotOrientation::VERTICAL, true, true, false)
      return chart
    end
  end # class Sparkline
end # class Graph

sp = Graph::Sparkline.new
puts "Rendering sparkline"
sp.render_to_file("sparkline.png")</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: mdweezer</title>
		<link>http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/comment-page-1/#comment-103</link>
		<dc:creator>mdweezer</dc:creator>
		<pubDate>Wed, 11 Jul 2007 17:58:34 +0000</pubDate>
		<guid isPermaLink="false">http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/#comment-103</guid>
		<description>Have you done anything with DefaultCategoryDatasets?  I&#039;m trying to build some stacked bar charts in JRuby and your code is excellent but I can&#039;t seem to make things work with other types of datasets, grrrrr.  But then again, my Ruby isn&#039;t exactly sharp.

The following chunk of code is what I need to port over...

DefaultCategoryDataset result = new DefaultCategoryDataset();
result.addValue(0, &quot;Closed&quot;, &quot;&quot;);
result.addValue(0, &quot;InVerfication&quot;, &quot;&quot;);
result.addValue(0, &quot;Delivered&quot;, &quot;&quot;);
result.addValue(0, &quot;On-hold&quot;, &quot;&quot;);
result.addValue(0, &quot;In-work&quot;, &quot;&quot;);
result.addValue(0, &quot;Rejected&quot;, &quot;&quot;);
result.addValue(0, &quot;Duplicate&quot;, &quot;&quot;);
result.addValue(0, &quot;Assigned&quot;, &quot;&quot;);
result.addValue(0, &quot;Submitted&quot;, &quot;&quot;);</description>
		<content:encoded><![CDATA[<p>Have you done anything with DefaultCategoryDatasets?  I&#8217;m trying to build some stacked bar charts in JRuby and your code is excellent but I can&#8217;t seem to make things work with other types of datasets, grrrrr.  But then again, my Ruby isn&#8217;t exactly sharp.</p>
<p>The following chunk of code is what I need to port over&#8230;</p>
<p>DefaultCategoryDataset result = new DefaultCategoryDataset();<br />
result.addValue(0, &#8220;Closed&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;InVerfication&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;Delivered&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;On-hold&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;In-work&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;Rejected&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;Duplicate&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;Assigned&#8221;, &#8220;&#8221;);<br />
result.addValue(0, &#8220;Submitted&#8221;, &#8220;&#8221;);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
