pill_chart 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -0
  3. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ec32abdf67ce0d179656aa8b07435d711e101c7
4
- data.tar.gz: 643c133491dc0658ce6fc6706dab22d1ac22044c
3
+ metadata.gz: 71aaa2be14646ab7e71ec996338ea0c7cc70d83b
4
+ data.tar.gz: df173be1f47f1285e8b3ca996b577f83d2eb58dd
5
5
  SHA512:
6
- metadata.gz: bf00bbe64b9091f6e57f7fc3e4a576fca9aa50f4f5498c6d45db7909f3da7ffaa88431155019dfdc50c6c339394c5d9563ab5b0ec81c25df77fad5096da22da2
7
- data.tar.gz: d103f1caecbcc3355ab9dc8ffee22f210cbc13a6a648e08c6422fc66bc2ebe1ba78109071233455efaab8c2f077e6640032d5adf20c765f6432b0d7d8ea4ea3a
6
+ metadata.gz: 3be7203d38fab036da7ee5e3028cc5db8b13cdc59fe14cc7bd873405d1b571dcbf4dbe04f4eb67d2fcc5b6b3b14618d5046c3028def5fa1048ed17013e9576f2
7
+ data.tar.gz: 58a55ed012683541413e033b673bef1dd05bf598d2b46ba8318fb327b94b301806d6a8fc9fdc11006018f9a77608d37aad552c6d372b8c491aba235989e314d6
@@ -0,0 +1,72 @@
1
+ ![one simple pills](https://raw.githubusercontent.com/lambdaweb/pillchart/gh-pages/one_pill_simple.png) PillChart
2
+ =========
3
+
4
+ ### A simple rubygem for create little *svg* pill charts.
5
+
6
+ *Like this :*
7
+
8
+ ![state_pills](https://raw.githubusercontent.com/lambdaweb/pillchart/gh-pages/pill_state.png)
9
+
10
+ *Or without progression state :*
11
+
12
+ ![simple_pills](https://raw.githubusercontent.com/lambdaweb/pillchart/gh-pages/pill_simple_.png)
13
+
14
+ > It can be used alone, or in Rails (tested in 4.0.4) as a view helper.
15
+
16
+ ### Use it in Rails in 3 steps
17
+
18
+ 1. **Add `pill_chart` to your Gemfile** (by adding this line: `gem 'pill_chart', '~> 1.0.2'`)
19
+ 2. **Run `bundle install`** into your terminal, on your rails project directory
20
+ 3. **Use the following methods directly into your views !** (Don't forget to mark it as `html_safe`)
21
+
22
+ ### Helpers overview
23
+
24
+ ```ruby
25
+ # It will draw a simple pill, filled to `value`.
26
+ draw_pill_chart(height: 10, width: 60, value: 33, max: 100, colors: {})
27
+ ```
28
+
29
+ ```ruby
30
+ # It will draw a stated pill (the color changes with the value), filled to `value`.
31
+ draw_state_pill_chart(height: 10, width: 60, value: 33, max: 100, colors: {})
32
+ ```
33
+
34
+ ### Some examples
35
+
36
+ Draw a simple pill at 33% (![simple pills](https://raw.githubusercontent.com/lambdaweb/pillchart/gh-pages/one_pill_simple.png) ) in a Rails view:
37
+ ```erb
38
+ <%= draw_pill_chart(width: 60, value: 33).html_safe %>
39
+ ```
40
+ --------------------------------------------
41
+ Draw a state pill at 70% (![state pills](https://raw.githubusercontent.com/lambdaweb/pillchart/gh-pages/one_pill_state.png) ) in a Rails view:
42
+ ```erb
43
+ <%= draw_state_pill_chart(width: 60, value: 70).html_safe %>
44
+ ```
45
+
46
+ ### Available parameters
47
+
48
+ The `max` parameter represents the maximum value.
49
+ For example, a value of `60` and a max of `120` will fill **the half** of the pill.
50
+
51
+ You can pass custom colors in a hash to the `colors` parameter.
52
+ The color's default values are :
53
+ ```ruby
54
+ colors = {
55
+ "background" => "#eee", # the background colour
56
+ "foreground" => "#999", # the pill color when it's a simple pill (not a state pill)
57
+ "low" => "#AD6D6D", # the pill color under 20% when it's a state pill
58
+ "medium" => "#C59663", # the pill color between 20 and 40% when it's a state pill
59
+ "high" => "#ADC563", # the pill color between 40 and 70% when it's a state pill
60
+ "full" => "#92C447" # the pill color between 70 and 100% when it's a state pill
61
+ }
62
+ ```
63
+
64
+ ### Use it without Rails
65
+
66
+ ```ruby
67
+ # Create a new SimplePillChart object, with theses parameters
68
+ elt = PillChart::SimplePillChart.new(height, width, value, max, :simple, colors)
69
+
70
+ # Run the pill method to generate the svg content
71
+ elt.pill
72
+ ```
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pill_chart
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Aubin
@@ -14,8 +14,10 @@ description: Create little svg pill charts
14
14
  email: andre.aubin@lambdaweb.fr
15
15
  executables: []
16
16
  extensions: []
17
- extra_rdoc_files: []
17
+ extra_rdoc_files:
18
+ - README.md
18
19
  files:
20
+ - README.md
19
21
  - lib/pill_chart.rb
20
22
  - lib/pill_chart/railtie.rb
21
23
  - lib/pill_chart/simple_pill_chart.rb