rfreechart 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,3 @@
1
+ -
2
+ ChangeLog.*
3
+ LICENSE.txt
data/.gemtest ADDED
File without changes
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title "rfreechart Documentation" --protected
data/ChangeLog.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.1.0 / 2011-03-30
2
+
3
+ * Initial release:
4
+
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source :rubygems
2
+
3
+ #gemspec
4
+
5
+ group :development do
6
+ gem 'rake', '~> 0.8.7'
7
+ gem 'ore-tasks', '~> 0.4'
8
+ gem 'rspec', '~> 2.5'
9
+ gem 'kramdown'
10
+ gem 'yard', '~> 0.6.0'
11
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Patrik Sundberg
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # rfreechart
2
+
3
+ * [Homepage](https://github.com/sundbp/rfreechart)
4
+ * [Documentation](http://rubydoc.info/gems/rfreechart/frames)
5
+
6
+ ## Description
7
+
8
+ A simple jruby wrapper around the java library [jfreechart](http://www.jfree.org/jfreechart/).
9
+ All it does is provide a structured way to require the jar files. The user refers to the java
10
+ classes as usual (i.e. org.jfree.chart.ChartPanel).
11
+
12
+ Potentially some utilities to enhance productivity and make it more ruby friendly will be added
13
+ later as well.
14
+
15
+ ## Examples
16
+
17
+ This is an excerpts of examples/pie_chart_demo_1.rb:
18
+
19
+ class PieChartDemo1 < ApplicationFrame
20
+
21
+ def create_dataset
22
+ dataset = DefaultPieDataset.new
23
+ dataset.setValue("One", 43.2)
24
+ dataset.setValue("Two", 10.0)
25
+ dataset.setValue("Three", 27.5)
26
+ dataset.setValue("Four", 17.5)
27
+ dataset.setValue("Five", 11.0)
28
+ dataset.setValue("Six", 19.4)
29
+ dataset
30
+ end
31
+
32
+ def create_chart(dataset)
33
+ chart = ChartFactory.createPieChart(
34
+ "Pie Chart Demo 1", # chart title
35
+ dataset, # data
36
+ true, # include legend
37
+ true,
38
+ false
39
+ )
40
+
41
+ plot = chart.getPlot()
42
+ plot.setSectionOutlinesVisible(false);
43
+ plot.setNoDataMessage("No data available");
44
+
45
+ chart
46
+ end
47
+
48
+ def create_demo_panel
49
+ chart = create_chart(create_dataset)
50
+ ChartPanel.new(chart)
51
+ end
52
+
53
+ def initialize(title)
54
+ super(title)
55
+ setContentPane(create_demo_panel)
56
+ end
57
+ end
58
+
59
+ demo = PieChartDemo1.new("Pie Chart Demo 1")
60
+ demo.pack()
61
+ RefineryUtilities.centerFrameOnScreen(demo)
62
+ demo.setVisible(true)
63
+
64
+ ## Requirements
65
+
66
+ * jfreechart jars
67
+ * setting the environment variable **RFREECHART_JAR_PATH** as described below
68
+
69
+ ## Install
70
+
71
+ $ gem install rfreechart
72
+
73
+ Download and unpack [jfreechart](http://www.jfree.org/jfreechart/download.html), and
74
+ set the environment variable **RFREECHART_JAR_PATH** to the path containg the
75
+ jfreechar jars.
76
+
77
+ ## Copyright
78
+
79
+ Copyright (c) 2011 Patrik Sundberg
80
+
81
+ See {file:LICENSE.txt} for details.
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'bundler'
5
+ rescue LoadError => e
6
+ STDERR.puts e.message
7
+ STDERR.puts "Run `gem install bundler` to install Bundler."
8
+ exit e.status_code
9
+ end
10
+
11
+ begin
12
+ Bundler.setup(:development)
13
+ rescue Bundler::BundlerError => e
14
+ STDERR.puts e.message
15
+ STDERR.puts "Run `bundle install` to install missing gems."
16
+ exit e.status_code
17
+ end
18
+
19
+ require 'rake'
20
+
21
+ require 'ore/tasks'
22
+ Ore::Tasks.new
23
+
24
+ require 'rspec/core/rake_task'
25
+ RSpec::Core::RakeTask.new
26
+
27
+ task :test => :spec
28
+ task :default => :spec
29
+
30
+
31
+ require 'yard'
32
+ YARD::Rake::YardocTask.new
33
+ task :doc => :yard
@@ -0,0 +1,54 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
2
+ require 'rfreechart'
3
+
4
+ java_import org.jfree.ui.ApplicationFrame
5
+ java_import org.jfree.ui.RefineryUtilities
6
+
7
+ class PieChartDemo1 < ApplicationFrame
8
+ java_import javax.swing.JPanel
9
+ java_import org.jfree.chart.ChartFactory
10
+ java_import org.jfree.chart.ChartPanel
11
+ java_import org.jfree.data.general.DefaultPieDataset
12
+
13
+ def create_dataset
14
+ dataset = DefaultPieDataset.new
15
+ dataset.setValue("One", 43.2)
16
+ dataset.setValue("Two", 10.0)
17
+ dataset.setValue("Three", 27.5)
18
+ dataset.setValue("Four", 17.5)
19
+ dataset.setValue("Five", 11.0)
20
+ dataset.setValue("Six", 19.4)
21
+ dataset
22
+ end
23
+
24
+ def create_chart(dataset)
25
+ chart = ChartFactory.createPieChart(
26
+ "Pie Chart Demo 1", # chart title
27
+ dataset, # data
28
+ true, # include legend
29
+ true,
30
+ false
31
+ )
32
+
33
+ plot = chart.getPlot()
34
+ plot.setSectionOutlinesVisible(false);
35
+ plot.setNoDataMessage("No data available");
36
+
37
+ chart
38
+ end
39
+
40
+ def create_demo_panel
41
+ chart = create_chart(create_dataset)
42
+ ChartPanel.new(chart)
43
+ end
44
+
45
+ def initialize(title)
46
+ super(title)
47
+ setContentPane(create_demo_panel)
48
+ end
49
+ end
50
+
51
+ demo = PieChartDemo1.new("Pie Chart Demo 1")
52
+ demo.pack()
53
+ RefineryUtilities.centerFrameOnScreen(demo)
54
+ demo.setVisible(true)
data/gemspec.yml ADDED
@@ -0,0 +1,11 @@
1
+ name: rfreechart
2
+ summary: "Thin jruby wrapper for jfreechart"
3
+ description: "A thin jruby wrapper for jfreechart (mainly just a way to load the jars in a structured way for now)"
4
+ license: MIT
5
+ authors: Patrik Sundberg
6
+ homepage: http://rubygems.org/gems/rfreechart
7
+ has_yard: true
8
+
9
+ development_dependencies:
10
+ bundler: ~> 1.0.0
11
+ yard: ~> 0.6.0
@@ -0,0 +1,4 @@
1
+ module Rfreechart
2
+ # rfreechart version
3
+ VERSION = "0.1.0"
4
+ end
data/lib/rfreechart.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'rfreechart/version'
2
+
3
+ require 'java'
4
+
5
+ module Rfree
6
+
7
+ def self.jars
8
+ [
9
+ 'jcommon-1.0.16',
10
+ 'swtgraphics2d',
11
+ 'jfreechart-1.0.13',
12
+ 'jfreechart-1.0.13-swt',
13
+ 'jfreechart-1.0.13-experimental',
14
+ 'iText-2.1.5'
15
+ ]
16
+ end
17
+
18
+ Rfree.jars.each do |jar|
19
+ raise "You must set RFREECHART_JAR_PATH!" if ENV['RFREECHART_JAR_PATH'].nil?
20
+ begin
21
+ require File.join(ENV['RFREECHART_JAR_PATH'], jar)
22
+ rescue LoadError => e
23
+ STDERR.puts e.message
24
+ STDERR.puts "Make sure you have set RFREECHART_JAR_PATH to the path where your jfreechart jars are stored."
25
+ exit -1
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ begin
4
+ Ore::Specification.new do |gemspec|
5
+ # custom logic here
6
+ end
7
+ rescue NameError
8
+ begin
9
+ require 'ore/specification'
10
+ retry
11
+ rescue LoadError
12
+ STDERR.puts "The '#{__FILE__}' file requires Ore."
13
+ STDERR.puts "Run `gem install ore-core` to install Ore."
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'rfreechart'
3
+
4
+ describe Rfreechart do
5
+ it "should have a VERSION constant" do
6
+ subject.const_get('VERSION').should_not be_empty
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ require 'rspec'
2
+ require 'rfreechart/version'
3
+
4
+ include Rfreechart
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rfreechart
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Patrik Sundberg
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-31 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ requirement: *id001
25
+ prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.6.0
35
+ requirement: *id002
36
+ prerelease: false
37
+ type: :development
38
+ description: A thin jruby wrapper for jfreechart (mainly just a way to load the jars in a structured way for now)
39
+ email: []
40
+
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files:
46
+ - README.md
47
+ - ChangeLog.md
48
+ - LICENSE.txt
49
+ files:
50
+ - .document
51
+ - .gemtest
52
+ - .rspec
53
+ - .yardopts
54
+ - ChangeLog.md
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - examples/pie_chart_demo_1.rb
60
+ - gemspec.yml
61
+ - lib/rfreechart.rb
62
+ - lib/rfreechart/version.rb
63
+ - rfreechart.gemspec
64
+ - spec/rfreechart_spec.rb
65
+ - spec/spec_helper.rb
66
+ has_rdoc: yard
67
+ homepage: http://rubygems.org/gems/rfreechart
68
+ licenses:
69
+ - MIT
70
+ post_install_message:
71
+ rdoc_options: []
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 1.3.6
87
+ requirements: []
88
+
89
+ rubyforge_project: rfreechart
90
+ rubygems_version: 1.6.2
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Thin jruby wrapper for jfreechart
94
+ test_files:
95
+ - spec/rfreechart_spec.rb