svg_charts 1.0.3 → 1.01

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,56 +1,52 @@
1
- # SVGCharts
1
+ = SVGCharts
2
2
 
3
3
  Draw charts using SVG.
4
4
 
5
- ## Installation
5
+ == Installation
6
6
 
7
7
  gem install svg_charts
8
8
 
9
- ## Usage
9
+ == Usage
10
10
 
11
- ~~~.ruby
12
- #=> file.rb
11
+ # file.rb
12
+ require "rubygems"
13
+ require "svg_charts"
13
14
 
14
- require "rubygems"
15
- require "svg_charts"
15
+ @line = SVGCharts::Line.new({
16
+ :height => 300,
17
+ :width => 300,
18
+ :y_retreat => 20,
19
+ :x_retreat => 20
20
+ })
16
21
 
17
- line = SVGCharts::Line.new({
18
- :height => 300,
19
- :width => 300,
20
- :y_retreat => 20,
21
- :x_retreat => 20
22
- })
22
+ @scale = @line.scale({
23
+ :y_label => "Numbers",
24
+ :x_label => "Letters"
25
+ })
23
26
 
24
- @scale = line.scale({
25
- :y_label => "Numbers",
26
- :x_label => "Letters"
27
- })
27
+ @chart << @line.draw({
28
+ :scale => ["A", "B", "C"],
29
+ :data => [10, 20, 30],
30
+ :data_color => "#000000",
31
+ :show_scale => true,
32
+ :show_dashed => true
33
+ })
28
34
 
29
- @chart = line.draw({
30
- :scale => ["A", "B", "C"],
31
- :data => [10, 20, 30],
32
- :data_color => "#000000",
33
- :show_scale => true,
34
- :show_dashed => true
35
- })
36
- ~~~
35
+ # file.html
36
+ <svg width="680" height="350">
37
+ <%= @scale %>
38
+ <%= @chart %>
39
+ </svg>
37
40
 
38
- # file.erb
41
+ == Maintainer
39
42
 
40
- <svg width="680" height="350">
41
- <%= @scale %>
42
- <%= @chart %>
43
- </svg>
43
+ * Rogério Zambon (http://rogeriozambon.com)
44
44
 
45
- ## Maintainer
46
-
47
- * Rogério Zambon (http://rogerio.me)
48
-
49
- ## Collaborators
45
+ == Collaborators
50
46
 
51
47
  * André Ronix (http://www.linkedin.com/pub/andr%C3%A9-s-ronix/27/212/3b2): Generated the coordinates calc.
52
48
 
53
- ## License
49
+ == License
54
50
 
55
51
  (The MIT License)
56
52
 
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.01
data/lib/charts/line.rb CHANGED
@@ -2,7 +2,7 @@ module SVGCharts
2
2
  class Line
3
3
  include SVGElements
4
4
 
5
- def initialize(options)
5
+ def initialize(options = {})
6
6
  validation options, [:width, :height, :y_retreat, :x_retreat]
7
7
 
8
8
  @width = options[:width]
@@ -12,7 +12,7 @@ module SVGCharts
12
12
  @x_retreat = options[:x_retreat]
13
13
  end
14
14
 
15
- def scale(options)
15
+ def scale(options = {})
16
16
  validation options, [:y_label, :x_label]
17
17
 
18
18
  scale = line({
@@ -55,7 +55,7 @@ module SVGCharts
55
55
  scale
56
56
  end
57
57
 
58
- def draw(options)
58
+ def draw(options = {})
59
59
  validation options, [:scale, :data, :data_color, :show_scale, :show_dashed]
60
60
 
61
61
  calculate_coordinates options[:data]
@@ -69,7 +69,7 @@ module SVGCharts
69
69
  :y1 => coordinate[2],
70
70
  :y2 => coordinate[3],
71
71
  :line_width => 1,
72
- :color => options[:data_color]
72
+ :color => "#999"
73
73
  })
74
74
 
75
75
  if options[:show_dashed]
data/lib/svg_charts.rb CHANGED
@@ -1,3 +1,2 @@
1
1
  require "charts/elements"
2
2
  require "charts/line"
3
- require "charts/version"
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1 @@
1
- require "bundler/setup"
2
- Bundler.require :default, :development
3
-
4
- require "svg_charts"
5
- require "charts/elements"
6
- require "charts/line"
1
+ Dir[File.expand_path("../../lib/charts", __FILE__) + "/*.rb"].each { |file| require file }
data/svg_charts.gemspec CHANGED
@@ -1,19 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "charts/version"
4
-
5
2
  Gem::Specification.new do |s|
6
- s.name = "svg_charts"
7
- s.version = SVGCharts::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Rogério Zambon"]
10
- s.email = ["rogeriozambon@gmail.com"]
11
- s.homepage = "http://github.com/rogeriozambon/svg_charts"
12
- s.summary = "Draw charts using SVG."
13
- s.description = s.summary
14
-
15
- s.files = `git ls-files`.split("\n")
3
+ s.authors = ["Rogério Zambon"]
4
+ s.date = "2013-01-25"
5
+ s.description = "Draw charts using SVG."
6
+ s.email = "rogeriozambon@gmail.com"
7
+ s.files = [
8
+ ".rspec",
9
+ "lib/charts/elements.rb",
10
+ "lib/charts/line.rb",
11
+ "lib/svg_charts.rb",
12
+ "spec/spec_helper.rb",
13
+ "spec/charts/line_spec.rb",
14
+ "VERSION",
15
+ "README.rdoc",
16
+ "svg_charts.gemspec"
17
+ ]
18
+ s.homepage = "http://github.com/rogeriozambon/svg_charts"
19
+ s.name = "svg_charts"
16
20
  s.require_paths = ["lib"]
17
-
18
- s.add_development_dependency "rspec"
21
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.8.23")
22
+ s.summary = s.description
23
+ s.version = "1.01"
19
24
  end
metadata CHANGED
@@ -1,68 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svg_charts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: '1.01'
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Rogério Zambon
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-14 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rspec
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
12
+ date: 2013-01-25 00:00:00.000000000 Z
13
+ dependencies: []
27
14
  description: Draw charts using SVG.
28
- email:
29
- - rogeriozambon@gmail.com
15
+ email: rogeriozambon@gmail.com
30
16
  executables: []
31
17
  extensions: []
32
18
  extra_rdoc_files: []
33
19
  files:
34
20
  - .rspec
35
- - Gemfile
36
- - Gemfile.lock
37
- - README.md
38
21
  - lib/charts/elements.rb
39
22
  - lib/charts/line.rb
40
- - lib/charts/version.rb
41
23
  - lib/svg_charts.rb
42
- - spec/charts/line_spec.rb
43
24
  - spec/spec_helper.rb
25
+ - spec/charts/line_spec.rb
26
+ - VERSION
27
+ - README.rdoc
44
28
  - svg_charts.gemspec
45
29
  homepage: http://github.com/rogeriozambon/svg_charts
46
30
  licenses: []
47
- metadata: {}
48
31
  post_install_message:
49
32
  rdoc_options: []
50
33
  require_paths:
51
34
  - lib
52
35
  required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
53
37
  requirements:
54
- - - '>='
38
+ - - ! '>='
55
39
  - !ruby/object:Gem::Version
56
40
  version: '0'
57
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
+ none: false
58
43
  requirements:
59
- - - '>='
44
+ - - ! '>='
60
45
  - !ruby/object:Gem::Version
61
- version: '0'
46
+ version: 1.8.23
62
47
  requirements: []
63
48
  rubyforge_project:
64
- rubygems_version: 2.0.0
49
+ rubygems_version: 1.8.23
65
50
  signing_key:
66
- specification_version: 4
51
+ specification_version: 3
67
52
  summary: Draw charts using SVG.
68
53
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 54e2d61c5b862d2563636268a0b6f257a1eb4512
4
- data.tar.gz: 3b8f4b7399292b8f92e75ec201c829f42b1db1fb
5
- SHA512:
6
- metadata.gz: f461cce55168620110f26c085dadeff3c75b977c86379be58e0b88abb5436720186bb204ebd22159eb4f974de6414d8bec1a8c2f765fb7b5f0164e5db3bea621
7
- data.tar.gz: 941dd3606d129893f975b1728431a8b0b24826c9be194c9acbfdf0fd94a2074efc26181d900ab14ae524c5f5095d003be83a48828c8eba7ca9d9a86fe5d44619
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "http://rubygems.org"
2
- gemspec
data/Gemfile.lock DELETED
@@ -1,24 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- svg_charts (1.0.3)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- diff-lcs (1.2.1)
10
- rspec (2.13.0)
11
- rspec-core (~> 2.13.0)
12
- rspec-expectations (~> 2.13.0)
13
- rspec-mocks (~> 2.13.0)
14
- rspec-core (2.13.1)
15
- rspec-expectations (2.13.0)
16
- diff-lcs (>= 1.1.3, < 2.0)
17
- rspec-mocks (2.13.0)
18
-
19
- PLATFORMS
20
- ruby
21
-
22
- DEPENDENCIES
23
- rspec
24
- svg_charts!
@@ -1,3 +0,0 @@
1
- module SVGCharts
2
- VERSION = "1.0.3"
3
- end