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 +4 -4
- data/lib/chart_js/chart/dataset.rb +21 -11
- data/lib/chart_js/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b6aa8814c2ec895adffa9efcba923db5b682c9f2a2fa09990c61940f5621535
|
4
|
+
data.tar.gz: 530195cc0d5d1a862d795f0b5a92b4df76fa1af4bd414e410bcd0977d96f8866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/chart_js/version.rb
CHANGED