minichart 0.1.0 → 0.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: 0574d786b6188b0f2ed6977760ad85bbd2f2487a6d010de8e7be7f50127d51a3
4
- data.tar.gz: 5b138c614099b58ff7365a38246641a586417c0fdccb6e1e2677494603f01eb8
3
+ metadata.gz: c4d765607cf018435ce99cafa73e90043dffdb7ab2bc9916510fc17a7a8a62b5
4
+ data.tar.gz: 4c523073e91db45609206898fd17dde2d8b968578bdbcf6ad0c82426d4611406
5
5
  SHA512:
6
- metadata.gz: 49471660072528ec03c129fb0b549b88f3a2a9f3f5286b969579402ddfb9233c7eb617f1fa64821273a43a88042a724432324bad8f7f0d0143d5825778f4d5fb
7
- data.tar.gz: 23d208d26569d432380615d0e5e479a92dfa61492841cbd9c9211dd8c94c036f5be467f5710de49a66b58cffa92a2c3066f9a4a2bf6933fea72ba69c59b9e811
6
+ metadata.gz: 398cb0c87ffe4348868975c32049c306c3e529d03a0215da786e90af24c76df9c158dabf57435ed71db9f66638c1f5caaf4f221e0f4fc7f35958109011d43575
7
+ data.tar.gz: 4d5592dd32f5350556859aff90cd82d0858ed2a7564cf68371e64b7d2cecc347af137ea8163bc7b7677b0567dcff1f042c33ac499afe106fba172ba38002cb9b
data/lib/minichart.rb CHANGED
@@ -2,3 +2,4 @@ require 'victor'
2
2
  require 'minichart/chart'
3
3
  require 'minichart/line_chart'
4
4
  require 'minichart/bar_chart'
5
+ require 'minichart/area_chart'
@@ -0,0 +1,27 @@
1
+ module Minichart
2
+ class AreaChart < Chart
3
+ def build
4
+ svg.polyline fill: color,
5
+ stroke: color,
6
+ stroke_width: stroke,
7
+ stroke_linejoin: :round,
8
+ points: points
9
+ end
10
+
11
+ protected
12
+
13
+ def points
14
+ result = ["0,#{height}"]
15
+
16
+ inverted_points.each do |point|
17
+ x = width*point[0]
18
+ y = height*point[1]
19
+ result << "#{x},#{y}"
20
+ end
21
+
22
+ result << "#{width},#{height}"
23
+
24
+ result
25
+ end
26
+ end
27
+ end
@@ -8,7 +8,7 @@ module Minichart
8
8
  end
9
9
  end
10
10
 
11
- private
11
+ protected
12
12
 
13
13
  def bar_width
14
14
  @bar_width ||= width / data.size
@@ -1,19 +1,23 @@
1
- module Minichart
2
- class LineChart < Chart
3
- def build
4
- svg.polyline fill: :none, stroke: color, stroke_width: stroke, points: points
5
- end
6
-
7
- private
8
-
9
- def points
10
- result = []
11
- inverted_points.each do |point|
12
- x = width*point[0]
13
- y = height*point[1]
14
- result << "#{x},#{y}"
15
- end
16
- result
17
- end
18
- end
19
- end
1
+ module Minichart
2
+ class LineChart < Chart
3
+ def build
4
+ svg.polyline fill: :none,
5
+ stroke: color,
6
+ stroke_width: stroke,
7
+ stroke_linejoin: :round,
8
+ points: points
9
+ end
10
+
11
+ protected
12
+
13
+ def points
14
+ result = []
15
+ inverted_points.each do |point|
16
+ x = width*point[0]
17
+ y = height*point[1]
18
+ result << "#{x},#{y}"
19
+ end
20
+ result
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Minichart
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minichart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-22 00:00:00.000000000 Z
11
+ date: 2019-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: victor
@@ -32,6 +32,7 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - README.md
34
34
  - lib/minichart.rb
35
+ - lib/minichart/area_chart.rb
35
36
  - lib/minichart/bar_chart.rb
36
37
  - lib/minichart/chart.rb
37
38
  - lib/minichart/line_chart.rb