pbosetti-flotr 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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