charty-backends-jfreechart 0.2.0-java → 0.3.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0172928eeedf53bbaf9e305de8dcdaa0cc84026eb0fa12add80979812b702b33'
4
- data.tar.gz: 81a7b8aa2475e04e30eeee5131597babd0c738cde7065634248ffd181503bf5d
3
+ metadata.gz: d41b2c32f084ae212171fca17d7a82a955aca4c0c8d9c6caf27757351621468d
4
+ data.tar.gz: 866681ca87ffae6c85d16996514e4f1d9ac08e827798f4fe64c56ec16ed69479
5
5
  SHA512:
6
- metadata.gz: 8bdfcfa6ac01d4ea763702927d42d00d29c3ad88feaf2cdc05c88735246df9786a3f7345074538849b929297cce0744fefae38b27fd30b65371e390f53084d8b
7
- data.tar.gz: 5d3f685478d1e850af5a8dd29c5b27621b52c53593c9a32baa4d6100e8fe0b2ee20853e8597b6cb5a9ec86d8bebb717d3b2cd5d132e0eae03ca25704231af0fb
6
+ metadata.gz: 9a5237beacfc478199c7d243862cfab3971c2d534ff572b6038ef14e9425753829f75ec5bc4c8ac8763037ef360721202e47c6ab5a94e6e2f4411e8de334fe97
7
+ data.tar.gz: 895dfdda93147d4e61f4f6d2b198720881007a0c0a8ba923c14cc315b1eb756ccf7264a308889cb5a83c585d9156727dd41005525f0dc2f5148f9b877a8ef683
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Charty::Backends::Jfreechart
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/charty/backends/jfreechart`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Charty JFreeChart backend adapter
6
4
 
7
5
  ## Installation
8
6
 
@@ -4,7 +4,7 @@ require "charty/backends/jfreechart/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "charty-backends-jfreechart"
7
- spec.version = Charty::Backends::Jfreechart::VERSION
7
+ spec.version = Charty::Backends::JFreeChart::VERSION
8
8
  spec.authors = ["284km"]
9
9
  spec.email = ["k.furuhashi10@gmail.com"]
10
10
 
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  spec.add_dependency "charty"
34
- spec.add_dependency "fileutils"
35
34
  spec.add_development_dependency "bundler"
36
35
  spec.add_development_dependency "rake"
37
36
  spec.add_development_dependency "test-unit"
@@ -13,165 +13,158 @@ java_import 'org.jfree.data.xy.XYSeriesCollection'
13
13
 
14
14
  module Charty
15
15
  module Backends
16
- module Jfreechart
17
- class Error < StandardError; end
18
- # Your code goes here...
19
- end
20
- end
21
- end
16
+ class JFreeChart
17
+ Backends.register(:jfreechart, self)
22
18
 
23
- module Charty
24
- class JFreeChart < PlotterAdapter
25
- Name = "jfreechart"
26
-
27
- def initialize
28
- @plot = ChartFactory
29
- end
19
+ def initialize
20
+ @plot = ::ChartFactory
21
+ end
30
22
 
31
- def label(x, y)
32
- end
23
+ def label(x, y)
24
+ end
33
25
 
34
- def series=(series)
35
- @series = series
36
- end
26
+ def series=(series)
27
+ @series = series
28
+ end
37
29
 
38
- def render_layout(layout)
39
- raise NotImplementedError
40
- end
30
+ def render_layout(layout)
31
+ raise NotImplementedError
32
+ end
41
33
 
42
- def render(context, filename)
43
- # todo: I'm not sure if I can only render.
34
+ def render(context, filename)
35
+ # todo: I'm not sure if I can only render.
44
36
 
45
- chart = plot(@plot, context)
46
- # todo: add options for width and height
47
- width = 1000
48
- height = 800
49
- if filename
50
- FileUtils.mkdir_p(File.dirname(filename))
51
- javafile = java.io.File.new(filename)
52
- ChartUtilities.saveChartAsPNG(javafile, chart, width, height)
37
+ chart = plot(@plot, context)
38
+ # todo: add options for width and height
39
+ width = 1000
40
+ height = 800
41
+ if filename
42
+ FileUtils.mkdir_p(File.dirname(filename))
43
+ javafile = java.io.File.new(filename)
44
+ ChartUtilities.saveChartAsPNG(javafile, chart, width, height)
45
+ end
53
46
  end
54
- end
55
47
 
56
- def save(context, filename)
57
- # todo:
58
- end
48
+ def save(context, filename)
49
+ # todo:
50
+ end
59
51
 
60
- def plot(plot, context, subplot: false)
61
- case context.method
62
- when :bar
63
- dataset = DefaultCategoryDataset.new
64
- context.series.each do |data|
65
- data.ys.to_a.zip(Array.new(data.xs.size, data.label.to_s), data.xs.to_a.map(&:to_s)).each do |d|
66
- dataset.addValue(*d)
52
+ def plot(plot, context, subplot: false)
53
+ case context.method
54
+ when :bar
55
+ dataset = DefaultCategoryDataset.new
56
+ context.series.each do |data|
57
+ data.ys.to_a.zip(Array.new(data.xs.size, data.label.to_s), data.xs.to_a.map(&:to_s)).each do |d|
58
+ dataset.addValue(*d)
59
+ end
67
60
  end
68
- end
69
- title = context.title || ""
70
- xlabel = context.xlabel || ""
71
- ylabel = context.ylabel || ""
72
- plot.createBarChart(
73
- title,
74
- xlabel,
75
- ylabel,
76
- dataset,
77
- PlotOrientation::VERTICAL,
78
- true,
79
- false,
80
- false
81
- )
82
- when :barh
83
- dataset = DefaultCategoryDataset.new
84
- context.series.each do |data|
85
- data.ys.to_a.zip(Array.new(data.xs.size, data.label.to_s), data.xs.to_a.map(&:to_s)).each do |d|
86
- dataset.addValue(*d)
61
+ title = context.title || ""
62
+ xlabel = context.xlabel || ""
63
+ ylabel = context.ylabel || ""
64
+ plot.createBarChart(
65
+ title,
66
+ xlabel,
67
+ ylabel,
68
+ dataset,
69
+ PlotOrientation::VERTICAL,
70
+ true,
71
+ false,
72
+ false
73
+ )
74
+ when :barh
75
+ dataset = DefaultCategoryDataset.new
76
+ context.series.each do |data|
77
+ data.ys.to_a.zip(Array.new(data.xs.size, data.label.to_s), data.xs.to_a.map(&:to_s)).each do |d|
78
+ dataset.addValue(*d)
79
+ end
87
80
  end
88
- end
89
- title = context.title || ""
90
- xlabel = context.xlabel || ""
91
- ylabel = context.ylabel || ""
92
- plot.createBarChart(
93
- title,
94
- xlabel,
95
- ylabel,
96
- dataset,
97
- PlotOrientation::HORIZONTAL,
98
- true,
99
- false,
100
- false
101
- )
102
- when :box_plot
103
- # todo:
104
- raise NotImplementedError
105
- when :bubble
106
- dataset = MatrixSeriesCollection.new
107
- context.series.each do |data|
108
- # todo: fix args
109
- series = MatrixSeries.new(data.label.to_s, 1000, 1000)
110
- data.xs.to_a.zip(data.ys.to_a, data.zs.to_a).each do |series_param|
111
- series.update(*series_param)
81
+ title = context.title || ""
82
+ xlabel = context.xlabel || ""
83
+ ylabel = context.ylabel || ""
84
+ plot.createBarChart(
85
+ title,
86
+ xlabel,
87
+ ylabel,
88
+ dataset,
89
+ PlotOrientation::HORIZONTAL,
90
+ true,
91
+ false,
92
+ false
93
+ )
94
+ when :box_plot
95
+ # todo:
96
+ raise NotImplementedError
97
+ when :bubble
98
+ dataset = MatrixSeriesCollection.new
99
+ context.series.each do |data|
100
+ # todo: fix args
101
+ series = MatrixSeries.new(data.label.to_s, 1000, 1000)
102
+ data.xs.to_a.zip(data.ys.to_a, data.zs.to_a).each do |series_param|
103
+ series.update(*series_param)
104
+ end
105
+ dataset.addSeries(series)
112
106
  end
113
- dataset.addSeries(series)
114
- end
115
- title = context.title || ""
116
- xlabel = context.xlabel || ""
117
- ylabel = context.ylabel || ""
118
- plot.createBubbleChart(
119
- title,
120
- xlabel,
121
- ylabel,
122
- dataset,
123
- PlotOrientation::VERTICAL,
124
- true,
125
- false,
126
- false
127
- )
128
- when :curve
129
- dataset = DefaultCategoryDataset.new
130
- context.series.each do |data|
131
- data.xs.to_a.zip(data.ys.to_a).each do |a|
132
- dataset.addValue(a[1], data.label.to_s, a[0])
107
+ title = context.title || ""
108
+ xlabel = context.xlabel || ""
109
+ ylabel = context.ylabel || ""
110
+ plot.createBubbleChart(
111
+ title,
112
+ xlabel,
113
+ ylabel,
114
+ dataset,
115
+ PlotOrientation::VERTICAL,
116
+ true,
117
+ false,
118
+ false
119
+ )
120
+ when :curve
121
+ dataset = DefaultCategoryDataset.new
122
+ context.series.each do |data|
123
+ data.xs.to_a.zip(data.ys.to_a).each do |a|
124
+ dataset.addValue(a[1], data.label.to_s, a[0])
125
+ end
133
126
  end
134
- end
135
- title = context.title || ""
136
- xlabel = context.xlabel || ""
137
- ylabel = context.ylabel || ""
138
- plot.createLineChart(
139
- title,
140
- xlabel,
141
- ylabel,
142
- dataset,
143
- PlotOrientation::VERTICAL,
144
- true,
145
- false,
146
- false
147
- )
148
- when :scatter
149
- dataset = XYSeriesCollection.new
150
- context.series.each do |data|
151
- series = XYSeries.new(data.label.to_s)
152
- data.xs.to_a.zip(data.ys.to_a).each do |series_param|
153
- series.add(*series_param)
127
+ title = context.title || ""
128
+ xlabel = context.xlabel || ""
129
+ ylabel = context.ylabel || ""
130
+ plot.createLineChart(
131
+ title,
132
+ xlabel,
133
+ ylabel,
134
+ dataset,
135
+ PlotOrientation::VERTICAL,
136
+ true,
137
+ false,
138
+ false
139
+ )
140
+ when :scatter
141
+ dataset = XYSeriesCollection.new
142
+ context.series.each do |data|
143
+ series = XYSeries.new(data.label.to_s)
144
+ data.xs.to_a.zip(data.ys.to_a).each do |series_param|
145
+ series.add(*series_param)
146
+ end
147
+ dataset.addSeries(series)
154
148
  end
155
- dataset.addSeries(series)
149
+ title = context.title || ""
150
+ xlabel = context.xlabel || ""
151
+ ylabel = context.ylabel || ""
152
+ plot.createScatterPlot(
153
+ title,
154
+ xlabel,
155
+ ylabel,
156
+ dataset,
157
+ PlotOrientation::VERTICAL,
158
+ true,
159
+ false,
160
+ false
161
+ )
162
+ when :error_bar
163
+ raise NotImplementedError
164
+ when :hist
165
+ # todo:
166
+ raise NotImplementedError
156
167
  end
157
- title = context.title || ""
158
- xlabel = context.xlabel || ""
159
- ylabel = context.ylabel || ""
160
- plot.createScatterPlot(
161
- title,
162
- xlabel,
163
- ylabel,
164
- dataset,
165
- PlotOrientation::VERTICAL,
166
- true,
167
- false,
168
- false
169
- )
170
- when :error_bar
171
- raise NotImplementedError
172
- when :hist
173
- # todo:
174
- raise NotImplementedError
175
168
  end
176
169
  end
177
170
  end
@@ -1,7 +1,7 @@
1
1
  module Charty
2
2
  module Backends
3
- module Jfreechart
4
- VERSION = "0.2.0"
3
+ class JFreeChart
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charty-backends-jfreechart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - 284km
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-05 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- name: fileutils
48
- prerelease: false
49
- type: :runtime
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  requirement: !ruby/object:Gem::Requirement
57
43
  requirements: