flotr 1.3.9 → 1.3.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,7 @@ cos = Flotr::Data.new(:label => "Cos(x)", :color => "blue")
15
15
  end
16
16
 
17
17
  plot = Flotr::Plot.new("Test plot")
18
+ plot.output_file = "SinCos.html"
18
19
  plot.comment = "This is a test plot made with Flotr"
19
20
  plot.options = {:legend_position => "ne", :points => 'true'}
20
21
  plot.height = 480
@@ -77,7 +77,7 @@ module Flotr
77
77
  plot file Flotr::OUTPUT_FILE.
78
78
  =end
79
79
  class Plot
80
- attr_accessor :series, :title, :comment, :template, :options
80
+ attr_accessor :series, :title, :comment, :template, :options, :output_file
81
81
  attr_accessor :width, :height
82
82
  attr_accessor :label, :xlim, :ylim
83
83
 
@@ -92,6 +92,7 @@ module Flotr
92
92
  @options = {}
93
93
  @width, @height = 600, 300
94
94
  @label = @xlim = @ylim = {}
95
+ @output_file = OUTPUT_FILE
95
96
  end
96
97
 
97
98
  =begin rdoc
@@ -130,7 +131,7 @@ module Flotr
130
131
  =end
131
132
  def save
132
133
  eruby = Erubis::Eruby.new(File.read(@template))
133
- File.open(OUTPUT_FILE, 'w') do |f|
134
+ File.open(@output_file, 'w') do |f|
134
135
  f.print eruby.result(binding())
135
136
  end
136
137
  end
@@ -141,11 +142,11 @@ module Flotr
141
142
  self.save
142
143
  case RUBY_PLATFORM
143
144
  when /darwin/
144
- system "open \"#{OUTPUT_FILE}\""
145
+ system "open \"#{@output_file}\""
145
146
  when /mswin/
146
- system "start #{OUTPUT_FILE}"
147
+ system "start #{@output_file}"
147
148
  else
148
- puts "open #{OUTPUT_FILE} in your preferred browser"
149
+ puts "open #{@output_file} in your preferred browser"
149
150
  end
150
151
  end
151
152
 
@@ -10,13 +10,6 @@
10
10
  <script type="text/javascript">
11
11
  $(document).ready( function() {
12
12
  // setup plot
13
- function getData( x1, x2 ) {
14
- var d = [];
15
- for( var i = x1; i < x2; i += ( x2 - x1 ) / 100 ) {
16
- d.push( [ i, Math.sin( i * Math.sin( i ) ) ] );
17
- }
18
- return [ { label: 'sin(x sin(x))', data: d } ];
19
- }
20
13
 
21
14
  var options = {
22
15
  legend: { <%= @options[:legend_position] ? "position: '#{@options[:legend_position]}'": 'show: false'%> },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flotr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Bosetti
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-04 00:00:00 +02:00
12
+ date: 2009-11-04 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency