anychart_xml_builder 0.0.11 → 0.0.12

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.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake'
4
4
  begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
- gem.version = "0.0.11"
7
+ gem.version = "0.0.12"
8
8
  gem.name = "anychart_xml_builder"
9
9
  gem.summary = %Q{AnyChart (http://anychart.com/home/) XML Builders}
10
10
  gem.description = %Q{This gem provides you the methods to easily generate the XML necessary for AnyChart}
@@ -34,7 +34,7 @@ module ActionView #:nodoc:
34
34
  chart_height = opts[:chart_height].kind_of?(String) ? opts[:chart_height] : "#{opts[:chart_height]}px"
35
35
  chart_width = opts[:chart_width].kind_of?(String) ? opts[:chart_width] : "#{opts[:chart_width]}px"
36
36
 
37
- get_flash_player_message = "<script type='text/javascript'>
37
+ get_flash_player_message = "<script type='text/javascript' charset='utf-8'>
38
38
  //<![CDATA[
39
39
  document.write(\"<center>\");
40
40
  document.write(\"Precisa do Adobe Flash Player 9 (ou superior) para visualizar o gráfico.<br /><br />\");
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'nokogiri'
3
3
 
4
- [:legend,:chart_title,:chart_background].each do |section_type|
4
+ [:legend,:chart_title,:chart_background,:axis].each do |section_type|
5
5
  require "xml_sections/#{section_type}"
6
6
  end
7
7
 
@@ -64,7 +64,7 @@ module Anychart
64
64
  xml.charts {
65
65
  xml.chart(:plot_type => "CategorizedVertical") {
66
66
  xml.data_plot_settings(:default_series_type => "Bar") {
67
- xml.bar_series(:point_padding => "0.2", :group_padding => "1") {
67
+ xml.bar_series(:point_padding => "0.2", :group_padding => "1", :style => "AquaLight") {
68
68
  if p[:tooltip]
69
69
  xml.tooltip_settings(:enabled => "True") {
70
70
  xml.format p[:tooltip]
@@ -82,21 +82,8 @@ module Anychart
82
82
 
83
83
  xml.axes {
84
84
  if p[:chart][:axes].present?
85
- if p[:chart][:axes][:y]
86
- xml.y_axis {
87
- xml.labels {
88
- xml.format p[:chart][:axes][:y]
89
- }
90
- }
91
- end
92
-
93
- if p[:chart][:axes][:x]
94
- xml.y_axis {
95
- xml.labels {
96
- xml.format p[:chart][:axes][:x]
97
- }
98
- }
99
- end
85
+ Anychart::XML.axis(xml,p,:y) # y axis
86
+ Anychart::XML.axis(xml,p,:x) # x axis
100
87
  end
101
88
  }
102
89
  }
@@ -88,35 +88,8 @@ module Anychart
88
88
 
89
89
  xml.axes {
90
90
  if p[:chart][:axes].present?
91
- if p[:chart][:axes][:y].present?
92
- xml.y_axis(:position => "Opposite") {
93
- if p[:chart][:axes][:y][:scale].present?
94
- xml.scale(p[:chart][:axes][:y][:scale])
95
- end
96
- if p[:chart][:axes][:y][:title].present?
97
- xml.title {
98
- xml.text_ p[:chart][:axes][:y][:title]
99
- }
100
- else
101
- xml.title(:enabled => "false")
102
- end
103
- xml.labels(:align => "Inside") {
104
- xml.format p[:chart][:axes][:y][:format] || "{%Value}"
105
- }
106
- }
107
- end
108
-
109
- if p[:chart][:axes][:x]
110
- xml.x_axis {
111
- if p[:chart][:axes][:x][:title].present?
112
- xml.title {
113
- xml.text_ p[:chart][:axes][:x][:title]
114
- }
115
- else
116
- xml.title(:enabled => "false")
117
- end
118
- }
119
- end
91
+ Anychart::XML.axis(xml,p,:y,{ :y_axis_opposite => true }) # y axis
92
+ Anychart::XML.axis(xml,p,:x) # x axis
120
93
  end
121
94
  }
122
95
  }
@@ -0,0 +1,30 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module Anychart
4
+ module XML
5
+ def self.axis(xml,p,y_or_x,opts={})
6
+ y_or_x_method = (y_or_x == :y ? :y_axis : :x_axis)
7
+ y_axis_options = (opts[:y_axis_opposite].present? ? {:position => "Opposite"} : {})
8
+ if p[:chart][:axes][y_or_x].present?
9
+ xml.send(y_or_x_method , y_axis_options) {
10
+ xml.scale(p[:chart][:axes][y_or_x][:scale]) if p[:chart][:axes][y_or_x][:scale].present?
11
+ if p[:chart][:axes][y_or_x][:title].present?
12
+ xml.title { xml.text_ p[:chart][:axes][y_or_x][:title] }
13
+ else
14
+ xml.title(:enabled => "False")
15
+ end
16
+ if p[:chart][:axes][y_or_x][:labels].present?
17
+ label_opts = p[:chart][:axes][y_or_x][:labels].without(:format)
18
+ xml.labels(label_opts) {
19
+ xml.format p[:chart][:axes][y_or_x][:format] || "{%Value}"
20
+ }
21
+ else
22
+ xml.labels(:align => "Inside") {
23
+ xml.format p[:chart][:axes][y_or_x][:format] || "{%Value}"
24
+ }
25
+ end
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -4,9 +4,11 @@ module Anychart
4
4
  module XML
5
5
  def self.chart_title(xml,p,opts={})
6
6
  if p[:chart][:title].present?
7
- xml.title(:enabled => "true", :padding => "10") {
7
+ xml.title(:enabled => "True", :padding => "10") {
8
8
  xml.text_ p[:chart][:title]
9
9
  }
10
+ else
11
+ xml.title(:enabled => "False")
10
12
  end # title
11
13
  end
12
14
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anychart_xml_builder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 11
10
- version: 0.0.11
4
+ prerelease:
5
+ version: 0.0.12
11
6
  platform: ruby
12
7
  authors:
13
8
  - jduarte
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-02-26 00:00:00 +00:00
13
+ date: 2011-03-04 00:00:00 +00:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -40,11 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 5
44
- segments:
45
- - 1
46
- - 4
47
- - 1
48
35
  version: 1.4.1
49
36
  type: :runtime
50
37
  version_requirements: *id002
@@ -59,7 +46,6 @@ extra_rdoc_files:
59
46
  - README.rdoc
60
47
  files:
61
48
  - .document
62
- - .gitignore
63
49
  - .project
64
50
  - HELP_COMMIT
65
51
  - LICENSE
@@ -72,6 +58,7 @@ files:
72
58
  - lib/init.rb
73
59
  - lib/line_bar.rb
74
60
  - lib/pie.rb
61
+ - lib/xml_sections/axis.rb
75
62
  - lib/xml_sections/chart_background.rb
76
63
  - lib/xml_sections/chart_title.rb
77
64
  - lib/xml_sections/legend.rb
@@ -84,8 +71,8 @@ homepage: http://github.com/jduarte/anychart_xml_builder
84
71
  licenses: []
85
72
 
86
73
  post_install_message:
87
- rdoc_options:
88
- - --charset=UTF-8
74
+ rdoc_options: []
75
+
89
76
  require_paths:
90
77
  - lib
91
78
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -93,23 +80,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
80
  requirements:
94
81
  - - ">="
95
82
  - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
83
  version: "0"
100
84
  required_rubygems_version: !ruby/object:Gem::Requirement
101
85
  none: false
102
86
  requirements:
103
87
  - - ">="
104
88
  - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
89
  version: "0"
109
90
  requirements: []
110
91
 
111
92
  rubyforge_project:
112
- rubygems_version: 1.3.7
93
+ rubygems_version: 1.5.2
113
94
  signing_key:
114
95
  specification_version: 3
115
96
  summary: AnyChart (http://anychart.com/home/) XML Builders
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC