pizza_chart 0.0.0 → 1.0.0

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 +15 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3a2e8c92d2f15cd2314db82099b98cc7249bd70
4
- data.tar.gz: 9cf817350c15e2d884c3a5e705e7cabc0b784a19
3
+ metadata.gz: 5a3f3aa394a6d74a7944d84273aa96146f1d5be9
4
+ data.tar.gz: 41a9bfe5b524c6a9bc7602c0611e3a86d2622399
5
5
  SHA512:
6
- metadata.gz: 09f65e870c8a71aa69e3de925f17a608bf9580ff2cbd22bf932f8f25be8b28c1b1ed9750910f342002a598c25408c3025a4b6a7f62fcd66762b0a44b3c7461ba
7
- data.tar.gz: 31be9f80493fb441d389a57c1f7fda6fad57f6dfe1fb8d48f831164c2ae9ae68526a7ee87fbbda95493d96d8a595f92556b3b6314ebb3c36b5d611fc6ec30b8a
6
+ metadata.gz: 54dc8c682b504e21fb978f98b67a89fe6cb47b468adcd886256b6ef8873ce31c581720022cb140accbe116255d2a8e61e4832145b206ae25666526d86a01dcbe
7
+ data.tar.gz: eefd9c1d6d471d0f5013e6f3d923ed2026282b9c6bae2687cb210a5e86d880fe84ce7f876b8f0516d7727274c474377cd618a1acd2d432a4179d0b6b4a2a6511
data/lib/graph.rb CHANGED
@@ -1,12 +1,25 @@
1
1
  require 'lazy_high_charts'
2
2
  module Charting
3
3
 
4
- def self.function_chart(x_name, y_data_1, y_name_1, y_data_2, y_name_2)
4
+ def self.function_chart(x_name, y_data_1, y_name_1, y_data_2, y_name_2,chart_type)
5
5
  #x_name = "Actual Price"
6
6
  #y_name = "Offer Price"
7
7
  #x_axis_variables = x_array
8
8
  #y_axis_variables = y_array
9
9
  #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'
20
+ end
21
+ else
22
+ h = 'bar'
10
23
  return @chart = LazyHighCharts::HighChart.new('graph') do |f|
11
24
  f.title({ :text=>"Combination chart"})
12
25
  f.options[:xAxis][:categories] = ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
@@ -16,7 +29,7 @@ module Charting
16
29
  f.series(:type=> 'column', :name=> 'Joe',:data=> [4, 3, 3, 9, 0])
17
30
  f.series(:type=> 'column', :name=> 'Joe',:data=> [4, 3, 3, 9, 0])
18
31
  f.series(:type=> 'spline',:name=> 'Average', :data=> [3, 2.67, 3, 6.33, 3.33])
19
- f.series(:type=> 'pie',:name=> 'Total consumption',
32
+ f.series(:type=> h,:name=> 'Total consumption',
20
33
  :data=> [
21
34
  {:name=> 'Jane', :y=> 13, :color=> 'red'},
22
35
  {:name=> 'John', :y=> 23,:color=> 'green'},
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: 0.0.0
4
+ version: 1.0.0
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-01 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler