graphgraph 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05a8f08373762d6fce0ec6e5e4f1be6aa712fd04
|
4
|
+
data.tar.gz: 541db12230fafa520f34f6f78cb45cc816e8450a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01b901de9e09aa6564a17c794505aabbd5b855557fb3bf7a9d63f676ebd0820835db7f21258a0ba0367d4be7581fc3623432d80fccd3533d348a1d9fea976688
|
7
|
+
data.tar.gz: 4200b649f303d79b311e744793716bca15713566849ad0c282663597663f67ac29a50d49cd8f36a0637e896432a224ec88e99c39e70dad54e6e197a5d5fb3fa0
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Graphgraph
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/graphgraph`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
5
|
TODO: Delete this and the text above, and describe your gem
|
6
6
|
|
@@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem '
|
12
|
+
gem 'graphgraph'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -18,11 +18,11 @@ And then execute:
|
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
$ gem install
|
21
|
+
$ gem install graphgraph
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
$ rails g graphgraph:install MODEL_NAME
|
26
26
|
|
27
27
|
## Development
|
28
28
|
|
@@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/suhas/graphgraph. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
36
|
|
37
37
|
|
38
38
|
## License
|
data/graphgraph.gemspec
CHANGED
@@ -16,11 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
18
|
# delete this section to allow pushing this gem to any host.
|
19
|
-
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
# else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
# end
|
19
|
+
|
24
20
|
|
25
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
22
|
spec.bindir = "exe"
|
@@ -29,4 +25,12 @@ Gem::Specification.new do |spec|
|
|
29
25
|
|
30
26
|
spec.add_development_dependency "bundler", "~> 1.11"
|
31
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "bootstrap-sass", "~> 3.3.6"
|
29
|
+
spec.add_development_dependency "lazy_high_charts", ">=1.0.0"
|
30
|
+
spec.add_development_dependency 'momentjs-rails', '>= 2.9.0'
|
31
|
+
spec.add_development_dependency 'bootstrap3-datetimepicker-rails', '~> 4.17.42'
|
32
|
+
spec.add_runtime_dependency "bootstrap-sass", "~> 3.3.6"
|
33
|
+
spec.add_runtime_dependency "lazy_high_charts", ">=1.0.0"
|
34
|
+
spec.add_runtime_dependency 'momentjs-rails', ">= 2.9.0"
|
35
|
+
spec.add_runtime_dependency 'bootstrap3-datetimepicker-rails', "~> 4.17.42"
|
32
36
|
end
|
@@ -3,8 +3,243 @@ class <%= @scope_prefix %>GraphgraphsController < ApplicationController
|
|
3
3
|
@scopeName= <%= @scope.capitalize %>
|
4
4
|
@testData= <%= @scope.capitalize %>.all
|
5
5
|
@columnNames = <%= @scope.capitalize %>.column_names
|
6
|
+
|
7
|
+
@columnHash = <%= @scope.capitalize %>.columns_hash.each {|k,v| puts "#{k} => #{v.type}"}
|
8
|
+
@selectoptions =[]
|
9
|
+
@columnNames.each do |c|
|
10
|
+
@selectoptions << c.to_s + " : " + @columnHash[c].type.to_s
|
11
|
+
end
|
12
|
+
if (params[:xaxis]!=nil)
|
13
|
+
if params[:xaxis].include? "datetime"
|
14
|
+
get_counts(params[:xaxis],params[:yaxis],params[:xstart].split(/\s+/),params[:xend].split(/\s+/))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
@graphtype=["Bar Graph", "Line Graph", "Area Graph", "Scatter Graph"]
|
18
|
+
if (params[:graphtype].to_s == "Bar Graph")
|
19
|
+
|
20
|
+
# puts "import !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
21
|
+
tempx = params[:xaxis].slice(0..(params[:xaxis].index(' '))) # determine user-given variable name
|
22
|
+
final_x = tempx.strip
|
23
|
+
tempy = params[:yaxis].slice(0..(params[:yaxis].index(' '))) # determine user-given variable name
|
24
|
+
final_y = tempy.strip
|
25
|
+
# instance_variable_set("@#{variable_name}", params[:xaxis])
|
26
|
+
# puts <%= @scope.capitalize %>.pluck(final_x)
|
27
|
+
@barcat=[]
|
28
|
+
@bardata=[]
|
29
|
+
@chartbar = LazyHighCharts::HighChart.new('column') do |f|
|
30
|
+
if (@x_ticks!=nil)
|
31
|
+
@x_ticks.each do |x|
|
32
|
+
@barcat << x[0]
|
33
|
+
@bardata << x[1]
|
34
|
+
end
|
35
|
+
f.xAxis(:categories => @barcat)
|
36
|
+
f.series(:data=> @bardata)
|
37
|
+
else
|
38
|
+
f.xAxis(:categories => <%= @scope.capitalize %>.pluck(final_x))
|
39
|
+
f.series(:data=> <%= @scope.capitalize %>.pluck(final_y))
|
40
|
+
end
|
41
|
+
|
42
|
+
# f.series(:name=>'Jane',:data=>[1, 3, 4, 3, 3, 5, 4,-46] )
|
43
|
+
f.title({ :text=>params[:title].to_s})
|
44
|
+
f.legend(:layout=> 'horizontal',:style=> {:left=> 'auto', :bottom=> 'auto',:right=> '50px',:top=> '100px'})
|
45
|
+
|
46
|
+
|
47
|
+
### Options for Bar
|
48
|
+
### f.options[:chart][:defaultSeriesType] = "bar"
|
49
|
+
### f.plot_options({:series=>{:stacking=>"normal"}})
|
50
|
+
|
51
|
+
## or options for column
|
52
|
+
f.options[:chart][:defaultSeriesType] = "column"
|
53
|
+
# f.plot_options({:column=>{:stacking=>"percent"}})
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if (params[:graphtype].to_s == "Line Graph")
|
58
|
+
|
59
|
+
# puts "import !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
60
|
+
tempx = params[:xaxis].slice(0..(params[:xaxis].index(' '))) # determine user-given variable name
|
61
|
+
final_x = tempx.strip
|
62
|
+
tempy = params[:yaxis].slice(0..(params[:yaxis].index(' '))) # determine user-given variable name
|
63
|
+
final_y = tempy.strip
|
64
|
+
# instance_variable_set("@#{variable_name}", params[:xaxis])
|
65
|
+
# puts <%= @scope.capitalize %>.pluck(final_x)
|
66
|
+
@linecat=[]
|
67
|
+
@linedata=[]
|
68
|
+
@chartline = LazyHighCharts::HighChart.new('line') do |f|
|
69
|
+
if (@x_ticks!=nil)
|
70
|
+
@x_ticks.each do |x|
|
71
|
+
@linecat << x[0]
|
72
|
+
@linedata << x[1]
|
73
|
+
end
|
74
|
+
f.xAxis(:categories => @linecat)
|
75
|
+
f.series(:data=> @linedata)
|
76
|
+
else
|
77
|
+
f.xAxis(:categories => <%= @scope.capitalize %>.pluck(final_x))
|
78
|
+
f.series(:data=> <%= @scope.capitalize %>.pluck(final_y))
|
79
|
+
end
|
80
|
+
# f.series(:name=>'Jane',:data=>[1, 3, 4, 3, 3, 5, 4,-46] )
|
81
|
+
f.title({ :text=>params[:title].to_s})
|
82
|
+
f.legend(:layout=> 'horizontal',:style=> {:left=> 'auto', :bottom=> 'auto',:right=> '50px',:top=> '100px'})
|
83
|
+
|
84
|
+
|
85
|
+
### Options for Bar
|
86
|
+
### f.options[:chart][:defaultSeriesType] = "bar"
|
87
|
+
### f.plot_options({:series=>{:stacking=>"normal"}})
|
88
|
+
|
89
|
+
## or options for column
|
90
|
+
# f.options[:chart][:defaultSeriesType] = "column"
|
91
|
+
# f.plot_options({:column=>{:stacking=>"percent"}})
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
if (params[:graphtype].to_s == "Area Graph")
|
96
|
+
|
97
|
+
# puts "import !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
98
|
+
tempx = params[:xaxis].slice(0..(params[:xaxis].index(' '))) # determine user-given variable name
|
99
|
+
final_x = tempx.strip
|
100
|
+
tempy = params[:yaxis].slice(0..(params[:yaxis].index(' '))) # determine user-given variable name
|
101
|
+
final_y = tempy.strip
|
102
|
+
# instance_variable_set("@#{variable_name}", params[:xaxis])
|
103
|
+
# puts <%= @scope.capitalize %>.pluck(final_x)
|
104
|
+
@areacat=[]
|
105
|
+
@areadata=[]
|
106
|
+
@chartarea = LazyHighCharts::HighChart.new('area') do |f2|
|
107
|
+
if (@x_ticks!=nil)
|
108
|
+
@x_ticks.each do |x|
|
109
|
+
@areacat << x[0]
|
110
|
+
@areadata << x[1]
|
111
|
+
end
|
112
|
+
f2.xAxis(:categories => @areacat)
|
113
|
+
f2.series(:data=> @areadata)
|
114
|
+
else
|
115
|
+
f2.xAxis(:categories => <%= @scope.capitalize %>.pluck(final_x))
|
116
|
+
f2.series(:data=> <%= @scope.capitalize %>.pluck(final_y))
|
117
|
+
end
|
118
|
+
# f.series(:name=>'Jane',:data=>[1, 3, 4, 3, 3, 5, 4,-46] )
|
119
|
+
f2.title({ :text=>params[:title].to_s})
|
120
|
+
f2.plot_options(series: {
|
121
|
+
stacking:'normal'
|
122
|
+
})
|
123
|
+
f2.chart({ defaultSeriesType: 'area'})
|
124
|
+
f2.legend(:layout=> 'horizontal',:style=> {:left=> 'auto', :bottom=> 'auto',:right=> '50px',:top=> '100px'})
|
125
|
+
|
126
|
+
|
127
|
+
### Options for Bar
|
128
|
+
### f.options[:chart][:defaultSeriesType] = "bar"
|
129
|
+
### f.plot_options({:series=>{:stacking=>"normal"}})
|
130
|
+
|
131
|
+
## or options for column
|
132
|
+
# f.options[:chart][:defaultSeriesType] = "column"
|
133
|
+
# f.plot_options({:column=>{:stacking=>"percent"}})
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
if (params[:graphtype].to_s == "Scatter Graph")
|
139
|
+
|
140
|
+
# puts "import !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
141
|
+
tempx = params[:xaxis].slice(0..(params[:xaxis].index(' '))) # determine user-given variable name
|
142
|
+
final_x = tempx.strip
|
143
|
+
tempy = params[:yaxis].slice(0..(params[:yaxis].index(' '))) # determine user-given variable name
|
144
|
+
final_y = tempy.strip
|
145
|
+
# instance_variable_set("@#{variable_name}", params[:xaxis])
|
146
|
+
# puts <%= @scope.capitalize %>.pluck(final_x)
|
147
|
+
@scattercat=[]
|
148
|
+
@scatterdata=[]
|
149
|
+
@chartscatter = LazyHighCharts::HighChart.new('scatter') do |f2|
|
150
|
+
if (@x_ticks!=nil)
|
151
|
+
@x_ticks.each do |x|
|
152
|
+
@scattercat << x[0]
|
153
|
+
@scatterdata << x[1]
|
154
|
+
end
|
155
|
+
f2.xAxis(:categories => @scattercat)
|
156
|
+
f2.series(:data=> @scatterdata)
|
157
|
+
else
|
158
|
+
f2.xAxis(:categories => <%= @scope.capitalize %>.pluck(final_x))
|
159
|
+
f2.series(:data=> <%= @scope.capitalize %>.pluck(final_y))
|
160
|
+
end
|
161
|
+
# f.series(:name=>'Jane',:data=>[1, 3, 4, 3, 3, 5, 4,-46] )
|
162
|
+
f2.title({ :text=>params[:title].to_s})
|
163
|
+
f2.plot_options(series: {
|
164
|
+
stacking:'normal'
|
165
|
+
})
|
166
|
+
f2.chart({ defaultSeriesType: 'scatter'})
|
167
|
+
f2.legend(:layout=> 'horizontal',:style=> {:left=> 'auto', :bottom=> 'auto',:right=> '50px',:top=> '100px'})
|
168
|
+
|
169
|
+
|
170
|
+
### Options for Bar
|
171
|
+
### f.options[:chart][:defaultSeriesType] = "bar"
|
172
|
+
### f.plot_options({:series=>{:stacking=>"normal"}})
|
173
|
+
|
174
|
+
## or options for column
|
175
|
+
# f.options[:chart][:defaultSeriesType] = "column"
|
176
|
+
# f.plot_options({:column=>{:stacking=>"percent"}})
|
177
|
+
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
private
|
183
|
+
|
184
|
+
def get_counts(dateValue,pluckValue,startvalue,endvalue)
|
185
|
+
@newx= startvalue
|
186
|
+
@newendx= endvalue
|
187
|
+
|
188
|
+
@begin_date = Date.strptime(@newx[0], '%m/%d/%Y')
|
189
|
+
@end_date = Date.strptime(@newendx[0], '%m/%d/%Y')
|
190
|
+
@starttimehour=(@newx[1].split(':')[0].to_i)
|
191
|
+
@starttimeminute=(@newx[1].split(':')[1].to_i)
|
192
|
+
@endtimehour=(@newendx[1].split(':')[0].to_i)
|
193
|
+
@endtimeminute=(@newendx[1].split(':')[1].to_i)
|
194
|
+
# if @newx[2]=="PM"
|
195
|
+
# @starttimehour=@starttimehour+12
|
196
|
+
# end
|
197
|
+
# if @newendx[2]=="PM"
|
198
|
+
# @endtimehour=@endtimehour+12
|
199
|
+
# end
|
200
|
+
@begincount="#{@begin_date} #{@starttimehour}:#{@starttimeminute} #{@newx[2]}"
|
201
|
+
@endcount="#{@end_date} #{@endtimehour}:#{@endtimeminute} #{@newendx[2]}"
|
202
|
+
num_days = (@end_date - @begin_date).to_i
|
203
|
+
tempval = dateValue.slice(0..(dateValue.index(' '))) # determine user-given variable name
|
204
|
+
finalval = tempval.strip
|
205
|
+
temppluckval = pluckValue.slice(0..(pluckValue.index(' '))) # determine user-given variable name
|
206
|
+
finalpluckval = temppluckval.strip
|
207
|
+
# puts <%= @scope.capitalize %>.where(finalval + ' >= ? AND '+ finalval +' <= ?', @begin_date.at_beginning_of_day, @end_date.at_end_of_day)
|
208
|
+
@x_unit = params[:rangetypex]
|
209
|
+
# if num_days >= 31
|
210
|
+
# @x_unit = 'monthly'
|
211
|
+
# elsif num_days >= 1
|
212
|
+
# @x_unit = 'daily'
|
213
|
+
# end
|
214
|
+
@x_ticks = []
|
215
|
+
ts_conversion = "convert_tz(timestamp, '+00:00', '#{Time.now.strftime('%:z')}')"
|
216
|
+
Time.zone="Bangkok"
|
217
|
+
case @x_unit
|
218
|
+
when 'minute'
|
219
|
+
(Time.zone.parse(@begincount).to_i .. Time.zone.parse(@endcount).to_i).step(1.minute) do |date|
|
220
|
+
time = Time.zone.at(Time.at(date))
|
221
|
+
@x_ticks << ["#{time.day}/#{time.month}/#{time.year} #{time.hour}:#{time.min}:00-#{time.hour}:#{time.min}:59" , <%= @scope.capitalize %>.where(finalval + ' >= ? AND '+ finalval +' <= ?', DateTime.parse("#{time.year}/#{time.month}/#{time.day} #{time.hour}:#{time.min}:00:000000"), DateTime.parse("#{time.year}/#{time.month}/#{time.day} #{time.hour}:#{time.min}:59:999999")).pluck(finalpluckval).inject(0, :+)]
|
222
|
+
end
|
223
|
+
when 'hourly'
|
224
|
+
(Time.zone.parse(@begincount).to_i .. Time.zone.parse(@endcount).to_i).step(1.hour) do |date|
|
225
|
+
time = Time.zone.at(Time.at(date))
|
226
|
+
@x_ticks << ["#{time.day}/#{time.month}/#{time.year} #{time.hour}:00-#{time.hour}:59" , <%= @scope.capitalize %>.where(finalval + ' >= ? AND '+ finalval +' <= ?', DateTime.parse("#{time.year}/#{time.month}/#{time.day} #{time.hour}:00:00:000000"), DateTime.parse("#{time.year}/#{time.month}/#{time.day} #{time.hour}:59:59:999999")).pluck(finalpluckval).inject(0, :+)]
|
227
|
+
end
|
228
|
+
# @groups = [:camera_id, "year(#{ts_conversion})", "month(#{ts_conversion})", "day(#{ts_conversion})", "hour(#{ts_conversion})"]
|
229
|
+
|
230
|
+
when 'daily'
|
231
|
+
(Time.zone.parse(@begincount).to_i .. Time.zone.parse(@endcount).to_i).step(1.day) do |date|
|
232
|
+
time = Time.zone.at(Time.at(date))
|
233
|
+
@x_ticks << ["#{time.day}/#{time.month}/#{time.year}" , <%= @scope.capitalize %>.where(finalval + ' >= ? AND '+ finalval +' <= ?', DateTime.parse("#{time.year}/#{time.month}/#{time.day} 00:00:00:000000"), DateTime.parse("#{time.year}/#{time.month}/#{time.day} 23:59:59:999999")).pluck(finalpluckval).inject(0, :+)]
|
234
|
+
end
|
235
|
+
when 'monthly'
|
236
|
+
(@begin_date.clone.to_time.localtime.at_beginning_of_month.to_date .. @end_date.clone.to_time.localtime.at_end_of_month.to_date).select {|d| d.day == 1}.each do |date|
|
237
|
+
@x_ticks << ["#{date.month}/#{date.year}" , <%= @scope.capitalize %>.where(finalval + ' >= ? AND '+ finalval +' <= ?', DateTime.parse("#{date.year}/#{date.month}/1 00:00:00:000000"), DateTime.parse("#{date.year}/#{date.month}/#{date.end_of_month.day} 23:59:59:999999")).pluck(finalpluckval).inject(0, :+)]
|
238
|
+
end
|
239
|
+
# @groups = [:camera_id, "year(#{ts_conversion})", "month(#{ts_conversion})"]
|
240
|
+
end
|
6
241
|
end
|
7
242
|
# def testMethod
|
8
243
|
# super
|
9
244
|
# end
|
10
|
-
end
|
245
|
+
end
|
@@ -1,6 +1,143 @@
|
|
1
|
-
|
1
|
+
<%= form_tag :method => 'get' do %>
|
2
|
+
<p>
|
3
|
+
<lable>Graph Type :</lable>
|
4
|
+
<%= select_tag :graphtype, options_for_select(@graphtype), :id=>"select_graph", :include_blank => true %>
|
5
|
+
</p>
|
6
|
+
<p>
|
7
|
+
<lable>Title :</label>
|
8
|
+
<input type="text" name="title" />
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<lable>X Axis :</lable>
|
12
|
+
<%= select_tag :xaxis, options_for_select(@selectoptions), :id=>"select_xaxis", :include_blank => true, :onchange => "typecheckx()" %>
|
13
|
+
</p>
|
2
14
|
|
3
|
-
|
4
|
-
|
15
|
+
<div class='col-sm-2' id="datepickerforx" hidden>
|
16
|
+
<input type='text' name="xstart" class="form-control" id='datetimepicker1' />
|
17
|
+
to
|
18
|
+
<input type='text' name="xend" class="form-control" id='datetimepicker2' /></br>
|
19
|
+
<input type="radio" name="rangetypex" value="minute"> per Minute<br>
|
20
|
+
<input type="radio" name="rangetypex" value="hourly" checked> Hourly<br>
|
21
|
+
<input type="radio" name="rangetypex" value="daily"> Daily<br>
|
22
|
+
<input type="radio" name="rangetypex" value="monthly"> Monthly<br>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
<lable>Y Axis :</lable>
|
27
|
+
<%= select_tag :yaxis, options_for_select(@selectoptions), :id=>"select_yaxis", :include_blank => true, :onchange => "typechecky()" %>
|
28
|
+
</p>
|
29
|
+
|
30
|
+
<div class='col-sm-2' id="datepickerfory" hidden>
|
31
|
+
<input type='text' name="ystart" class="form-control" id='datetimepicker3' />
|
32
|
+
to
|
33
|
+
<input type='text' name="yend" class="form-control" id='datetimepicker4' />
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<%= submit_tag 'Submit', :id=>"submitselection"%>
|
5
37
|
<% end %>
|
6
|
-
|
38
|
+
|
39
|
+
<script>
|
40
|
+
$(function () {
|
41
|
+
$('#datetimepicker1').datetimepicker();
|
42
|
+
$('#datetimepicker2').datetimepicker({
|
43
|
+
useCurrent: false //Important! See issue #1075
|
44
|
+
});
|
45
|
+
$("#datetimepicker1").on("dp.change", function (e) {
|
46
|
+
$('#datetimepicker2').data("DateTimePicker").minDate(e.date);
|
47
|
+
});
|
48
|
+
$("#datetimepicker2").on("dp.change", function (e) {
|
49
|
+
$('#datetimepicker1').data("DateTimePicker").maxDate(e.date);
|
50
|
+
});
|
51
|
+
$('#datetimepicker3').datetimepicker();
|
52
|
+
$('#datetimepicker4').datetimepicker({
|
53
|
+
useCurrent: false //Important! See issue #1075
|
54
|
+
});
|
55
|
+
$("#datetimepicker3").on("dp.change", function (e) {
|
56
|
+
$('#datetimepicker4').data("DateTimePicker").minDate(e.date);
|
57
|
+
});
|
58
|
+
$("#datetimepicker4").on("dp.change", function (e) {
|
59
|
+
$('#datetimepicker3').data("DateTimePicker").maxDate(e.date);
|
60
|
+
});
|
61
|
+
});
|
62
|
+
function showSource(dividsource) {
|
63
|
+
console.log(dividsource);
|
64
|
+
document.getElementById("sourceArea").value=document.getElementById(dividsource).innerHTML;
|
65
|
+
document.getElementById("sourceArea").style.display="block";
|
66
|
+
}
|
67
|
+
function typecheckx(){
|
68
|
+
if (document.getElementById('select_xaxis').value.indexOf('datetime')!=-1)
|
69
|
+
document.getElementById('datepickerforx').style.display= "inline";
|
70
|
+
else
|
71
|
+
document.getElementById('datepickerforx').style.display= "none";
|
72
|
+
}
|
73
|
+
function typechecky(){
|
74
|
+
if (document.getElementById('select_yaxis').value.indexOf('datetime')!=-1)
|
75
|
+
document.getElementById('datepickerfory').style.display= "inline";
|
76
|
+
else
|
77
|
+
document.getElementById('datepickerfory').style.display= "none";
|
78
|
+
}
|
79
|
+
$(document).ready(function(){
|
80
|
+
$('#select_xaxis').change(function() {
|
81
|
+
$('#selectxlabel').text($(this).val());
|
82
|
+
});
|
83
|
+
$('#select_yaxis').change(function() {
|
84
|
+
$('#selectylabel').text($(this).val());
|
85
|
+
});
|
86
|
+
$('#select_graph').change(function() {
|
87
|
+
$('#selectgraphlabel').text($(this).val());
|
88
|
+
});
|
89
|
+
$('#select_graph').change(updateFormEnabled);
|
90
|
+
$('#select_xaxis').change(updateFormEnabled);
|
91
|
+
$('#select_yaxis').change(updateFormEnabled);
|
92
|
+
$('[data-behaviour~=datepicker]').datepicker();
|
93
|
+
});
|
94
|
+
|
95
|
+
function updateFormEnabled() {
|
96
|
+
if (verifySettings()) {
|
97
|
+
$('#submitselection').attr('disabled', false);
|
98
|
+
} else {
|
99
|
+
$('#submitselection').attr('disabled', true);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
function verifySettings() {
|
104
|
+
if ($('#select_graph').val() != '' && $('#select_xaxis').val() != '' && $('#select_yaxis').val() != '') {
|
105
|
+
return true;
|
106
|
+
} else {
|
107
|
+
return false;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
$('#submitselection').attr('disabled', true);
|
112
|
+
|
113
|
+
</script>
|
114
|
+
|
115
|
+
<br>
|
116
|
+
<lable> Current Settings: </lable> <br>
|
117
|
+
<lable> Graph Type: </lable>
|
118
|
+
<label id="selectgraphlabel"> <%= params[:graphtype] %> </label>
|
119
|
+
<br>
|
120
|
+
<lable> X-Axis: </lable>
|
121
|
+
<label id="selectxlabel"> <%= params[:xaxis] %> </label>
|
122
|
+
<br>
|
123
|
+
<lable> Y-Axis: </lable>
|
124
|
+
<label id="selectylabel"> <%= params[:yaxis] %> </label>
|
125
|
+
<br>
|
126
|
+
<% if (params[:graphtype]=="Bar Graph") %>
|
127
|
+
<%= high_chart("my_bar_div", @chartbar) %>
|
128
|
+
<button onclick="showSource('my_bar_div')">Show Source</button>
|
129
|
+
<% end %>
|
130
|
+
<% if (params[:graphtype]=="Line Graph") %>
|
131
|
+
<%= high_chart("my_line_div", @chartline) %>
|
132
|
+
<button onclick="showSource('my_line_div')">Show Source</button>
|
133
|
+
<% end %>
|
134
|
+
<% if (params[:graphtype]=="Area Graph") %>
|
135
|
+
<%= high_chart("my_area_div", @chartarea) %>
|
136
|
+
<button onclick="showSource('my_area_div')">Show Source</button>
|
137
|
+
<% end %>
|
138
|
+
<% if (params[:graphtype]=="Scatter Graph") %>
|
139
|
+
<%= high_chart("my_scatter_div", @chartscatter) %>
|
140
|
+
<button onclick="showSource('my_scatter_div')">Show Source</button>
|
141
|
+
<% end %>
|
142
|
+
|
143
|
+
<textarea id="sourceArea" style="width: 900px; height: 300px;" hidden></textarea>
|
data/lib/graphgraph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphgraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suhas Shrestha
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,118 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bootstrap-sass
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.6
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.6
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: lazy_high_charts
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: momentjs-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.9.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.9.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bootstrap3-datetimepicker-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.17.42
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.17.42
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bootstrap-sass
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.3.6
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.3.6
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: lazy_high_charts
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.0.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.0.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: momentjs-rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.9.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.9.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: bootstrap3-datetimepicker-rails
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 4.17.42
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 4.17.42
|
41
153
|
description: View for each model is generated and selection of multiple graphing options
|
42
154
|
is provided.
|
43
155
|
email:
|
@@ -87,8 +199,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
199
|
version: '0'
|
88
200
|
requirements: []
|
89
201
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
202
|
+
rubygems_version: 2.5.1
|
91
203
|
signing_key:
|
92
204
|
specification_version: 4
|
93
205
|
summary: This gem will generate graphs based on models it is wrapped around.
|
94
206
|
test_files: []
|
207
|
+
has_rdoc:
|