lazy_high_charts 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +8 -2
- data/GEM_VERSION +1 -1
- data/Gemfile +4 -3
- data/Guardfile +9 -0
- data/README.md +16 -129
- data/lazy_high_charts.gemspec +4 -4
- data/lib/lazy_high_charts/layout_helper.rb +7 -15
- data/spec/spec_helper.rb +2 -22
- metadata +10 -17
- data/autotest/discover.rb +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTkyMmE1YzZmYTg3ZWU3ZDdhNzI2ZjdjNDZlYjYzMjM1YTRhODc4Yg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MzAxYjA5OTVlMWQ5ZGNmZjZiM2E3MjkzODAwMTk2YjU2MDkwMTA2OQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzBlYmJhMmM5MTU5ZTIyOWJjMDYzY2IxYzcwYjI5ODE1MDYzYmYyYTdlMTdi
|
10
|
+
NjU3OTVjMmE2ZTkzOWQwNDEwN2E0MjMxMzgwMzIxZjAyNjA2MWNhZjZjNmNj
|
11
|
+
ZTA5YzkwOTIzZDE4NWExNzk5NzIzNTQzNzkyNTVkNTM1YTg0NGM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTZkOWIxZGJiZjVkMGYxNDNjMWNjZTQxM2Q2MDRhYzRlMzAwMzgxNGJmZDgx
|
14
|
+
Y2VhNmFhMTIwMTBhNWEyOGMyMGNhYjllZTcxYjA3ODRkZDdjZmFiMDg0YzIy
|
15
|
+
MzczNzEwZTBkMzc5MmQzNzAyYmEzMDYxYzkyNTM1MzcwYzE2ZTA=
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# VERSION 1.4.0
|
2
|
+
* Sun Feb 24, 2013
|
3
|
+
1. replace autotest with guard-spec
|
4
|
+
2. support rubygem 2.0
|
5
|
+
3. Fix Turbolinks support and eliminate jQuery dependency by reed
|
6
|
+
|
1
7
|
# VERSION 1.3.3
|
2
8
|
* Fri Jan 18, 2013
|
3
9
|
1. rails 4 feature turbolinks supported.
|
@@ -62,8 +68,8 @@
|
|
62
68
|
Nov 30,2010
|
63
69
|
* dumped to gem 0.0.1
|
64
70
|
|
65
|
-
Sep 13,2010
|
66
|
-
* truely support rails 3.0(returning is deprecate function,use tap) deshi(xiaods@gmail.com)
|
71
|
+
Sep 13,2010
|
72
|
+
* truely support rails 3.0(returning is deprecate function,use tap) deshi(xiaods@gmail.com)
|
67
73
|
|
68
74
|
Sep 14,2010
|
69
75
|
* update codebase to support rails3.0 and rspec2
|
data/GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in lazy_high_charts.gemspec
|
4
4
|
gemspec
|
@@ -6,6 +6,7 @@ gemspec
|
|
6
6
|
group :test, :development do # This causes the plugins to NOT load
|
7
7
|
gem 'webrat','~> 0.7'
|
8
8
|
gem 'rspec', '~> 2.0'
|
9
|
-
gem 'rails'
|
10
|
-
gem '
|
9
|
+
gem 'rails', '>= 3.2'
|
10
|
+
gem 'guard-rspec'
|
11
|
+
gem 'rb-fsevent', '~> 0.9.1'
|
11
12
|
end
|
data/Guardfile
ADDED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# LazyHighCharts
|
2
2
|
|
3
3
|
Easily displaying Highcharts graphs with gem style.
|
4
|
-
[![Build Status](https://secure.travis-ci.org/
|
4
|
+
[![Build Status](https://secure.travis-ci.org/xiaods/lazy_high_charts.png)](http://travis-ci.org/xiaods/lazy_high_charts)
|
5
5
|
|
6
6
|
## Notice
|
7
7
|
Current
|
@@ -11,142 +11,31 @@ Current
|
|
11
11
|
## Installation
|
12
12
|
|
13
13
|
### Installing it by rubygems
|
14
|
-
To install it, you just need to add it to your Gemfile:
|
15
|
-
gem 'lazy_high_charts'
|
16
|
-
|
17
|
-
You do not need to run this unless you are using the older rails versions 3.0 or 3.1:
|
18
|
-
rails g lazy_high_charts:install
|
19
|
-
|
20
|
-
### Installing it as a plugin for rails 2.3.x
|
21
|
-
|
22
|
-
script/plugin install git://github.com/michelson/lazy_high_charts.git ##(for rails 2)
|
23
|
-
|
24
|
-
rails plugin install git://github.com/michelson/lazy_high_charts.git ##(for rails 3)
|
25
|
-
|
26
|
-
### HighStocks
|
27
|
-
LazyHighCharts now compatible with beta HighStock, http://www.highcharts.com/stock/demo/
|
28
|
-
|
29
|
-
## Usage
|
30
|
-
|
31
|
-
About javascript Assets notes:
|
32
|
-
|
33
|
-
### For Rails 3.2.x
|
34
|
-
1. add your highcart js to app/assets/javascripts/application.js
|
35
|
-
````
|
36
|
-
//= require highcharts
|
37
|
-
````
|
38
|
-
|
39
|
-
### For Rails 2.x/3.0.x
|
40
|
-
|
41
|
-
1. you need manually put jquery/highcharts js to public/javascript
|
42
|
-
2. modify your layout html
|
43
|
-
Sample Code:
|
44
|
-
````
|
45
|
-
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" %>
|
46
|
-
<%= javascript_include_tag :highcharts %>
|
47
|
-
````
|
48
|
-
|
49
|
-
3. add gem name in your config/environment.rb
|
50
|
-
````
|
51
|
-
config.gem "lazy_high_charts"
|
52
|
-
````
|
53
|
-
4. Done!
|
54
|
-
|
55
|
-
### Demo Usage in Controller:
|
56
|
-
````
|
57
|
-
@h = LazyHighCharts::HighChart.new('graph') do |f|
|
58
|
-
f.options[:chart][:defaultSeriesType] = "area"
|
59
|
-
f.series(:name=>'John', :data=>[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9])
|
60
|
-
f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9] )
|
61
|
-
end
|
62
|
-
````
|
63
14
|
|
64
|
-
|
65
|
-
|
66
|
-
````
|
67
|
-
@h = LazyHighCharts::HighChart.new('graph') do |f|
|
68
|
-
#.....
|
69
|
-
f.options[:chart][:defaultSeriesType] = "area"
|
70
|
-
f.options[:chart][:inverted] = true
|
71
|
-
f.options[:legend][:layout] = "horizontal"
|
72
|
-
f.options[:xAxis][:categories] = ["uno" ,"dos" , "tres" , "cuatro"]
|
73
|
-
#......
|
74
|
-
````
|
75
|
-
|
76
|
-
Overriding entire option:
|
15
|
+
To install it, you just need to add it to your Gemfile:
|
77
16
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
f.xAxis(:categories => @days.reverse! , :labels=>{:rotation=>-45 , :align => 'right'})
|
82
|
-
f.chart({:defaultSeriesType=>"spline" , :renderTo => "myRenderArea" , :inverted => true})
|
83
|
-
#.....
|
84
|
-
````
|
17
|
+
```ruby
|
18
|
+
gem 'lazy_high_charts'
|
19
|
+
```
|
85
20
|
|
86
|
-
|
21
|
+
then run
|
87
22
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
f.xAxis!(:categories => @days.reverse! , :labels=>{:rotation=>-45 , :align => 'right'})
|
92
|
-
f.chart!({:defaultSeriesType=>"spline" , :renderTo => "myRenderArea" , :inverted => true})
|
93
|
-
#.....
|
94
|
-
````
|
23
|
+
```bash
|
24
|
+
bundle install
|
25
|
+
```
|
95
26
|
|
96
|
-
|
27
|
+
to install it.
|
97
28
|
|
98
|
-
|
99
|
-
@h = LazyHighCharts::HighChart.new('graph', style: '') do |f|
|
100
|
-
f.options[:chart][:defaultSeriesType] = "area"
|
101
|
-
f.options[:plotOptions] = {areaspline: {pointInterval: 1.day, pointStart: 10.days.ago}}
|
102
|
-
f.series(:name=>'John', :data=>[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9])
|
103
|
-
f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9])
|
104
|
-
f.xAxis(type: :datetime)
|
105
|
-
end
|
106
|
-
````
|
107
|
-
A datetime axis [example](http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/xaxis/type-datetime/)
|
29
|
+
### Installing it as a plugin for rails 2.3.x or 3.0.x or 3.1.x
|
108
30
|
|
31
|
+
Deprecated: version should be less than 1.3.3
|
109
32
|
|
110
|
-
|
111
|
-
````
|
112
|
-
<%= javascript_include_tag :highcharts %>
|
113
|
-
````
|
33
|
+
script/plugin install git://github.com/michelson/lazy_high_charts.git ##(for rails 2)
|
114
34
|
|
115
|
-
|
116
|
-
````
|
117
|
-
<%= high_chart("my_id", @h) %>
|
118
|
-
````
|
35
|
+
rails plugin install git://github.com/michelson/lazy_high_charts.git ##(for rails 3)
|
119
36
|
|
120
|
-
You can pass in additional javascript into to the view with a block, this will be executed before the high chart is called
|
121
37
|
|
122
|
-
|
123
|
-
<%= high_chart("my_id", @h) do |c| %>
|
124
|
-
alert('hello')
|
125
|
-
<%end %>
|
126
|
-
````
|
127
|
-
To include javascript function calls or callbacks you can use the js_code method on your string`"function".js_code`:
|
128
|
-
|
129
|
-
````
|
130
|
-
f.options[:plotOptions] = {
|
131
|
-
:column => { :events => { :click => %|function() { window.location = "http://www.highcharts.com" }|.js_code } }
|
132
|
-
}
|
133
|
-
````
|
134
|
-
|
135
|
-
|
136
|
-
## HighStock Support:
|
137
|
-
|
138
|
-
Just call HighChart Helper this way:
|
139
|
-
````
|
140
|
-
<%= high_stock("my_id", @h) %>
|
141
|
-
````
|
142
|
-
|
143
|
-
## Option reference:
|
144
|
-
|
145
|
-
http://www.highcharts.com/ref/
|
146
|
-
|
147
|
-
## HighCharts License:
|
148
|
-
|
149
|
-
http://www.highcharts.com/license
|
38
|
+
## [Lazy_high_charts User Guide](https://github.com/xiaods/lazy_high_charts/wiki/lazy_high_charts-user-guide)
|
150
39
|
|
151
40
|
|
152
41
|
## Contributing
|
@@ -164,9 +53,7 @@ Contributer List:
|
|
164
53
|
|
165
54
|
Thanks for Troy & David
|
166
55
|
## Maintainers
|
167
|
-
* Miguel Michelson Martinez [github/michelson](https://github.com/michelson)
|
168
56
|
* Deshi Xiao [github/xiaods](https://github.com/xiaods)
|
169
57
|
|
170
58
|
## License
|
171
|
-
* Copyright (c) 2011
|
172
|
-
* Copyright (c) 2010 Miguel Michelson Martinez, released under the MIT license
|
59
|
+
* Copyright (c) 2011 - 2013 Deshi Xiao,released under the MIT license
|
data/lazy_high_charts.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "lazy_high_charts"
|
7
7
|
s.version = version
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['
|
10
|
-
s.email = ['
|
9
|
+
s.authors = ['Deshi Xiao']
|
10
|
+
s.email = ['xiaods@gmail.com']
|
11
11
|
s.homepage = "https://github.com/xiaods/lazy_high_charts"
|
12
12
|
s.summary = "rubyist way to render variant chart by highcharts without write javascript right now, rails gem library."
|
13
13
|
s.description = "lazy_high_charts is leading edge rubyist render charts gem for displaying Highcharts graphs."
|
@@ -15,9 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.extra_rdoc_files = [ "README.md", "CHANGELOG.md" ]
|
16
16
|
s.rdoc_options = [ "--charset=UTF-8" ]
|
17
17
|
|
18
|
-
s.required_rubygems_version = "
|
18
|
+
s.required_rubygems_version = ">= 1.3"
|
19
19
|
|
20
|
-
s.add_dependency "bundler", "
|
20
|
+
s.add_dependency "bundler", ">= 1.0"
|
21
21
|
s.add_dependency "hash-deep-merge"
|
22
22
|
|
23
23
|
s.description = <<-DESC
|
@@ -45,19 +45,11 @@ module LazyHighCharts
|
|
45
45
|
graph =<<-EOJS
|
46
46
|
<script type="text/javascript">
|
47
47
|
(function() {
|
48
|
-
|
48
|
+
var f = function(){
|
49
|
+
document.removeEventListener('page:load', f, true);
|
49
50
|
#{core_js}
|
50
|
-
}
|
51
|
-
|
52
|
-
</script>
|
53
|
-
EOJS
|
54
|
-
elsif defined?(Turbolinks) && request.headers["X-XHR-Referer"]
|
55
|
-
graph =<<-EOJS
|
56
|
-
<script type="text/javascript">
|
57
|
-
(function() {
|
58
|
-
$(window).bind('page:load', function() {
|
59
|
-
#{core_js}
|
60
|
-
});
|
51
|
+
};
|
52
|
+
document.addEventListener('page:load', f, true);
|
61
53
|
})()
|
62
54
|
</script>
|
63
55
|
EOJS
|
@@ -76,13 +68,13 @@ module LazyHighCharts
|
|
76
68
|
end
|
77
69
|
|
78
70
|
if defined?(raw)
|
79
|
-
return raw(graph)
|
71
|
+
return raw(graph)
|
80
72
|
else
|
81
73
|
return graph
|
82
74
|
end
|
83
75
|
|
84
76
|
end
|
85
|
-
|
77
|
+
|
86
78
|
private
|
87
79
|
|
88
80
|
def generate_json_from_hash hash
|
@@ -107,7 +99,7 @@ module LazyHighCharts
|
|
107
99
|
def generate_json_from_array array
|
108
100
|
array.map{|value| generate_json_from_value(value)}.join(",")
|
109
101
|
end
|
110
|
-
|
102
|
+
|
111
103
|
end
|
112
104
|
end
|
113
105
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require 'rubygems'
|
3
|
-
require 'bundler'
|
4
|
-
Bundler.setup
|
3
|
+
require 'bundler/setup'
|
5
4
|
|
6
5
|
require 'active_support'
|
7
6
|
require 'action_pack'
|
8
7
|
require 'action_view'
|
9
8
|
require 'action_controller'
|
10
|
-
require 'rails'
|
11
|
-
#require 'action_mailer'
|
12
9
|
require "active_support/core_ext"
|
13
10
|
|
14
11
|
|
@@ -19,24 +16,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '../lib/lazy_high_cha
|
|
19
16
|
require 'webrat'
|
20
17
|
require 'rspec'
|
21
18
|
|
22
|
-
|
23
|
-
if defined?(RSpec)
|
24
|
-
RSPEC_NAMESPACE = RSPEC_CONFIGURER = RSpec
|
25
|
-
elsif defined?(Spec)
|
26
|
-
RSPEC_NAMESPACE = Spec
|
27
|
-
RSPEC_CONFIGURER = Spec::Runner
|
28
|
-
else
|
29
|
-
begin
|
30
|
-
require 'rspec'
|
31
|
-
RSPEC_NAMESPACE = RSPEC_CONFIGURER = Rspec
|
32
|
-
rescue LoadError
|
33
|
-
require 'spec'
|
34
|
-
RSPEC_NAMESPACE = Spec
|
35
|
-
RSPEC_CONFIGURER = Spec::Runner
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
RSPEC_CONFIGURER.configure do |config|
|
19
|
+
RSpec.configure do |config|
|
40
20
|
config.include ActionView::Helpers
|
41
21
|
config.include Webrat::Matchers
|
42
22
|
end
|
metadata
CHANGED
@@ -1,37 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazy_high_charts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Miguel Michelson Martinez
|
9
7
|
- Deshi Xiao
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
|
-
date: 2013-
|
11
|
+
date: 2013-03-10 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
13
|
- !ruby/object:Gem::Dependency
|
16
14
|
name: bundler
|
17
15
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
16
|
requirements:
|
20
|
-
- -
|
17
|
+
- - ! '>='
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '1.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
23
|
requirements:
|
28
|
-
- -
|
24
|
+
- - ! '>='
|
29
25
|
- !ruby/object:Gem::Version
|
30
26
|
version: '1.0'
|
31
27
|
- !ruby/object:Gem::Dependency
|
32
28
|
name: hash-deep-merge
|
33
29
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
30
|
requirements:
|
36
31
|
- - ! '>='
|
37
32
|
- !ruby/object:Gem::Version
|
@@ -39,7 +34,6 @@ dependencies:
|
|
39
34
|
type: :runtime
|
40
35
|
prerelease: false
|
41
36
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
37
|
requirements:
|
44
38
|
- - ! '>='
|
45
39
|
- !ruby/object:Gem::Version
|
@@ -49,7 +43,6 @@ description: ! ' lazy_high_charts is leading edge rubyist render charts gem f
|
|
49
43
|
|
50
44
|
'
|
51
45
|
email:
|
52
|
-
- miguelmichelson@gmail.com
|
53
46
|
- xiaods@gmail.com
|
54
47
|
executables: []
|
55
48
|
extensions: []
|
@@ -59,13 +52,14 @@ extra_rdoc_files:
|
|
59
52
|
files:
|
60
53
|
- .gitignore
|
61
54
|
- .rspec
|
55
|
+
- .travis.yml
|
62
56
|
- CHANGELOG.md
|
63
57
|
- GEM_VERSION
|
64
58
|
- Gemfile
|
59
|
+
- Guardfile
|
65
60
|
- MIT-LICENSE
|
66
61
|
- README.md
|
67
62
|
- Rakefile
|
68
|
-
- autotest/discover.rb
|
69
63
|
- lazy_high_charts.gemspec
|
70
64
|
- lib/generators/lazy_high_charts/install/install_generator.rb
|
71
65
|
- lib/lazy_high_charts.rb
|
@@ -84,28 +78,27 @@ files:
|
|
84
78
|
- vendor/assets/javascripts/highstock.js
|
85
79
|
homepage: https://github.com/xiaods/lazy_high_charts
|
86
80
|
licenses: []
|
81
|
+
metadata: {}
|
87
82
|
post_install_message:
|
88
83
|
rdoc_options:
|
89
84
|
- --charset=UTF-8
|
90
85
|
require_paths:
|
91
86
|
- lib
|
92
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
88
|
requirements:
|
95
89
|
- - ! '>='
|
96
90
|
- !ruby/object:Gem::Version
|
97
91
|
version: '0'
|
98
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
93
|
requirements:
|
101
|
-
- -
|
94
|
+
- - ! '>='
|
102
95
|
- !ruby/object:Gem::Version
|
103
96
|
version: '1.3'
|
104
97
|
requirements: []
|
105
98
|
rubyforge_project:
|
106
|
-
rubygems_version:
|
99
|
+
rubygems_version: 2.0.2
|
107
100
|
signing_key:
|
108
|
-
specification_version:
|
101
|
+
specification_version: 4
|
109
102
|
summary: rubyist way to render variant chart by highcharts without write javascript
|
110
103
|
right now, rails gem library.
|
111
104
|
test_files: []
|
data/autotest/discover.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Autotest.add_discovery { "rspec2" }
|