a_la_chart 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -3,13 +3,20 @@ MIT-LICENSE
3
3
  Manifest.txt
4
4
  README.rdoc
5
5
  Rakefile
6
- configs/fusion/3.0/angular.xml.builder
7
- configs/fusion/3.0/bar.xml.builder
8
- configs/fusion/3.0/column.xml.builder
9
- configs/fusion/3.0/inline.html.erb
10
- configs/fusion/3.0/line.xml.builder
11
- configs/fusion/3.0/pie.xml.builder
12
- configs/fusion/3.0/stacked_column.xml.builder
6
+ configs/fusion/3.1/angular.xml.builder
7
+ configs/fusion/3.1/bar.xml.builder
8
+ configs/fusion/3.1/bullet.xml.builder
9
+ configs/fusion/3.1/column.xml.builder
10
+ configs/fusion/3.1/funnel.xml.builder
11
+ configs/fusion/3.1/inline.html.erb
12
+ configs/fusion/3.1/line.xml.builder
13
+ configs/fusion/3.1/pie.xml.builder
14
+ configs/fusion/3.1/pyramid.xml.builder
15
+ configs/fusion/3.1/remote.html.erb
16
+ configs/fusion/3.1/spark_column.xml.builder
17
+ configs/fusion/3.1/spark_line.xml.builder
18
+ configs/fusion/3.1/spark_win_loss.xml.builder
19
+ configs/fusion/3.1/stacked_column.xml.builder
13
20
  configs/fusion/config.yml
14
21
  configs/google/1.0/pie.html.erb
15
22
  configs/google/config.yml
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ xml.instruct!
2
+ xml.chart(chart_options.merge(:upperLimit => params[:upperLimit] || 100, :caption => params[:title])) do
3
+ the_case = params[:case]
4
+ xml.colorRange do
5
+ xml.color :minValue => '0', :maxValue => '2', :code => 'FF654F'
6
+ xml.color :minValue => '2', :maxValue => '4', :code => 'F6BD0F'
7
+ xml.color :minValue => '4', :maxValue => '5', :code => '8BBA00'
8
+ end
9
+ xml.value do
10
+ value(data, :value, the_case)
11
+ end
12
+ xml.target do
13
+ value(data, :target, the_case)
14
+ end
15
+ end
File without changes
@@ -0,0 +1,27 @@
1
+ <%
2
+ require 'builder'
3
+ chart_type = chart_type_config['chart_type']
4
+ chart_type = chart_style.to_s if chart_type.blank?
5
+
6
+ chart_type = args[:vertical] ? chart_type_config['vertical'] || chart_type : chart_type
7
+ chart_type = args[:dimensions] == 3 ? chart_type_config['3d'] || chart_type : chart_type
8
+
9
+ set_chart(chart_style)
10
+
11
+ # TODO: create a seperate 'params' override
12
+ params[:case] = args[:case]
13
+ params[:title] = args[:title]
14
+ %>
15
+ <div>
16
+ <fusioncharts id="<%= div_id %>"
17
+ chartType="<%= chart_type %>"
18
+ swfPath="/FusionCharts/"
19
+ width="<%= width %>"
20
+ height="<%= height %>"
21
+ registerWithJS="1"
22
+ debugMode="0">
23
+ <data><!--[CDATA[
24
+ <%= render :file => data_template %>
25
+ ]]--></data>
26
+ </fusioncharts>
27
+ </div>
File without changes
@@ -0,0 +1,7 @@
1
+ xml.instruct!
2
+ xml.chart(chart_options.merge(:caption => params[:title])) do
3
+ the_case = params[:case]
4
+ data(the_case).each do |record|
5
+ xml.set :value => value(record, :value, the_case), :label => value(record, :label, the_case), :link => value(record, :link, the_case), :color => next_color
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ xml.instruct!
2
+ xml.chart(chart_options.merge(:caption => params[:title])) do
3
+ the_case = params[:case]
4
+ data(the_case).each do |record|
5
+ xml.set :value => value(record, :value, the_case), :label => value(record, :label, the_case), :link => value(record, :link, the_case), :color => next_color
6
+ end
7
+ end
@@ -1,3 +1,10 @@
1
+ <%
2
+ chart_type = chart_type_config['chart_type']
3
+ chart_type = chart_style.to_s if chart_type.blank?
4
+
5
+ chart_type = args[:vertical] ? chart_type_config['vertical'] || chart_type : chart_type
6
+ chart_type = args[:dimensions] == 3 ? chart_type_config['3d'] || chart_type : chart_type
7
+ %>
1
8
  <div>
2
9
  <fusioncharts id="<%= div_id %>"
3
10
  chartType="<%= chart_type %>"
@@ -0,0 +1,9 @@
1
+ xml.instruct!
2
+ xml.chart(chart_options.merge(:caption => params[:title])) do
3
+ the_case = params[:case]
4
+ xml.dataset do
5
+ data(the_case).each do |record|
6
+ xml.set :value => value(record, :value, the_case)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ xml.instruct!
2
+ xml.chart(chart_options.merge(:caption => params[:title])) do
3
+ the_case = params[:case]
4
+ xml.dataset do
5
+ data(the_case).each do |record|
6
+ xml.set :value => value(record, :value, the_case)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ xml.instruct!
2
+ xml.chart(chart_options.merge(:caption => params[:title])) do
3
+ the_case = params[:case]
4
+ xml.dataset do
5
+ data(the_case).each do |record|
6
+ xml.set :value => value(record, :value, the_case), :label => value(record, :label, the_case), :scoreless => value(record, :scoreless, the_case), :color => next_color
7
+ end
8
+ end
9
+ end
@@ -1,27 +1,69 @@
1
- default: 3.0
2
- 3.0:
1
+ default: 3.1
2
+ 3.1:
3
3
  format: xml
4
4
  angular:
5
5
  data: 'angular.xml.builder'
6
6
  chart_type: AngularGauge
7
+ remote: 'remote.html.erb'
7
8
  inline: 'inline.html.erb'
8
9
  bar:
9
10
  data: 'bar.xml.builder'
10
11
  chart_type: Bar2D
12
+ 3d: Bar3D
13
+ remote: 'remote.html.erb'
14
+ inline: 'inline.html.erb'
15
+ bullet:
16
+ data: 'bullet.xml.builder'
17
+ chart_type: HBullet
18
+ vertical: VBullet
19
+ remote: 'remote.html.erb'
11
20
  inline: 'inline.html.erb'
12
21
  column:
13
22
  data: 'column.xml.builder'
14
23
  chart_type: Column2D
24
+ 3d: Column3D
25
+ remote: 'remote.html.erb'
15
26
  inline: 'inline.html.erb'
16
27
  line:
17
28
  data: 'line.xml.builder'
18
29
  chart_type: Line2D
30
+ 3d: Line3D
31
+ remote: 'remote.html.erb'
19
32
  inline: 'inline.html.erb'
20
33
  pie:
21
34
  data: 'pie.xml.builder'
22
35
  chart_type: Pie2D
36
+ 3d: Pie3D
37
+ remote: 'remote.html.erb'
23
38
  inline: 'inline.html.erb'
24
39
  stacked_column:
25
40
  data: 'stacked_column.xml.builder'
26
41
  chart_type: StackedColumn2D
42
+ 3d: StackedColumn3D
43
+ remote: 'remote.html.erb'
44
+ inline: 'inline.html.erb'
45
+ spark_line:
46
+ data: 'spark_line.xml.builder'
47
+ chart_type: SparkLine
48
+ remote: 'remote.html.erb'
49
+ inline: 'inline.html.erb'
50
+ spark_column:
51
+ data: 'spark_column.xml.builder'
52
+ chart_type: SparkColumn
53
+ remote: 'remote.html.erb'
54
+ inline: 'inline.html.erb'
55
+ spark_win_loss:
56
+ data: 'spark_win_loss.xml.builder'
57
+ chart_type: SparkWL
58
+ remote: 'remote.html.erb'
59
+ inline: 'inline.html.erb'
60
+ pyramid:
61
+ data: 'pyramid.xml.builder'
62
+ chart_type: Pyramid
63
+ remote: 'remote.html.erb'
64
+ inline: 'inline.html.erb'
65
+ funnel:
66
+ data: 'funnel.xml.builder'
67
+ chart_type: Funnel
68
+ remote: 'remote.html.erb'
27
69
  inline: 'inline.html.erb'
@@ -3,17 +3,19 @@ module ALaChart
3
3
  module HelperMethods
4
4
  def meta(the_case=nil)
5
5
  if the_case.blank?
6
+ # (@metadata ||= {})['_'] ||= defined?(get_meta) ? get_meta : {}
6
7
  @metadata ||= defined?(get_meta) ? get_meta : {}
7
8
  else
9
+ # (@metadata ||= {})[the_case] ||= respond_to?("get_meta_#{the_case.to_s}") ? send("get_meta_#{the_case.to_s}") : []
8
10
  @metadata ||= respond_to?("get_meta_#{the_case.to_s}") ? send("get_meta_#{the_case.to_s}") : []
9
11
  end
10
12
  end
11
13
 
12
14
  def data(the_case=nil)
13
15
  if the_case.blank?
14
- @data ||= defined?(get_data) ? get_data : []
16
+ (@data ||= {})['_'] ||= defined?(get_data) ? get_data : []
15
17
  else
16
- @data ||= respond_to?("get_data_#{the_case.to_s}") ? send("get_data_#{the_case.to_s}") : []
18
+ (@data ||= {})[the_case] ||= respond_to?("get_data_#{the_case.to_s}") ? send("get_data_#{the_case.to_s}") : []
17
19
  end
18
20
  end
19
21
 
@@ -130,7 +132,7 @@ module ALaChart
130
132
  end
131
133
  end
132
134
  end
133
-
135
+
134
136
  def data(*attrs, &block)
135
137
  if attrs.size == 1
136
138
  attrs = attrs[0]
@@ -16,9 +16,10 @@ module ALaChartHelper
16
16
 
17
17
  chart_type_config = chart_make_config[chart_style.to_s]
18
18
  raise "#{chart_style.to_s} is an unsupported chart style" if chart_type_config.blank?
19
- chart_type = chart_type_config['chart_type']
20
- chart_type = chart_style.to_s if chart_type.blank?
21
19
  inline_template = chart_type_config['inline']
20
+ remote_template = chart_type_config['remote']
21
+
22
+ template = args[:inline] ? inline_template : remote_template || inline_template
22
23
 
23
24
  data_format = chart_type_config['format'] || chart_make_config['format']
24
25
 
@@ -37,7 +38,10 @@ module ALaChartHelper
37
38
 
38
39
  div_id = "#{name}_#{Time.now.to_f.to_s.gsub('.','_')}"
39
40
 
40
- inline = ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'configs', chart_make.to_s, chart_make_version.to_s, inline_template)))
41
+ data_template = chart_type_config['data']
42
+ data_template = File.join(File.dirname(__FILE__), '..', '..', 'configs', chart_make.to_s, chart_make_version.to_s, data_template) if data_template.present?
43
+
44
+ inline = ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'configs', chart_make.to_s, chart_make_version.to_s, template)))
41
45
  inline.result(binding)
42
46
  end
43
47
 
data/lib/a_la_chart.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module ALaChart
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
4
4
 
5
5
  require File.join(File.dirname(__FILE__), 'a_la_chart', 'a_la_chart')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a_la_chart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Redmond
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-24 00:00:00 -05:00
12
+ date: 2009-12-28 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -38,13 +38,20 @@ files:
38
38
  - Manifest.txt
39
39
  - README.rdoc
40
40
  - Rakefile
41
- - configs/fusion/3.0/angular.xml.builder
42
- - configs/fusion/3.0/bar.xml.builder
43
- - configs/fusion/3.0/column.xml.builder
44
- - configs/fusion/3.0/inline.html.erb
45
- - configs/fusion/3.0/line.xml.builder
46
- - configs/fusion/3.0/pie.xml.builder
47
- - configs/fusion/3.0/stacked_column.xml.builder
41
+ - configs/fusion/3.1/angular.xml.builder
42
+ - configs/fusion/3.1/bar.xml.builder
43
+ - configs/fusion/3.1/bullet.xml.builder
44
+ - configs/fusion/3.1/column.xml.builder
45
+ - configs/fusion/3.1/funnel.xml.builder
46
+ - configs/fusion/3.1/inline.html.erb
47
+ - configs/fusion/3.1/line.xml.builder
48
+ - configs/fusion/3.1/pie.xml.builder
49
+ - configs/fusion/3.1/pyramid.xml.builder
50
+ - configs/fusion/3.1/remote.html.erb
51
+ - configs/fusion/3.1/spark_column.xml.builder
52
+ - configs/fusion/3.1/spark_line.xml.builder
53
+ - configs/fusion/3.1/spark_win_loss.xml.builder
54
+ - configs/fusion/3.1/stacked_column.xml.builder
48
55
  - configs/fusion/config.yml
49
56
  - configs/google/1.0/pie.html.erb
50
57
  - configs/google/config.yml