pizza_chart 1.0.0 → 1.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graph.rb +40 -23
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a3f3aa394a6d74a7944d84273aa96146f1d5be9
4
- data.tar.gz: 41a9bfe5b524c6a9bc7602c0611e3a86d2622399
3
+ metadata.gz: 912e81fd3f0f4bc420eddc8d14e5bb96dc2ee461
4
+ data.tar.gz: acd2db696dfd6016efcc3376e3e9575328b210cf
5
5
  SHA512:
6
- metadata.gz: 54dc8c682b504e21fb978f98b67a89fe6cb47b468adcd886256b6ef8873ce31c581720022cb140accbe116255d2a8e61e4832145b206ae25666526d86a01dcbe
7
- data.tar.gz: eefd9c1d6d471d0f5013e6f3d923ed2026282b9c6bae2687cb210a5e86d880fe84ce7f876b8f0516d7727274c474377cd618a1acd2d432a4179d0b6b4a2a6511
6
+ metadata.gz: c85e4f327e50c6cc538440cbb0b7707aa3c3711abd5c046c9204bdbe8859d62e09701170e77de3a9589938dc87131a0f2c29e68a8e666e39d6016406cadb3e64
7
+ data.tar.gz: 9516c7e4432f3b20eaefdde00e9bc3eb2f4b54d33053d1c8094e23b5c7e498b1e4eb7986308b54459f742f96737f42e9c4ee9a79ae95c73d9151a08a3c0e61ae
data/lib/graph.rb CHANGED
@@ -1,26 +1,51 @@
1
1
  require 'lazy_high_charts'
2
2
  module Charting
3
-
4
- def self.function_chart(x_name, y_data_1, y_name_1, y_data_2, y_name_2,chart_type)
3
+ def self.line(x_name, y_data_1, y_name_1, y_data_2, y_name_2, chart_type)
4
+ if (chart_type) then
5
+ case chart_type
6
+ when "pie"
7
+ h='pie'
8
+ when "bar"
9
+ h='bar'
10
+ when "line"
11
+ h='line'
12
+ when "spline"
13
+ h='spline'
14
+ end
15
+ else
16
+ h = 'bar'
17
+ end
18
+ @chart = LazyHighCharts::HighChart.new('graph') do |f|
19
+ f.title({ :text=>"Combination chart"})
20
+ f.options[:xAxis][:categories] = x_name
21
+ f.labels(:items=>[:html=> y_name_1 + " VS " + y_name_2, :style=>{:left=>"40px", :top=>"8px", :color=>"black"} ])
22
+ f.series(:type=> 'column',:name=> y_name_1,:data=> y_data_1)
23
+ f.series(:type=> 'column',:name=> y_name_2,:data=> y_data_2, :center=> [100, 80], :size=> 100, :showInLegend=> true)
24
+ puts (instance_of(@chart))
25
+ end
26
+ end
27
+
28
+ def self.function_chart(x_name, y_data_1, y_name_1, y_data_2, y_name_2, chart_type)
5
29
  #x_name = "Actual Price"
6
30
  #y_name = "Offer Price"
7
31
  #x_axis_variables = x_array
8
32
  #y_axis_variables = y_array
9
33
  #food_name = Food.select("foodName").group_by{|o| o.foodName}.keys
10
- if (chart_type)
11
- case chart_type
12
- when "pie"
13
- h='pie'
14
- when "bar"
15
- h='bar'
16
- when "line"
17
- h='line'
18
- when "spline"
19
- h='spline'
34
+ if (chart_type) then
35
+ case chart_type
36
+ when "pie"
37
+ h='pie'
38
+ when "bar"
39
+ h='bar'
40
+ when "line"
41
+ h='line'
42
+ when "spline"
43
+ h='spline'
44
+ end
45
+ else
46
+ h = 'bar'
20
47
  end
21
- else
22
- h = 'bar'
23
- return @chart = LazyHighCharts::HighChart.new('graph') do |f|
48
+ @chart = LazyHighCharts::HighChart.new('graph') do |f|
24
49
  f.title({ :text=>"Combination chart"})
25
50
  f.options[:xAxis][:categories] = ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
26
51
  f.labels(:items=>[:html=>"Total fruit consumption", :style=>{:left=>"40px", :top=>"8px", :color=>"black"} ])
@@ -29,14 +54,6 @@ module Charting
29
54
  f.series(:type=> 'column', :name=> 'Joe',:data=> [4, 3, 3, 9, 0])
30
55
  f.series(:type=> 'column', :name=> 'Joe',:data=> [4, 3, 3, 9, 0])
31
56
  f.series(:type=> 'spline',:name=> 'Average', :data=> [3, 2.67, 3, 6.33, 3.33])
32
- f.series(:type=> h,:name=> 'Total consumption',
33
- :data=> [
34
- {:name=> 'Jane', :y=> 13, :color=> 'red'},
35
- {:name=> 'John', :y=> 23,:color=> 'green'},
36
- {:name=> 'Joe', :y=> 19,:color=> 'blue'}
37
- ],
38
- :center=> [100, 80], :size=> 100, :showInLegend=> false)
39
57
  end
40
58
  end
41
-
42
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pizza_chart
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'Kishore Kumar '
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-21 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler