mattetti-googlecharts 1.3.5 → 1.3.6

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/History.txt CHANGED
@@ -1,4 +1,8 @@
1
- == 1.3.X
1
+ == 1.3.6
2
+ * support nil values. The Google Charts API specifies that a single underscore (_) can be used to omit a value from a line chart with 'simple' data encoding, and a double underscore (__) can do the same for a chart with 'extended' data encoding. (Matt Moyer)
3
+ * allow a label to appear on a google-o-meter via the :legend option. (hallettj)
4
+
5
+ == 1.3.5
2
6
  * added code to properly escape image tag URLs (mokolabs)
3
7
  * added themes support + 4 default themes (keynote, thirty7signals, pastel, greyscale) chart.line(:theme=>:keynote) (jakehow)
4
8
 
@@ -2,7 +2,7 @@ module GchartInfo #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 3
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/gchart.rb CHANGED
@@ -235,7 +235,7 @@ class Gchart
235
235
  # or
236
236
  # Gchart.line(:legend => ['first label', 'last label'])
237
237
  def set_legend
238
- return set_labels if @type == :pie || @type == :pie_3d
238
+ return set_labels if @type == :pie || @type == :pie_3d || @type == :meter
239
239
 
240
240
  if @legend.is_a?(Array)
241
241
  "chdl=#{@legend.map{|label| "#{label}"}.join('|')}"
@@ -325,12 +325,12 @@ class Gchart
325
325
  # to about 300 pixels. Simple encoding is suitable for all other types of chart regardless of size.
326
326
  def simple_encoding(dataset=[])
327
327
  dataset = prepare_dataset(dataset)
328
- @max_value = dataset.map{|ds| ds.max}.max if @max_value == 'auto'
328
+ @max_value = dataset.compact.map{|ds| ds.compact.max}.max if @max_value == 'auto'
329
329
 
330
330
  if @max_value == false || @max_value == 'false' || @max_value == :false || @max_value == 0
331
- "s:" + dataset.map { |ds| ds.map { |number| convert_to_simple_value(number) }.join }.join(',')
331
+ "s:" + dataset.map { |ds| ds.map { |number| number.nil? ? '_' : convert_to_simple_value(number) }.join }.join(',')
332
332
  else
333
- "s:" + dataset.map { |ds| ds.map { |number| convert_to_simple_value( (@@simple_chars.size - 1) * number / @max_value) }.join }.join(',')
333
+ "s:" + dataset.map { |ds| ds.map { |number| number.nil? ? '_' : convert_to_simple_value( (@@simple_chars.size - 1) * number / @max_value) }.join }.join(',')
334
334
  end
335
335
 
336
336
  end
@@ -361,12 +361,12 @@ class Gchart
361
361
  def extended_encoding(dataset=[])
362
362
 
363
363
  dataset = prepare_dataset(dataset)
364
- @max_value = dataset.map{|ds| ds.max}.max if @max_value == 'auto'
364
+ @max_value = dataset.compact.map{|ds| ds.compact.max}.max if @max_value == 'auto'
365
365
 
366
366
  if @max_value == false || @max_value == 'false' || @max_value == :false
367
- "e:" + dataset.map { |ds| ds.map { |number| convert_to_extended_value(number)}.join }.join(',')
367
+ "e:" + dataset.map { |ds| ds.map { |number| number.nil? ? '__' : convert_to_extended_value(number)}.join }.join(',')
368
368
  else
369
- "e:" + dataset.map { |ds| ds.map { |number| convert_to_extended_value( (@@ext_pairs.size - 1) * number / @max_value) }.join }.join(',')
369
+ "e:" + dataset.map { |ds| ds.map { |number| number.nil? ? '__' : convert_to_extended_value( (@@ext_pairs.size - 1) * number / @max_value) }.join }.join(',')
370
370
  end
371
371
 
372
372
  end
@@ -414,4 +414,4 @@ class Gchart
414
414
  jstize(@@url + query_params.join(delimiter))
415
415
  end
416
416
 
417
- end
417
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattetti-googlecharts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Aimonetti