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 +4 -4
- data/lib/minichart.rb +1 -0
- data/lib/minichart/area_chart.rb +27 -0
- data/lib/minichart/bar_chart.rb +1 -1
- data/lib/minichart/line_chart.rb +23 -19
- data/lib/minichart/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4d765607cf018435ce99cafa73e90043dffdb7ab2bc9916510fc17a7a8a62b5
|
4
|
+
data.tar.gz: 4c523073e91db45609206898fd17dde2d8b968578bdbcf6ad0c82426d4611406
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398cb0c87ffe4348868975c32049c306c3e529d03a0215da786e90af24c76df9c158dabf57435ed71db9f66638c1f5caaf4f221e0f4fc7f35958109011d43575
|
7
|
+
data.tar.gz: 4d5592dd32f5350556859aff90cd82d0858ed2a7564cf68371e64b7d2cecc347af137ea8163bc7b7677b0567dcff1f042c33ac499afe106fba172ba38002cb9b
|
data/lib/minichart.rb
CHANGED
@@ -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
|
data/lib/minichart/bar_chart.rb
CHANGED
data/lib/minichart/line_chart.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
-
module Minichart
|
2
|
-
class LineChart < Chart
|
3
|
-
def build
|
4
|
-
svg.polyline fill: :none,
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
data/lib/minichart/version.rb
CHANGED
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.
|
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-
|
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
|