File: split.tex

package info (click to toggle)
libchart-perl 2.4.1-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,804 kB
  • ctags: 370
  • sloc: perl: 9,120; makefile: 532
file content (106 lines) | stat: -rwxr-xr-x 3,798 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
%
% split.tex
%
\section{Chart::Split}
\name{Chart::Split}
\file{Split.pm}
\requires{Chart::Base, GD, Carp, FileHandle}
\begin{Description} 
\class{Split} is a subclass of class \class{Chart::Base}.\\
The class \class{Split} creates a lines chart. 
Split makes always an xy-plot, which means that both axes are numeric. 
The x-axis will be split in several parts of a same interval (option 'interval' has to be set!).
These intervals will be drawn one upon the other. 
The top interval starts at the start point, 
which has to be set by the programmer (option 'start'). \\
The first passed dataset are the x coordinates. 
The following added sets are the y coordinates of the sets.\\
Split draws only positive x-coordinates.\\
The y-axis is a numbering of the intervals.\\
The Split module is useful if you have a lot of data points to plot. An example is to plot
weather or seismic data.
\end{Description}

\parindent 0pt{\large Example:} 

\begin{figure}[h]
	\begin{center}
		\includegraphics[width = 10cm, height =10cm]{stunde.png}
	\end{center}
	\caption{Split chart}
	\label{fig:split}
\end{figure}
\begin{verbatim}
use Chart::Split;

$g = Chart::Split->new(650 ,900);

#get the data that are in a file and push them in arrays
open( FILE , "data.dat") or die 'Can't open the data file!\n';
while (defined ($line = <FILE>) ) {
  ($x, $y,) = unpack("a11 x1 a8" , $line);
   push (@y, $y);
   push (@x, $x);
}
close (FILE);

#add the data
$g->add_dataset(@x);
$g->add_dataset(@y);

#set the options
$g->set('xy_plot' => 'true');
$g->set('legend' => 'none');
$g->set('title' => 'Split Demo');
$g->set('interval' => 1/288);
$g->set('interval_ticks' => 10);
$g->set('start' => 260.5);
$g->set('brush_size' => 1);
$g->set('precision' => 4);
$g->set('y_label' => '5 minutes interval');

#give me a nice picture
$g->png("split.png");
\end{verbatim}

\begin{Constructor} 
An instance of a split chart object can be created with the constructor \textit{new()}:
\begin{quote}
\fett{\$obj = Chart::Split->new();}\\
\fett{\$obj = Chart::Split->new(\parameter{width}, \parameter{height});}
\end{quote}

If \textit{new()} has no arguments, 
the constructor returns an image with the size 300x400 pixels. If new has two arguments 
\parameter{width} and \parameter{height}, it returns an image with the desired size.
\end{Constructor}

\Methods
All universal valid methods, see page \pageref{methods} of class
\class{Chart::Base}.\\[\parabstand]
%
\Attributes
All universal valid options, see page \pageref{options}. 
Also available, these special options:
\begin{description}
\item['start'] \emph{Required} value for a split chart. \\
               If the x coordinate of the first data point is zero, 
               you should set start to zero. 
               Sets the start value of the first interval. Defaults to undef.
               
\item['interval'] \emph{Required} value of a split chart.\\
                Sets the interval of one line to plot. Defaults to undef.
                
\item['interval\_ticks'] Sets the number of ticks for the x-axis. Defaults to 5.

\item['scale'] Every y-value of a split chart will be multiplied by that value, 
               but the scale won't be changed. This means you may overdraw certain rows! 
               Only useful if you want to give prominence to the maximal amplitudes of the data.
               Defaults to 1.
               
\item['sort'] Sorts the data ascending if set to 'true'. 
              Should be set if the added data isn't sorted. Defaults to 'false'.  
              
\item['y\_axes'] Tells chart where to place the y-axis. 
                 Valid values are 'left', 'right' and 'both'. Defaults to 'left'.
\end{description}