pbosetti-flotr 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Paolo Bosetti on 2009-04-27.
4
+ # Copyright (c) 2009 University of Trento. All rights
5
+ # reserved.
6
+
7
+ require "../lib/flotr"
8
+
9
+ sin = Flotr::Data.new(:label => "Sin(x)", :color => "red")
10
+ cos = Flotr::Data.new(:label => "Cos(x)", :color => "blue")
11
+
12
+ 100.times do |i|
13
+ cos.data << [i, Math::cos(Math::PI / 100 * i)]
14
+ sin.data << [i, Math::sin(Math::PI / 100 * i)]
15
+ end
16
+
17
+ plot = Flotr::Plot.new("Test plot")
18
+ plot.comment = "This is a test plot made with Flotr"
19
+ plot.options = {:legend_position => "ne", :points => 'true'}
20
+ plot.height = 480
21
+ plot.width = 640
22
+ plot.label = {:X => "X"} # :Y label seems not working on Safari
23
+ plot.ylim = {:min=> -1.5, :max => 1.5}
24
+ plot << sin
25
+ plot << cos
26
+ plot.show