File: linespoints.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 (108 lines) | stat: -rwxr-xr-x 3,768 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
107
108
%
% linespoints.tex
%
\section{Chart::LinesPoints}
\name{Chart::LinesPoints}
\file{LinesPoints.pm}
\requires{Chart::Base, GD, Carp, FileHandle}
\begin{Description} 
\class{LinesPoints} is a subclass of \class{Chart::Base}.
The class \class{LinesPoints} creates a lines chart with points marking the 
individual koordinates of the data.
\end{Description}

\parindent 0pt{\large Example:}

\begin{figure}[h]
	\begin{center}
		\includegraphics[scale=0.6]{d_linesp2.png}
	\end{center}
	\caption{Linespoints chart}
	\label{fig:d_linesp2}
\end{figure}
\begin{verbatim}
use Chart::LinesPoints;
use strict;

my (@data1, @data2, @data4, @data3, @labels, %hash, $g);

@labels = qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17);
@data1 = qw (-7 -5 -6 -8 -9 -7 -5 -4 -3 -2 -4 -6 -3 -5 -3 -4 -6);
@data2 = qw (-1 -1 -1 -1 -2 -2 -3 -3 -4 -4 -6 -3 -2 -2 -2 -1 -1);
@data3 = qw (-4 -4 -3 -2 -1 -1 -1 -2 -1 -1 -3 -2 -4 -3 -4 -2 -2);
@data4 = qw (-6 -3 -2 -3 -3 -3 -2 -1 -2 -3 -1 -1 -1 -1 -1 -3 -3);

$g = Chart::LinesPoints->new(600,300);
$g->add_dataset(@labels);
$g->add_dataset(@data1);
$g->add_dataset(@data2);
$g->add_dataset(@data3);
$g->add_dataset(@data4);

%hash =(
          'integer_ticks_only' => 'true',
          'title' => 'Soccer Season 2002\n ',
          'legend_labels' => ['NY Soccer Club', 'Denver Tigers',
                              'Houston Spacecats', 'Washington Presidents'],
          'y_label' => 'position in the table',
          'x_label' => 'day of play',
          'grid_lines' => 'true',
          'f_y_tick' => \&formatter,
          );

$g->set ( %hash);
$g->png ("Grafiken/d_linesp2.png");

#just a trick, to let the y scale start at the biggest point:
#initiate with negative values, remove the minus sign!
sub formatter {
  my $label = shift;
  $label = substr($label, 1,2);
  return $label;
}

\end{verbatim}

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

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

\Methods
\method{All universal valid methods, see page \pageref{methods} of \class{Chart::Base}.} \\[\parabstand]
%
\Attributes
All universal valid options, see page \pageref{options}. 
Also available these special options:
\begin{description}
\item['y\_axes'] Tells chart where to place the y-axis. 
     Valid values are 'left', 'right' and 'both'. Defaults to 'left'.

\item['pt\_size'] Sets the radius of the points in pixels. Default is 18.

\item['brush\_size'] Sets the width of the lines in pixels. Default is 6.

\item['xy\_plot'] Forces Chart to plot a x-y-graph, 
                  which means that the x-axis is also numeric if set to 'true'. 
                  Very useful for plots of mathematical functions. Defaults to 'false'.

\item['sort'] Sorts the data of a x-y-graph ascending if set to 'true'. 
              Should be set if the added data isn't sorted. Defaults to 'false'.  
              
\item['stepline'] The points are connected by a stepping function,
                  instead by a direct line if set to 'true'. 
                  Defaults to 'false'.   

\item['stepline\_mode'] Determine whether to start with the first point
                    (if set to 'begin') or end with the last point if set to 'end'.
                    Defaults to 'begin'.   
\end{description}