a_la_chart 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ xml.chart(chart_options(:fusion, :line).merge(:caption => params[:title])) do
2
+ the_case = params[:case]
3
+ xml.categories do
4
+ data(the_case).map{|record| value(record, :label, the_case) }.uniq.compact.each do |label|
5
+ xml.category :label => label
6
+ end
7
+ end
8
+ data_by_category = {}
9
+ data(the_case).each do |record|
10
+ (data_by_category[value(record, :category, the_case)] ||= []) << record
11
+ end
12
+ data_by_category.keys.sort.each do |category|
13
+ records = data_by_category[category]
14
+ xml.dataset(:seriesName => category, :color => value(records.first, :color, the_case) || color_palette_next(:fusion, :stacked_column)) do
15
+ records.each do |record|
16
+ xml.set :value => value(record, :value, the_case), :toolText => "#{value(record, :category, the_case)}: #{'%0.2f' % value(record, :value, the_case)}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ # <chart showValues='0' numberPrefix='$' decimals='3' setAdaptiveYMin='1' setAdaptiveSYMin='1' lineThickness='5'>
23
+ # <categories>
24
+ # <category name='Oct 2009'></category>
25
+ # <category name='Nov 2009'></category>
26
+ # <category name='Dec 2009'></category>
27
+ # <category name='Jan 2010'></category>
28
+ # </categories>
29
+ # <dataset seriesname='Spend' renderAs='Line'>
30
+ # <set value='46148'></set>
31
+ # <set value='44158'></set>
32
+ # <set value='43214'></set>
33
+ # <set value='25560'></set>
34
+ # </dataset>
35
+ # <dataset parentYAxis='S' seriesname='Lines' renderAs='Line'>
36
+ # <set value='436'></set>
37
+ # <set value='447'></set>
38
+ # <set value='485'></set>
39
+ # <set value='468'></set>
40
+ # </dataset>
41
+ # </chart>
42
+
43
+
44
+ # xml.chart(chart_options(:fusion, :line).merge(:caption => params[:title])) do
45
+ # the_case = params[:case]
46
+ # xml.dataset do |dataset|
47
+ # data(the_case).each do |set|
48
+ # xml.set :value => set
49
+ # end
50
+ # end
51
+ # end
@@ -11,6 +11,7 @@
11
11
  # TODO: create a seperate 'params' override
12
12
  params[:case] = args[:case]
13
13
  params[:title] = args[:title]
14
+ params[:co] = args[:co] #params.merge!(args)
14
15
  %>
15
16
  <div>
16
17
  <fusioncharts chartId="<%= div_id %>"
@@ -1,6 +1,3 @@
1
- # module ALaChart
2
- # VERSION = '0.1.9'
3
- # end
4
1
  module ALAChart
5
2
  autoload :VERSION, 'a_la_chart/version'
6
3
  end
@@ -77,13 +77,15 @@ module ALaChartHelper
77
77
 
78
78
  def decode_options(options_str)
79
79
  hash = Hash[ *(options_str.to_s.split(/[|~]/)) ]
80
+ converted = {}
80
81
  hash.each{|k,v|
81
- val = hash.delete(k)
82
- if val && k.class == String && !k.blank?
83
- hash[CGI::unescape(k).to_sym] = CGI::unescape(val.to_s)
82
+ if v && k.class == String && !k.blank?
83
+ converted[CGI::unescape(k).to_sym] = CGI::unescape(v.to_s)
84
+ else
85
+ converted[k] = v
84
86
  end
85
87
  }
86
- hash
88
+ converted
87
89
  end
88
90
 
89
91
  def color_palette(chart_make, chart_style=nil)
@@ -1,3 +1,3 @@
1
1
  module ALaChart
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a_la_chart
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 9
10
- version: 0.1.9
9
+ - 10
10
+ version: 0.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric Redmond
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-19 00:00:00 -04:00
18
+ date: 2010-10-25 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -73,6 +73,7 @@ files:
73
73
  - configs/fusion/v3_1/bar.xml.builder
74
74
  - configs/fusion/v3_1/bullet.xml.builder
75
75
  - configs/fusion/v3_1/column.xml.builder
76
+ - configs/fusion/v3_1/combi_dy_2d.xml.builder
76
77
  - configs/fusion/v3_1/funnel.xml.builder
77
78
  - configs/fusion/v3_1/inline.html.erb
78
79
  - configs/fusion/v3_1/line.xml.builder