plot_simple 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,11 @@
6
6
  <lineColor><%=chart[:line_color]%></lineColor>
7
7
  <width><%= chart[:chart_width] %></width>
8
8
  <height><%= chart[:chart_height]%></height>
9
+ <% if !chart[:series_colors].blank? %>
10
+ <% chart[:series_colors].each do |col|%>
11
+ <seriesColor><%=col[:color]%></seriesColor>
12
+ <%end%>
13
+ <%end%>
9
14
  </grid>
10
15
  <backgroundImage><%= chart[:background_image]%></backgroundImage>
11
16
  <% chart[:categories].each do |cat| %>
@@ -1,11 +1,19 @@
1
1
  module PlotSimple
2
2
  require 'engine' if defined?(Rails)
3
3
  module Charts
4
+
5
+ def newPieChart
6
+ @chart = Hash[:pie=>true]
7
+ @chart.merge!(:categories=>[])
8
+ @chart.merge!(:pointLabels=>[])
9
+ end
10
+
4
11
  def newBarChart
5
12
  @chart = Hash[]
6
13
  @chart.merge!(:categories=>[])
7
14
  #following line is to avoid URLS from being shown for point labels
8
15
  @chart.merge!(:pointLabels=>[])
16
+ @chart.merge!(:series_colors=>[])
9
17
  end
10
18
 
11
19
  def setTitle(title)
@@ -41,9 +49,18 @@ module PlotSimple
41
49
  @chart[:pointLabels] << size
42
50
  end
43
51
 
52
+ def addSeriesColor(color)
53
+ color = Hash[:color=>color]
54
+ @chart[:series_colors] << color
55
+ end
56
+
44
57
  def renderXML(chart = nil)
45
58
  chart ||= @chart
59
+ if !chart[:pie]
46
60
  render :partial=>"plot_simple/chartxml",:locals=>{:chart=>chart}
61
+ else
62
+ render :partial=>"plot_simple/piechartxml",:locals=>{:chart=>chart}
63
+ end
47
64
  end
48
65
 
49
66
  end
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{plot_simple}
3
- s.version = "0.1.2"
3
+ s.version = "0.1.3"
4
4
 
5
5
  s.required_ruby_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = %q{Travis Pessetto}
7
- s.date = %q{2012-07-23}
7
+ s.date = %q{2012-07-27}
8
8
  s.description = %q{A graphing engine for jqplot}
9
9
  s.email = %q{travis.pessetto@es3inc.com}
10
10
  s.extra_rdoc_files = [%q{README.md}, %q{lib/plot_simple.rb}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plot_simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-23 00:00:00.000000000 Z
12
+ date: 2012-07-27 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A graphing engine for jqplot
15
15
  email: travis.pessetto@es3inc.com