rails_highcharts 0.0.1.beta3 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -19,14 +19,14 @@ Rails3.0.8+/Ruby1.8.7+
|
|
19
19
|
|
20
20
|
Usage in Controller:
|
21
21
|
|
22
|
-
@h =
|
22
|
+
@h = HighChart.new('graph') do |f|
|
23
23
|
f.series(:name=>'John', :data=>[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9])
|
24
24
|
f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9] )
|
25
25
|
end
|
26
26
|
|
27
27
|
Without overriding entire option , (only change a specific option index):
|
28
28
|
|
29
|
-
@h =
|
29
|
+
@h = HighChart.new('graph') do |f|
|
30
30
|
.....
|
31
31
|
f.options[:chart][:defaultSeriesType] = "area"
|
32
32
|
f.options[:chart][:inverted] = true
|
@@ -36,7 +36,7 @@ Without overriding entire option , (only change a specific option index):
|
|
36
36
|
|
37
37
|
Overriding entire option:
|
38
38
|
|
39
|
-
@h =
|
39
|
+
@h = HighChart.new('graph') do |f|
|
40
40
|
.....
|
41
41
|
f.x_axis(:categories => @days.reverse! , :labels=>{:rotation=>-45 , :align => 'right'})
|
42
42
|
f.chart({:defaultSeriesType=>"spline" , :renderTo => "myRenderArea" , :inverted => true})
|
@@ -8,19 +8,19 @@ describe RailsHighchartsHelper do
|
|
8
8
|
before(:each) do
|
9
9
|
@class = "stylin"
|
10
10
|
@placeholder = "placeholder"
|
11
|
-
@chart =
|
11
|
+
@chart = HighChart.new(@placeholder)
|
12
12
|
@data = "data"
|
13
13
|
@options = "options"
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "high_chart_helper" do
|
17
17
|
it "should return a div with an id of high_chart object" do
|
18
|
-
hc =
|
18
|
+
hc = HighChart.new("placeholder", :class => 'stylin')
|
19
19
|
high_chart(hc.placeholder, hc).should have_selector('div', :id => hc.placeholder, :class => 'stylin')
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return a script" do
|
23
|
-
hc =
|
23
|
+
hc = HighChart.new("placeholder")
|
24
24
|
high_chart(hc.placeholder, hc).should have_selector('script')
|
25
25
|
end
|
26
26
|
end
|
@@ -12,7 +12,7 @@ describe "HighChart" do
|
|
12
12
|
@html_options = {:class => "stylin"}
|
13
13
|
@options = {:bars => {:show => true}}
|
14
14
|
|
15
|
-
@flot =
|
15
|
+
@flot = HighChart.new(@placeholder, @html_options) {|chart| chart.options = @options }
|
16
16
|
end
|
17
17
|
|
18
18
|
|
@@ -20,16 +20,16 @@ describe "HighChart" do
|
|
20
20
|
# this is almost all flotomatic stuff
|
21
21
|
describe "initialization" do
|
22
22
|
it "should take an optional 'placeholder' argument" do
|
23
|
-
|
24
|
-
|
23
|
+
HighChart.new(@placeholder).placeholder.should == @placeholder
|
24
|
+
HighChart.new.placeholder.should == nil
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should take an optional html_options argument (defaulting to 300px height)" do
|
28
|
-
|
28
|
+
HighChart.new(@html_options).placeholder.should == @html_options
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should set options by default" do
|
32
|
-
|
32
|
+
HighChart.new.options.should == {
|
33
33
|
:subtitle=>{},
|
34
34
|
:chart=>{:renderTo=>nil, :defaultSeriesType=>"areaspline"},
|
35
35
|
:plot_options=>{:areaspline=>{:fillOpacity=>0.5}},
|
@@ -54,22 +54,22 @@ describe "HighChart" do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should set data empty by default" do
|
57
|
-
|
57
|
+
HighChart.new.data.should == []
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should take a block setting attributes" do
|
61
|
-
chart =
|
61
|
+
chart = HighChart.new {|f| f.data = @data ; f.options = @options }
|
62
62
|
chart.data.should == @data
|
63
63
|
chart.options.should == @options
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should take a block setting attributes" do
|
67
|
-
chart =
|
67
|
+
chart = HighChart.new {|f| f.options[:legend][:layout] = "horizontal" }
|
68
68
|
chart.options[:legend][:layout].should == "horizontal"
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should change a block data without overriding options" do
|
72
|
-
chart =
|
72
|
+
chart = HighChart.new('graph') do |f|
|
73
73
|
f.series(:name=>'John', :data=>[3, 20])
|
74
74
|
f.series(:name=>'Jane',:data=> [1, 3] )
|
75
75
|
# without overriding
|
@@ -86,7 +86,7 @@ describe "HighChart" do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should change a block data with overriding entire options" do
|
89
|
-
chart =
|
89
|
+
chart = HighChart.new('graph') do |f|
|
90
90
|
f.series(:name=>'John', :data=>[3, 20])
|
91
91
|
f.series(:name=>'Jane', :data=>[1, 3] )
|
92
92
|
f.title({ :text=>"example test title from controller"})
|
@@ -103,7 +103,7 @@ describe "HighChart" do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should have subtitles" do
|
106
|
-
chart =
|
106
|
+
chart = HighChart.new('graph') do |f|
|
107
107
|
f.series(:name=>'John',:data=> [3, 20])
|
108
108
|
f.series(:name=>'Jane', :data=>[1, 3] )
|
109
109
|
f.title({ :text=>"example test title from controller"})
|
data/spec/spec_helper.rb
CHANGED
@@ -8,7 +8,7 @@ require 'action_controller'
|
|
8
8
|
require 'action_mailer'
|
9
9
|
|
10
10
|
require File.dirname(__FILE__) + "/../app/helpers/rails_highcharts/rails_highcharts_helper"
|
11
|
-
require File.dirname(__FILE__) + "/../app/models/
|
11
|
+
require File.dirname(__FILE__) + "/../app/models/high_chart"
|
12
12
|
|
13
13
|
require 'webrat'
|
14
14
|
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_highcharts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 1
|
10
|
-
|
11
|
-
- 3
|
12
|
-
version: 0.0.1.beta3
|
10
|
+
version: 0.0.1
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- AlexZhang
|
@@ -94,7 +92,7 @@ files:
|
|
94
92
|
- Rakefile
|
95
93
|
- README.md
|
96
94
|
- app/helpers/rails_highcharts/rails_highcharts_helper.rb
|
97
|
-
- app/models/
|
95
|
+
- app/models/high_chart.rb
|
98
96
|
- lib/generators/rails_highcharts/install_generator.rb
|
99
97
|
- lib/generators/rails_highcharts/media/javascripts/excanvas.compiled.js
|
100
98
|
- lib/generators/rails_highcharts/media/javascripts/highcharts.js
|
@@ -126,14 +124,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
125
|
none: false
|
128
126
|
requirements:
|
129
|
-
- - "
|
127
|
+
- - ">="
|
130
128
|
- !ruby/object:Gem::Version
|
131
|
-
hash:
|
129
|
+
hash: 3
|
132
130
|
segments:
|
133
|
-
-
|
134
|
-
|
135
|
-
- 1
|
136
|
-
version: 1.3.1
|
131
|
+
- 0
|
132
|
+
version: "0"
|
137
133
|
requirements: []
|
138
134
|
|
139
135
|
rubyforge_project: rails_highcharts
|