chart_js 1.1.0 → 1.1.1

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: e954b9160710621bd2ab2e31e6b331bd3a91d5b51034aa34067d64cc1fd505f7
4
- data.tar.gz: 62d724692b5cc246de04e93077cc1d913a0897d3aa3a8409c2204d28066b059b
3
+ metadata.gz: 8b6aa8814c2ec895adffa9efcba923db5b682c9f2a2fa09990c61940f5621535
4
+ data.tar.gz: 530195cc0d5d1a862d795f0b5a92b4df76fa1af4bd414e410bcd0977d96f8866
5
5
  SHA512:
6
- metadata.gz: 63eeb922760959d2211eaefbb3afb6734d2df3796fd92cb51d92ae341f1ad899886ea950f23c03ed55c19904dbaafa8bbd29b4c6d4f1f133f13a779070dd5745
7
- data.tar.gz: a659fa4048fe4169464055f8d242b6045812035fce1631bf2fffd4becc9c607c1cf5cbfef5c6f81b3e8e47773cec8e77b23f9c96edd5ece78680476dc04b0927
6
+ metadata.gz: 3c33b1e5aeafa63162d184fd85d68efb8c2b842c251359a3d39bdd8e52f806130749986b1f49d83abda7383fa61755c587ea23813754f64bac412ab3a295520e
7
+ data.tar.gz: 6af2968c622a1227f87e6cea5eb1f44f168b6a5c326990076feb422eff2d8d4784e59b750a01c78f9c1881d778035bdfcca061d1d99fa0ea653c7fdff3688b4d
@@ -13,16 +13,26 @@ module ChartJS
13
13
  label(label)
14
14
  build(&block)
15
15
  end
16
-
16
+
17
17
  def build(&block)
18
18
  instance_eval(&block)
19
- @container
19
+ @container
20
+ end
21
+
22
+ def method_missing(m, *args, &block)
23
+ m = m.to_s
24
+ if m.to_s.include?('_')
25
+ parts = m.split('_').collect(&:capitalize)
26
+ parts[0] = parts[0].downcase
27
+ m = parts.join
28
+ end
29
+ @container[m] = args.first
20
30
  end
21
31
 
22
32
  def data(value)
23
33
  @container['data'] = value
24
34
  end
25
-
35
+
26
36
  def label(value)
27
37
  @container['label'] = value
28
38
  end
@@ -30,7 +40,7 @@ module ChartJS
30
40
  def fill(value = true)
31
41
  @container['fill'] = value
32
42
  end
33
-
43
+
34
44
  def axis_id(value, axis)
35
45
  case axis
36
46
  when :x
@@ -39,15 +49,15 @@ module ChartJS
39
49
  @container['yAxisID'] = value
40
50
  end
41
51
  end
42
-
52
+
43
53
  def color(value = :random, type = :both)
44
54
  if value == :random
45
55
  c = "##{SecureRandom.hex(3)}"
46
- color c, :border if type == :both || type == :border
56
+ color c, :border if type == :both || type == :border
47
57
  color c, :background if type == :both || type == :background
48
- return
58
+ return
49
59
  end
50
- case type
60
+ case type
51
61
  when :border
52
62
  @container['borderColor'] = value
53
63
  when :background
@@ -57,7 +67,7 @@ module ChartJS
57
67
  color value, :background
58
68
  end
59
69
  end
60
-
70
+
61
71
  def span_gaps(value = true)
62
72
  @container['spanGaps'] = value
63
73
  end
@@ -69,11 +79,11 @@ module ChartJS
69
79
  def border(&block)
70
80
  @container = Border.new(@container).build(&block)
71
81
  end
72
-
82
+
73
83
  def point(&block)
74
84
  @container = Point.new(@container).build(&block)
75
85
  end
76
-
86
+
77
87
  def line(&block)
78
88
  @container = Line.new(@container).build(&block)
79
89
  end
@@ -1,3 +1,3 @@
1
1
  module ChartJS
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chart_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kent 'picat' Gruber