google_visualr 2.1.8 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +143 -0
- data/lib/google_visualr/version.rb +1 -1
- metadata +5 -4
- data/README.rdoc +0 -143
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdeb2c496a711317a315455953579c86bdfe2fd7
|
4
|
+
data.tar.gz: dd0d015e0ddab7360cb95512a818ad69d36f282d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d7ae125c8a8fdb2bfebbdbff75a4099d7f9966834eaad8b97176f6192b8f6f69dd428333ec61b70a5ff3ee23e7233a01e72ebde0c642e272a0a0d9dc029641
|
7
|
+
data.tar.gz: c731f811d48ad402c4402366fd2077f2220750ccbebe1784870244e5c6068a706d3b7023023f7c3739283625ce572d244f4b01eae6dfc5854aab3c02f539cb10
|
data/README.markdown
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
# GoogleVisualr
|
2
|
+
|
3
|
+
[<img src="https://secure.travis-ci.org/winston/google_visualr.png?branch=master" alt="Build Status" />](http://travis-ci.org/winston/google_visualr)
|
4
|
+
|
5
|
+
GoogleVisualr, is a wrapper around the [Google Chart Tools](http://code.google.com/apis/chart/interactive/docs/index.html) that allows anyone to create beautiful charts with just plain Ruby. You don't have to write any JavaScript at all.
|
6
|
+
|
7
|
+
It's good for any Ruby (Rails/Sinatra) setup, and you can handle the entire charting logic in Ruby.
|
8
|
+
|
9
|
+
Please refer to the [GoogleVisualr API Reference site](http://googlevisualr.heroku.com/) for a complete list of Google charts that you can create with GoogleVisualr.
|
10
|
+
|
11
|
+
## tl:dr
|
12
|
+
|
13
|
+
* In your model or controller, write Ruby code to create your chart (e.g. Area Chart, Bar Chart etc).
|
14
|
+
* Configure your chart with any of the options as listed in Google's API Docs. E.g. [Area Chart](http://code.google.com/apis/chart/interactive/docs/gallery/areachart.html#Configuration_Options).
|
15
|
+
* In your view, call `chart.to_js(div_id)` and that will insert JavaScript into the final HTML output.
|
16
|
+
* You get your awesome Google chart, and you didn't write any JavaScript!
|
17
|
+
|
18
|
+
## Limitations
|
19
|
+
|
20
|
+
GoogleVisualr is created solely for the aim of simplifying the display of a chart, and not the interactions.
|
21
|
+
|
22
|
+
Hence, do note that GoogleVisualr is not a 100% complete wrapper for Google Chart Tools.
|
23
|
+
|
24
|
+
E.g., Methods and Events as described in Google's API Docs - for use after a chart has been rendered, are not implemented because they feel more natural being written as JavaScript functions, within the views or .js files.
|
25
|
+
|
26
|
+
## Install
|
27
|
+
|
28
|
+
Assuming you are on Rails 3, include the gem in your Gemfile.
|
29
|
+
|
30
|
+
gem "google_visualr", ">= 2.1"
|
31
|
+
|
32
|
+
## Basics
|
33
|
+
|
34
|
+
This is a basic implementation of the GoogleVisualr::DataTable and GoogleVisualr::AreaChart classes.
|
35
|
+
|
36
|
+
For detailed documentation and advanced implementations, please refer to the [GoogleVisualr API Reference](http://googlevisualr.heroku.com/) or read the source.
|
37
|
+
|
38
|
+
---
|
39
|
+
|
40
|
+
In your Rails layout, load Google Ajax API in the head tag, at the very top.
|
41
|
+
|
42
|
+
<script src='https://www.google.com/jsapi'></script>
|
43
|
+
|
44
|
+
In your Rails controller, initialize a GoogleVisualr::DataTable object with an empty constructor.
|
45
|
+
|
46
|
+
data_table = GoogleVisualr::DataTable.new
|
47
|
+
|
48
|
+
Populate data_table with column headers, and row values.
|
49
|
+
|
50
|
+
# Add Column Headers
|
51
|
+
data_table.new_column('string', 'Year' )
|
52
|
+
data_table.new_column('number', 'Sales')
|
53
|
+
data_table.new_column('number', 'Expenses')
|
54
|
+
|
55
|
+
# Add Rows and Values
|
56
|
+
data_table.add_rows([
|
57
|
+
['2004', 1000, 400],
|
58
|
+
['2005', 1170, 460],
|
59
|
+
['2006', 660, 1120],
|
60
|
+
['2007', 1030, 540]
|
61
|
+
])
|
62
|
+
|
63
|
+
Create a GoogleVisualr::AreaChart with data_table and configuration options.
|
64
|
+
|
65
|
+
option = { width: 400, height: 240, title: 'Company Performance' }
|
66
|
+
@chart = GoogleVisualr::Interactive::AreaChart.new(data_table, option)
|
67
|
+
|
68
|
+
In your Rails view, render the Google chart.
|
69
|
+
|
70
|
+
<div id='chart'></div>
|
71
|
+
<%= render_chart(@chart, 'chart') %>
|
72
|
+
|
73
|
+
## Listeners
|
74
|
+
|
75
|
+
For an example usage of `listeners`, please refer to [this comment](https://github.com/winston/google_visualr/issues/36#issuecomment-9880256).
|
76
|
+
|
77
|
+
Besides `listeners` you can now also redraw charts in your JavaScript maunally by calling `draw_<element id>()` function. See [this commit](https://github.com/winston/google_visualr/commit/e5554886bd83f56dd31bbc543fdcf1e24523776a) for more details.
|
78
|
+
|
79
|
+
## Support
|
80
|
+
|
81
|
+
Please submit all feedback, bugs and feature-requests to [GitHub Issues Tracker](http://github.com/winston/google_visualr/issues).
|
82
|
+
|
83
|
+
Feel free to fork the project, make improvements or bug fixes and submit pull requests (with tests!).
|
84
|
+
|
85
|
+
## Who's Using GoogleVisualr?
|
86
|
+
|
87
|
+
I would like to collect some data about who's using this Gem. [Please drop me a line](mailto:winstonyw+googlevisualr@gmail.com).
|
88
|
+
|
89
|
+
## Change Log
|
90
|
+
|
91
|
+
<em>Version 2.1.8</em>
|
92
|
+
|
93
|
+
* [Issue 61](https://github.com/winston/google_visualr/issues/45) Add MIT license to gemspec.
|
94
|
+
|
95
|
+
<em>Version 2.1.8</em>
|
96
|
+
|
97
|
+
* [Issue 45](https://github.com/winston/google_visualr/issues/45) Support for redrawing chart from JS.
|
98
|
+
|
99
|
+
<em>Version 2.1.7</em>
|
100
|
+
|
101
|
+
* [Issue 56](https://github.com/winston/google_visualr/issues/56) Typecast to proper JSON strings.
|
102
|
+
|
103
|
+
<em>Version 2.1.6</em>
|
104
|
+
|
105
|
+
* [Issue 54](https://github.com/winston/google_visualr/issues/54) Allow apostrophes in labels.
|
106
|
+
* [Pull Request 55](https://github.com/winston/google_visualr/pull/55) Added support to accept BigDecimal as number.
|
107
|
+
|
108
|
+
<em>Version 2.1.5</em>
|
109
|
+
|
110
|
+
* [Pull Request 48](https://github.com/winston/google_visualr/pull/48) Fixed bug with Listener event registration.
|
111
|
+
|
112
|
+
<em>Version 2.1.4</em>
|
113
|
+
|
114
|
+
* [Pull Request 39](https://github.com/winston/google_visualr/pull/39) Added ability to use Listeners.
|
115
|
+
* [Pull Request 40](https://github.com/winston/google_visualr/pull/40) Allowed decoupling of class name and chart name.
|
116
|
+
|
117
|
+
<em>Version 2.1.3</em>
|
118
|
+
|
119
|
+
* Added support for Bubble Chart.
|
120
|
+
* [Pull Request 37](https://github.com/winston/google_visualr/pull/37) Added support for Stepped Area Chart.
|
121
|
+
|
122
|
+
<em>Version 2.1.2</em>
|
123
|
+
|
124
|
+
* [Pull Request 28](https://github.com/winston/google_visualr/pull/28) Removed InstanceMethods as it's deprecated in Rails 3.2.x.
|
125
|
+
* [Pull Request 26](https://github.com/winston/google_visualr/pull/26) Added 3 more image charts and #uri method to all image charts.
|
126
|
+
|
127
|
+
<em>Version 2.1.1</em>
|
128
|
+
|
129
|
+
* Added support for `role` and `pattern` attributes in `#new_column` and `#new_columns` methods.
|
130
|
+
|
131
|
+
<em>Version 2.1.0</em>
|
132
|
+
|
133
|
+
* Added `#render_chart` as a helper method in Rails views.
|
134
|
+
|
135
|
+
## Author
|
136
|
+
|
137
|
+
GoogleVisualr is maintained by [Winston Teo](mailto:winstonyw+googlevisualr@gmail.com).
|
138
|
+
|
139
|
+
Who is Winston Teo? [You should follow Winston on Twitter](http://www.twitter.com/winstonyw), or find out more on [WinstonYW](http://www.winstonyw.com) and [LinkedIn](http://sg.linkedin.com/in/winstonyw).
|
140
|
+
|
141
|
+
## License
|
142
|
+
|
143
|
+
Copyright © 2012 Winston Teo Yong Wei. Free software, released under the MIT license.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_visualr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winston Teo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,7 +96,7 @@ files:
|
|
96
96
|
- lib/google_visualr.rb
|
97
97
|
- MIT-LICENSE
|
98
98
|
- Rakefile
|
99
|
-
- README.
|
99
|
+
- README.markdown
|
100
100
|
- spec/dummy/app/controllers/application_controller.rb
|
101
101
|
- spec/dummy/app/helpers/application_helper.rb
|
102
102
|
- spec/dummy/app/views/layouts/application.html.erb
|
@@ -149,7 +149,8 @@ files:
|
|
149
149
|
- spec/spec_helper.rb
|
150
150
|
- spec/support/common.rb
|
151
151
|
homepage: https://github.com/winston/google_visualr
|
152
|
-
licenses:
|
152
|
+
licenses:
|
153
|
+
- MIT
|
153
154
|
metadata: {}
|
154
155
|
post_install_message:
|
155
156
|
rdoc_options: []
|
data/README.rdoc
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
= GoogleVisualr
|
2
|
-
|
3
|
-
{<img src="https://secure.travis-ci.org/winston/google_visualr.png?branch=master" alt="Build Status" />}[http://travis-ci.org/winston/google_visualr]
|
4
|
-
|
5
|
-
This Ruby gem, GoogleVisualr, is a wrapper around the {Google Chart Tools}[http://code.google.com/apis/chart/interactive/docs/index.html] that allows anyone to create the same beautiful charts with just plain Ruby.
|
6
|
-
|
7
|
-
You don't have to write any JavaScript at all!
|
8
|
-
|
9
|
-
Good for any Ruby on Rails setup whereby you prefer to work your logic in models or controllers.
|
10
|
-
|
11
|
-
Please refer to the {GoogleVisualr API Reference site}[http://googlevisualr.heroku.com/] for a complete list of Google charts that you can create with GoogleVisualr.
|
12
|
-
|
13
|
-
== tl:dr
|
14
|
-
|
15
|
-
* In your model or controller, write Ruby code to create your chart (e.g. Area Chart, Bar Chart, even Spark Lines etc).
|
16
|
-
* Configure your chart with any of the options as listed in Google Chart Tools' API Docs. E.g. {Area Chart's Configuration Options}[http://code.google.com/apis/chart/interactive/docs/gallery/areachart.html#Configuration_Options].
|
17
|
-
* In your view, invoke a <em>chart.to_js(div_id)</em> method and that will magically generate and insert JavaScript into the final HTML output.
|
18
|
-
* You get your awesome Google chart, and you didn't write any JavaScript!
|
19
|
-
|
20
|
-
== Limitations
|
21
|
-
|
22
|
-
GoogleVisualr is created solely for the aim of simplifying the display of a chart, and not the interactions.
|
23
|
-
|
24
|
-
Hence, do note that GoogleVisualr is not a 100% complete wrapper for Google Chart Tools.
|
25
|
-
|
26
|
-
For example, Methods and Events as described in Google Chart Tools' API Docs - for use after a chart has been rendered, are not implemented because they feel more natural being written as JavaScript functions, within views or .js files.
|
27
|
-
|
28
|
-
== Install
|
29
|
-
|
30
|
-
Assuming you are on Rails 3, include the gem in your Gemfile.
|
31
|
-
|
32
|
-
gem "google_visualr", ">= 2.1"
|
33
|
-
|
34
|
-
== Basics
|
35
|
-
|
36
|
-
This section describes a basic implementation of the GoogleVisualr::DataTable and GoogleVisualr::AreaChart classes.
|
37
|
-
|
38
|
-
For detailed documentation and advanced implementations, please refer to the {GoogleVisualr API Reference site}[http://googlevisualr.heroku.com/] or read the source.
|
39
|
-
|
40
|
-
---
|
41
|
-
|
42
|
-
In your Rails layout, load Google Ajax API in the head tag, at the very top.
|
43
|
-
|
44
|
-
<script src='https://www.google.com/jsapi'></script>
|
45
|
-
|
46
|
-
In your Rails controller, initialize a GoogleVisualr::DataTable object with an empty constructor.
|
47
|
-
|
48
|
-
data_table = GoogleVisualr::DataTable.new
|
49
|
-
|
50
|
-
Populate data_table with column headers, and row values.
|
51
|
-
|
52
|
-
# Add Column Headers
|
53
|
-
data_table.new_column('string', 'Year' )
|
54
|
-
data_table.new_column('number', 'Sales')
|
55
|
-
data_table.new_column('number', 'Expenses')
|
56
|
-
|
57
|
-
# Add Rows and Values
|
58
|
-
data_table.add_rows([
|
59
|
-
['2004', 1000, 400],
|
60
|
-
['2005', 1170, 460],
|
61
|
-
['2006', 660, 1120],
|
62
|
-
['2007', 1030, 540]
|
63
|
-
])
|
64
|
-
|
65
|
-
Create a GoogleVisualr::AreaChart with data_table and configuration options.
|
66
|
-
|
67
|
-
option = { width: 400, height: 240, title: 'Company Performance' }
|
68
|
-
@chart = GoogleVisualr::Interactive::AreaChart.new(data_table, option)
|
69
|
-
|
70
|
-
In your Rails view, render the Google chart.
|
71
|
-
|
72
|
-
<div id='chart'></div>
|
73
|
-
<%= render_chart(@chart, 'chart') %>
|
74
|
-
|
75
|
-
== Support
|
76
|
-
|
77
|
-
Please submit all feedback, bugs and feature-requests to {GitHub Issues Tracker}[http://github.com/winston/google_visualr/issues].
|
78
|
-
|
79
|
-
Feel free to fork the project, make improvements or bug fixes and submit pull requests (with tests!).
|
80
|
-
|
81
|
-
== Who's Using GoogleVisualr?
|
82
|
-
|
83
|
-
I would like to collect some data about who's using this Gem. {Please drop me a line}[mailto:winstonyw+googlevisualr@gmail.com] and I may put up the link here.
|
84
|
-
|
85
|
-
== Change Log
|
86
|
-
|
87
|
-
<em>Version 2.1.8</em>
|
88
|
-
* {Issue 45}[https://github.com/winston/google_visualr/issues/45] Support for redrawing chart from JS.
|
89
|
-
|
90
|
-
|
91
|
-
<em>Version 2.1.7</em>
|
92
|
-
* {Issue 56}[https://github.com/winston/google_visualr/issues/56] Typecast to proper JSON strings.
|
93
|
-
|
94
|
-
<em>Version 2.1.6</em>
|
95
|
-
* {Issue 54}[https://github.com/winston/google_visualr/issues/54] Allow apostrophes in labels.
|
96
|
-
* {Pull Request 55}[https://github.com/winston/google_visualr/pull/55] Added support to accept BigDecimal as number.
|
97
|
-
|
98
|
-
<em>Version 2.1.5</em>
|
99
|
-
* {Pull Request 48}[https://github.com/winston/google_visualr/pull/48] Fixed bug with Listener event registration.
|
100
|
-
|
101
|
-
<em>Version 2.1.4</em>
|
102
|
-
* {Pull Request 39}[https://github.com/winston/google_visualr/pull/39] Added ability to use Listeners.
|
103
|
-
* {Pull Request 40}[https://github.com/winston/google_visualr/pull/40] Allowed decoupling of class name and chart name.
|
104
|
-
|
105
|
-
<em>Version 2.1.3</em>
|
106
|
-
* Added support for Bubble Chart.
|
107
|
-
* {Pull Request 37}[https://github.com/winston/google_visualr/pull/37] Added support for Stepped Area Chart.
|
108
|
-
|
109
|
-
<em>Version 2.1.2</em>
|
110
|
-
* {Pull Request 28}[https://github.com/winston/google_visualr/pull/28] Removed InstanceMethods as it's deprecated in Rails 3.2.x.
|
111
|
-
* {Pull Request 26}[https://github.com/winston/google_visualr/pull/26] Added 3 more image charts and #uri method to all image charts.
|
112
|
-
|
113
|
-
<em>Version 2.1.1</em>
|
114
|
-
* Added support for +role+ and +pattern+ attributes in +#new_column+ and +#new_columns+ methods.
|
115
|
-
|
116
|
-
<em>Version 2.1.0</em>
|
117
|
-
* Added +#render_chart+ as a helper method in Rails views.
|
118
|
-
|
119
|
-
== Differences Between Gem and Plugin
|
120
|
-
|
121
|
-
Gem
|
122
|
-
* is Rails 3 compatible.
|
123
|
-
* implements many of the newer versions of Google Charts E.g. Core Charts.
|
124
|
-
* enjoyed a major refactoring, and also now has Tests!
|
125
|
-
|
126
|
-
Plugin
|
127
|
-
* has not been tested for Rails 3 compatibility
|
128
|
-
* implements the older versions of Google Charts.
|
129
|
-
* has deprecated methods.
|
130
|
-
|
131
|
-
This gem, however, is not a drop-in replacement for the plugin, as there are numerous changes in its usage.
|
132
|
-
|
133
|
-
Notably, you will have to interact mostly with GoogleVisualr::DataTable which was absent in the plugin.
|
134
|
-
|
135
|
-
== Author
|
136
|
-
|
137
|
-
GoogleVisualr is maintained by {Winston Teo}[mailto:winstonyw+googlevisualr@gmail.com].
|
138
|
-
|
139
|
-
Who is Winston Teo? {You should follow Winston on Twitter}[http://www.twitter.com/winstonyw], or find out more on {WinstonYW}[http://www.winstonyw.com] and {LinkedIn}[http://sg.linkedin.com/in/winstonyw].
|
140
|
-
|
141
|
-
== License
|
142
|
-
|
143
|
-
Copyright © 2012 Winston Teo Yong Wei. Free software, released under the MIT license.
|