chartify 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f754d491ce71c728183aefc7185bfafa1640e5d
4
- data.tar.gz: 7dac10f51fc23054e640b775ea81faebe53eb7c7
3
+ metadata.gz: e43f72a8d875e3c910d4cd10326ef74c24005324
4
+ data.tar.gz: b671a8ad3a32d9e81a1905b6ce4f21c1f0b7c232
5
5
  SHA512:
6
- metadata.gz: b9b855fa25fb15fb6ec2da9c9adb192664c6300686cd9b3b7f2b03ae66b4b0ba3b5c43f360e31d26bb60b8da34e33c773489db790f35e56f5aa12e5d01744cfb
7
- data.tar.gz: 852b34561415658344c9ab8a1be2583988d5a86056ea551de2ac7f33d65eba80d5c9d5880930f0a4a93ae6663ea77105033ce81272416c3b72358eb86c54f478
6
+ metadata.gz: 570d6be7cfa5b7263bae328533095e3ed987fa7da7c7f51506a7c5433bb8f16d5b129d80d8d22e203afee17e19191778907a7c4a6765559b5a7a522ae92dce35
7
+ data.tar.gz: 48a44e598cc148a5639f8c21071cfc2dec09cb070eb2a2533164fa705113d2a99a94a4b58281266a45fae174292eef1455c3c176e1cf29cb6ccaa5684575ec7b
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Charter
1
+ Chartify
2
2
  =======
3
3
  The purpose of this gem is to capture data to create a chart, in an object, so that we can do the following things
4
4
 
@@ -24,7 +24,7 @@ For generating image from the chart data we are using [Gruff](https://github.com
24
24
 
25
25
  Here are some sample code to generate graph object and render to web.
26
26
  ```ruby
27
- @chart = Charter::Factory.build(:line) do |chart|
27
+ @chart = Chartify::Factory.build(:line) do |chart|
28
28
  chart.data = [{hours_remain: 100, estimated_hours_remain: 100, day: 3.days.ago.to_date},
29
29
  {hours_remain: 50, estimated_hours_remain: 45, day: 2.days.ago.to_date},
30
30
  {hours_remain: 5, estimated_hours_remain: 10, day: 1.days.ago.to_date}]
data/Rakefile CHANGED
@@ -25,10 +25,10 @@ begin
25
25
  require 'rdoc/task'
26
26
 
27
27
  Rake::RDocTask.new do |rdoc|
28
- require 'charter/version'
28
+ require 'chartify/version'
29
29
 
30
30
  rdoc.rdoc_dir = 'rdoc'
31
- rdoc.title = "Charter #{Charter::VERSION}"
31
+ rdoc.title = "Chartify #{Chartify::VERSION}"
32
32
  rdoc.rdoc_files.include('README*')
33
33
  rdoc.rdoc_files.include('lib/**/*.rb')
34
34
  end
@@ -1,8 +1,8 @@
1
- module Charter
2
- autoload :Configuration, "charter/config"
1
+ module Chartify
2
+ autoload :Configuration, "chartify/config"
3
3
 
4
4
  def self.configure(&block)
5
- yield @config ||= Charter::Configuration.new
5
+ yield @config ||= Chartify::Configuration.new
6
6
  end
7
7
 
8
8
  def self.config
@@ -1,7 +1,7 @@
1
- require 'charter/chart_base'
1
+ require 'chartify/chart_base'
2
2
  require 'gruff'
3
3
 
4
- module Charter
4
+ module Chartify
5
5
  class BarChart < ChartBase
6
6
  def to_blob
7
7
  g = prepare_gruff(:bar)
@@ -1,6 +1,6 @@
1
- require 'charter/gruff_themes'
1
+ require 'chartify/gruff_themes'
2
2
 
3
- module Charter
3
+ module Chartify
4
4
  class ChartBase
5
5
  attr_accessor :title, :data, :columns, :label_column
6
6
 
@@ -18,10 +18,10 @@ module Charter
18
18
  end
19
19
 
20
20
  def render_chart(html_dom_id, options = {})
21
- api_name = options[:web_api_name] || Charter.config.web_api_name.to_s
21
+ api_name = options[:web_api_name] || Chartify.config.web_api_name.to_s
22
22
  class_name = self.class.name.split("::")[1]
23
- load "charter/web_chart/#{api_name}/#{class_name.underscore}.rb"
24
- chart = "Charter::WebChart::#{api_name.camelize}::#{class_name}".constantize.new
23
+ load "chartify/web_chart/#{api_name}/#{class_name.underscore}.rb"
24
+ chart = "Chartify::WebChart::#{api_name.camelize}::#{class_name}".constantize.new
25
25
  chart.data, chart.columns, chart.label_column = self.data, self.columns, self.label_column
26
26
  html = <<-HTML
27
27
  #{chart.include_js if chart.respond_to?(:include_js)}
@@ -43,7 +43,7 @@ module Charter
43
43
  chart_type = "Gruff::#{chart_type}".constantize
44
44
 
45
45
  g = chart_type.new
46
- g.theme = Charter::Themes::GOOGLE_CHART
46
+ g.theme = Chartify::Themes::GOOGLE_CHART
47
47
  g.title = self.title
48
48
  g
49
49
  end
@@ -109,11 +109,11 @@ module Charter
109
109
  end
110
110
 
111
111
  def config
112
- @config ||= Charter.config
112
+ @config ||= Chartify.config
113
113
  end
114
114
 
115
115
  def web_config
116
- @web_config ||= Charter.config.web_config
116
+ @web_config ||= Chartify.config.web_config
117
117
  end
118
118
  end
119
119
  end
@@ -1,11 +1,11 @@
1
- module Charter
1
+ module Chartify
2
2
  class Configuration
3
3
  include ActiveSupport::Configurable
4
4
  config_accessor :web_api_name
5
5
  config_accessor :chart
6
6
 
7
7
  def web(&block)
8
- yield @web_config ||= Charter::WebConfiguration.new
8
+ yield @web_config ||= Chartify::WebConfiguration.new
9
9
  end
10
10
 
11
11
  def web_config
@@ -1,14 +1,14 @@
1
- require 'charter/gruff_themes'
2
- require 'charter/line_chart'
3
- require 'charter/pie_chart'
4
- require 'charter/bar_chart'
1
+ require 'chartify/gruff_themes'
2
+ require 'chartify/line_chart'
3
+ require 'chartify/pie_chart'
4
+ require 'chartify/bar_chart'
5
5
 
6
- module Charter
6
+ module Chartify
7
7
  class Factory
8
8
  # @param type can be of line, pie, bar etc
9
9
  def self.build(type, &block)
10
10
  raise "type has to be a symbol" unless type.kind_of? Symbol
11
- chart = "Charter::#{type.to_s.camelize}Chart".constantize.new
11
+ chart = "Chartify::#{type.to_s.camelize}Chart".constantize.new
12
12
  block.call chart
13
13
  chart
14
14
  end
@@ -1,4 +1,4 @@
1
- module Charter
1
+ module Chartify
2
2
  module Themes
3
3
  GOOGLE_CHART = {
4
4
  :colors => [
@@ -1,9 +1,9 @@
1
- require 'charter/chart_base'
1
+ require 'chartify/chart_base'
2
2
  require 'gruff'
3
3
 
4
4
  # Example
5
5
  # -------
6
- # Charter::Factory.build(:line) do |chart|
6
+ # Chartify::Factory.build(:line) do |chart|
7
7
  # chart.data = [{hours_remain: 100, estimated_hours_remain: 100, day: 3.days.ago.to_date},
8
8
  # {hours_remain: 50, estimated_hours_remain: 45, day: 2.days.ago.to_date},
9
9
  # {hours_remain: 5, estimated_hours_remain: 10, day: 1.days.ago.to_date}]
@@ -11,7 +11,7 @@ require 'gruff'
11
11
  # chart.label_column = :day
12
12
  # end
13
13
 
14
- module Charter
14
+ module Chartify
15
15
  class LineChart < ChartBase
16
16
  def to_blob
17
17
  g = prepare_gruff(:line)
@@ -1,14 +1,14 @@
1
- require 'charter/chart_base'
1
+ require 'chartify/chart_base'
2
2
  require 'gruff'
3
3
 
4
4
  # Example
5
5
  # -------
6
- # Charter::Factory.build(:pie) do |chart|
6
+ # Chartify::Factory.build(:pie) do |chart|
7
7
  # chart.data = {'ruby' => 100,
8
8
  # 'python' => 12}
9
9
  # chart.columns = ['Language', 'Usage']
10
10
  # end
11
- module Charter
11
+ module Chartify
12
12
  class PieChart < ChartBase
13
13
  def to_blob
14
14
  g = prepare_gruff(:pie)
@@ -0,0 +1,3 @@
1
+ module Chartify
2
+ VERSION = "0.1.1"
3
+ end
@@ -1,11 +1,11 @@
1
- require 'charter/bar_chart'
2
- require 'charter/web_chart/google_chart/google_chart_module'
1
+ require 'chartify/bar_chart'
2
+ require 'chartify/web_chart/google_chart/google_chart_module'
3
3
 
4
- module Charter
4
+ module Chartify
5
5
  module WebChart
6
6
  module GoogleChart
7
- class BarChart < Charter::BarChart
8
- include Charter::WebChart::GoogleChart::GoogleChartModule
7
+ class BarChart < Chartify::BarChart
8
+ include Chartify::WebChart::GoogleChart::GoogleChartModule
9
9
 
10
10
  def render(html_dom_id)
11
11
  js = <<-JS
@@ -1,6 +1,6 @@
1
- require 'charter/bar_chart'
1
+ require 'chartify/bar_chart'
2
2
 
3
- module Charter
3
+ module Chartify
4
4
  module WebChart
5
5
  module GoogleChart
6
6
  module GoogleChartModule
@@ -1,11 +1,11 @@
1
- require 'charter/line_chart'
2
- require 'charter/web_chart/google_chart/google_chart_module'
1
+ require 'chartify/line_chart'
2
+ require 'chartify/web_chart/google_chart/google_chart_module'
3
3
 
4
- module Charter
4
+ module Chartify
5
5
  module WebChart
6
6
  module GoogleChart
7
- class LineChart < Charter::LineChart
8
- include Charter::WebChart::GoogleChart::GoogleChartModule
7
+ class LineChart < Chartify::LineChart
8
+ include Chartify::WebChart::GoogleChart::GoogleChartModule
9
9
 
10
10
  def render(html_dom_id)
11
11
  js = <<-JS
@@ -1,11 +1,11 @@
1
- require 'charter/pie_chart'
2
- require 'charter/web_chart/google_chart/google_chart_module'
1
+ require 'chartify/pie_chart'
2
+ require 'chartify/web_chart/google_chart/google_chart_module'
3
3
 
4
- module Charter
4
+ module Chartify
5
5
  module WebChart
6
6
  module GoogleChart
7
- class PieChart < Charter::PieChart
8
- include Charter::WebChart::GoogleChart::GoogleChartModule
7
+ class PieChart < Chartify::PieChart
8
+ include Chartify::WebChart::GoogleChart::GoogleChartModule
9
9
 
10
10
  # Js data
11
11
  # var data = google.visualization.arrayToDataTable([
@@ -1,4 +1,4 @@
1
1
  # desc "Explaining what the task does"
2
- # task :charter do
2
+ # task :chartify do
3
3
  # # Task goes here
4
4
  # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.K.M. Ashrafuzzaman
@@ -153,21 +153,21 @@ files:
153
153
  - MIT-LICENSE
154
154
  - README.md
155
155
  - Rakefile
156
- - lib/charter.rb
157
- - lib/charter/bar_chart.rb
158
- - lib/charter/chart_base.rb
159
- - lib/charter/config.rb
160
- - lib/charter/factory.rb
161
- - lib/charter/gruff_themes.rb
162
- - lib/charter/line_chart.rb
163
- - lib/charter/pie_chart.rb
164
- - lib/charter/version.rb
165
- - lib/charter/web_chart/google_chart/bar_chart.rb
166
- - lib/charter/web_chart/google_chart/google_chart_module.rb
167
- - lib/charter/web_chart/google_chart/line_chart.rb
168
- - lib/charter/web_chart/google_chart/pie_chart.rb
169
- - lib/tasks/charter_tasks.rake
170
- homepage: https://github.com/ashrafuzzaman/charter
156
+ - lib/chartify.rb
157
+ - lib/chartify/bar_chart.rb
158
+ - lib/chartify/chart_base.rb
159
+ - lib/chartify/config.rb
160
+ - lib/chartify/factory.rb
161
+ - lib/chartify/gruff_themes.rb
162
+ - lib/chartify/line_chart.rb
163
+ - lib/chartify/pie_chart.rb
164
+ - lib/chartify/version.rb
165
+ - lib/chartify/web_chart/google_chart/bar_chart.rb
166
+ - lib/chartify/web_chart/google_chart/google_chart_module.rb
167
+ - lib/chartify/web_chart/google_chart/line_chart.rb
168
+ - lib/chartify/web_chart/google_chart/pie_chart.rb
169
+ - lib/tasks/chartify_tasks.rake
170
+ homepage: https://github.com/ashrafuzzaman/chartify
171
171
  licenses: []
172
172
  metadata: {}
173
173
  post_install_message:
@@ -1,3 +0,0 @@
1
- module Charter
2
- VERSION = "0.1.0"
3
- end