pbosetti-flotr 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +18 -6
- data/lib/flotr.rb +1 -1
- metadata +1 -1
data/README.markdown
CHANGED
@@ -4,11 +4,22 @@ Flotr (pron.: like "plotter") is a plot/chart facility to be used within Ruby.
|
|
4
4
|
|
5
5
|
It is intended to be as portable as possible, and is thus aimed to generate HTML plots thanks to the great [flot library](http://ryanfunduk.com/flot).
|
6
6
|
|
7
|
+
Installation
|
8
|
+
============
|
9
|
+
First, you have to be sure to have the Github repository added to your rubygems configuration. This step only has to be performed the first time you install a gem hosted on Github:
|
10
|
+
|
11
|
+
gem sources -a http://gems.github.com
|
12
|
+
|
13
|
+
Next, simply install the gem:
|
14
|
+
|
15
|
+
sudo gem install pbosetti-flotr
|
16
|
+
|
7
17
|
Usage
|
8
18
|
=====
|
9
|
-
The following code produces the flotr.html file located in the
|
19
|
+
The following code produces the `flotr.html` file located in the current folder:
|
10
20
|
|
11
|
-
require "
|
21
|
+
require "rubygems"
|
22
|
+
require "flotr"
|
12
23
|
# Create a new plot
|
13
24
|
plot = Flotr::Plot.new("Test plot")
|
14
25
|
|
@@ -25,15 +36,16 @@ The following code produces the flotr.html file located in the root project fold
|
|
25
36
|
plot << sin << cos
|
26
37
|
plot.show
|
27
38
|
|
28
|
-
At the moment, the Flotr::Plot.
|
39
|
+
At the moment, the `Flotr::Plot.show` method automatically opens the plot within a browser window under OS X and Windows. On other platforms (Linux) you have to open the generated file by hands.
|
29
40
|
|
30
41
|
The default template (since v1.3) allows zooming the plot. Reload the page to reset to full view.
|
31
42
|
|
32
43
|
Templates
|
33
44
|
=========
|
34
45
|
Flotr uses templates for formatting the plots. Currently there are the following templates available:
|
35
|
-
|
36
|
-
|
46
|
+
|
47
|
+
1. `interacting`: a simple layout that shows point coordinates on mouse hover
|
48
|
+
2. `zooming`: a smaller overview is added on the right side of the main plot, allowing zooming of different plot areas
|
37
49
|
|
38
50
|
The current template can be selected as follows (amongst those installed by default):
|
39
51
|
|
@@ -47,7 +59,7 @@ Custom templates can be selected this way:
|
|
47
59
|
|
48
60
|
p.template = "full/path/to/template.rhtml"
|
49
61
|
|
50
|
-
Look within lib/*.rhtml for template examples. Templates follow the Erubis syntax.
|
62
|
+
Look within `lib/*.rhtml` for template examples. Templates follow the Erubis syntax.
|
51
63
|
|
52
64
|
Example
|
53
65
|
=======
|
data/lib/flotr.rb
CHANGED