svg-graph 2.2.0.beta → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/Rakefile +1 -0
- data/lib/SVG/Graph/C3js.rb +3 -3
- data/lib/SVG/Graph/Graph.rb +8 -0
- data/lib/SVG/Graph/Pie.rb +1 -1
- data/lib/svggraph.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c448a6423accd8618fa44587eeca0dc4f7b21ea99508c21dd95e5329cef59a5c
|
4
|
+
data.tar.gz: 4775e687abb3ebe350754e3287b925ab6b5d5624158664aacecfffc6cbcff680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba65a950336a3718b7c0fd01ddcd55261911ac00542518914165e22388bdbafd834ed928980af8aa4ad75523ad8572110fb82ef5b933897243b2153d52aed38
|
7
|
+
data.tar.gz: 19166679a0a198b667c240162aeb2438f77662130a03cbf430b289804b286b0fcd0c7e743b245eaebe2e982110946482ec6da94a02e29cc15d633808b74d952d
|
data/History.txt
CHANGED
@@ -2,6 +2,10 @@ TODO / Backlog
|
|
2
2
|
* refactor various hardcoded constant pixel offsets in Graph class to use named constants or variables
|
3
3
|
* Fix bug in Plot where min/max_x/y_value are not respected, TODO
|
4
4
|
|
5
|
+
=== 2.2.0 / 2019-11-26
|
6
|
+
* on top of 2.2.0.beta adds the following
|
7
|
+
* Fixed Divizion by zero when data is 0,0 in Pie [thanks chrismedrdz, PR #16]
|
8
|
+
* Automatically render graphs in iruby [thanks dansbits, PR #14]
|
5
9
|
|
6
10
|
=== 2.2.0.beta / 2019-05-07
|
7
11
|
* Fix typo in Plot's `scale_y_integers` [thanks ashleydavies, PR #9]
|
data/Rakefile
CHANGED
data/lib/SVG/Graph/C3js.rb
CHANGED
@@ -48,9 +48,9 @@ module SVG
|
|
48
48
|
def initialize(opts = {})
|
49
49
|
default_opts = {
|
50
50
|
"inline_dependencies" => false,
|
51
|
-
"d3_js" => "https://cdnjs.cloudflare.com/ajax/libs/d3/5.
|
52
|
-
"c3_css" => "https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.
|
53
|
-
"c3_js" => "https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.
|
51
|
+
"d3_js" => "https://cdnjs.cloudflare.com/ajax/libs/d3/5.12.0/d3.min.js",
|
52
|
+
"c3_css" => "https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.11/c3.min.css",
|
53
|
+
"c3_js" => "https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.11/c3.min.js"
|
54
54
|
}
|
55
55
|
@opts = default_opts.merge(opts)
|
56
56
|
if @opts["inline_dependencies"]
|
data/lib/SVG/Graph/Graph.rb
CHANGED
@@ -254,6 +254,14 @@ module SVG
|
|
254
254
|
return out
|
255
255
|
end
|
256
256
|
|
257
|
+
# Burns the graph to an SVG string and returns it with a text/html mime type to be
|
258
|
+
# displayed in IRuby.
|
259
|
+
#
|
260
|
+
# @return [Array] A 2-dimension array containing the SVg string and a mime-type. This is the format expected by IRuby.
|
261
|
+
def to_iruby
|
262
|
+
["text/html", burn_svg_only]
|
263
|
+
end
|
264
|
+
|
257
265
|
|
258
266
|
# Set the height of the graph box, this is the total height
|
259
267
|
# of the SVG box created - not the graph it self which auto
|
data/lib/SVG/Graph/Pie.rb
CHANGED
@@ -224,7 +224,7 @@ module SVG
|
|
224
224
|
rad_mult = 3.6 * RADIANS
|
225
225
|
@config[:fields].each_index { |count|
|
226
226
|
value = @data[count].to_f
|
227
|
-
percent = 100.0 * value / total
|
227
|
+
percent = total.zero? ? 0.0 : 100.0 * value / total
|
228
228
|
radians = prev_percent * rad_mult
|
229
229
|
|
230
230
|
if percent.rationalize(0.001) == 100.0
|
data/lib/svggraph.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svg-graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Russell
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2019-
|
15
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: "Gem version of SVG:::Graph. SVG:::Graph is a pure Ruby library for generating
|
18
18
|
charts,\nwhich are a type of graph where the values of one axis are not scalar.
|
@@ -68,9 +68,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
73
|
+
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubygems_version: 3.0.1
|
76
76
|
signing_key:
|