googlecharts 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 1.6.8
2
+ * added title alignment support
3
+
1
4
  == 1.6.7
2
5
  * changed url for ssl connection
3
6
 
data/README.markdown CHANGED
@@ -284,6 +284,23 @@ Google-o-meter
284
284
 
285
285
  A Google-o-meter has a few restrictions. It may only use a solid filled background and it may only have one label.
286
286
 
287
+ Record Chart PNG file in filesystem Sample :
288
+ --------------------------------------------
289
+
290
+ Multi Lines Chart Sample :
291
+
292
+ chart = Gchart.new( :type => 'line',
293
+ :title => "example title",
294
+ :data => [[17, 17, 11, 8, 2],[10, 20, 15, 5, 7],[2, 3, 7, 9, 12]],
295
+ :line_colors => 'e0440e,e62ae5,287eec',
296
+ :legend => ['courbe 1','courbe 2','courbe 3'],
297
+ :axis_with_labels => ['x', 'y'],
298
+ :axis_range => [[0,100,20], [0,20,5]],
299
+ :filename => "tmp/chart.png")
300
+
301
+ # Record file in filesystem
302
+ chart.file
303
+
287
304
  try yourself
288
305
  -------------
289
306
 
data/lib/gchart.rb CHANGED
@@ -39,7 +39,7 @@ class Gchart
39
39
  end
40
40
 
41
41
  attr_accessor :title, :type, :width, :height, :curved, :horizontal, :grouped, :legend, :legend_position, :labels, :data, :encoding, :bar_colors,
42
- :title_color, :title_size, :custom, :axis_with_labels, :axis_labels, :bar_width_and_spacing, :id, :alt, :klass,
42
+ :title_color, :title_size, :title_alignment, :custom, :axis_with_labels, :axis_labels, :bar_width_and_spacing, :id, :alt, :klass,
43
43
  :range_markers, :geographical_area, :map_colors, :country_codes, :axis_range, :filename, :min, :max, :colors, :usemap
44
44
 
45
45
  attr_accessor :bg_type, :bg_color, :bg_angle, :chart_type, :chart_color, :chart_angle, :axis_range, :thickness, :new_markers, :grid_lines, :use_ssl
@@ -314,8 +314,8 @@ class Gchart
314
314
  # A dark key will be used for the title color if no color is specified
315
315
  def set_title
316
316
  title_params = "chtt=#{title}"
317
- unless (title_color.nil? && title_size.nil? )
318
- title_params << "&chts=" + (color, size = (title_color || '454545'), title_size).compact.join(',')
317
+ unless (title_color.nil? && title_size.nil? && title_alignment.nil?)
318
+ title_params << "&chts=" + (color, size, alignment = (title_color || '454545'), title_size, (title_alignment.to_s[0,1] || 'c')).compact.join(',')
319
319
  end
320
320
  title_params
321
321
  end
@@ -1,3 +1,3 @@
1
1
  module GchartInfo #:nodoc:
2
- VERSION = "1.6.7"
2
+ VERSION = "1.6.8"
3
3
  end
data/spec/gchart_spec.rb CHANGED
@@ -372,9 +372,10 @@ describe "a line chart" do
372
372
  @chart.include?("chtt=Chart+Title").should be_true
373
373
  end
374
374
 
375
- it "should be able to a custom color and size title" do
375
+ it "should be able to a custom color, size and alignment for title" do
376
376
  Gchart.line(:title => @title, :title_color => 'FF0000').include?('chts=FF0000').should be_true
377
377
  Gchart.line(:title => @title, :title_size => '20').include?('chts=454545,20').should be_true
378
+ Gchart.line(:title => @title, :title_size => '20', :title_alignment => :left).include?('chts=454545,20,l').should be_true
378
379
  end
379
380
 
380
381
  it "should be able to have multiple legends" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googlecharts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 7
10
- version: 1.6.7
9
+ - 8
10
+ version: 1.6.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Aimonetti