File: Pie.tex

package info (click to toggle)
libchart-perl 2.4.10ds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,900 kB
  • ctags: 245
  • sloc: perl: 11,697; makefile: 6
file content (78 lines) | stat: -rw-r--r-- 2,446 bytes parent folder | download | duplicates (4)
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
%
% pie.tex
%
\renewcommand{\thisname}{Chart::Pie}
\section{\thisname}
\name{\thisname}
\file{Pie.pm}
\requires{Chart::Base, GD, Carp, FileHandle}
\begin{Description}
The class \thisclass creates a pie chart. The first added set must
contain the labels, the second set the values. \thisclass is a subclass
of \class{Chart::Base}.
\end{Description}

\example
\begin{figure}[ht]
  \begin{center}
    \includegraphics[scale = 0.6]{d_pie3.png}
  \end{center}
  \caption{Pie chart}
  \label{fig:pie}
\end{figure}
\begin{verbatim}
use Chart::Pie;

$g = Chart::Pie->new();

$g->add_dataset('Har', 'Sug', 'Ert', 'Her', 'Tar', 'Kure');
$g->add_dataset(12000, 20000 , 13000, 15000, 9000, 11000  );

%opt = ('title'        => 'Another Pie Demo Chart',
        'label_values' => 'both',
        'legend'       => 'none',
        'text_space'   => 10,
        'png_border'   => 1,
        'graph_border' => 0,
        'colors' => { 'x_label'    => 'red',
                      'misc'       => 'plum',
                      'background' => 'grey',
                      'dataset0'   => [120, 0, 255],
                      'dataset1'   => [120, 100, 255],
                      'dataset2'   => [120, 200, 255],
                      'dataset3'   => [255, 100, 0],
                      'dataset4'   => [255, 50, 0],
                      'dataset5'   => [255, 0, 0],
                    },
        'x_label'      => 'The Winner is Team Blue!',
       );

$g->set(%opt);

$g->png("pie.png");
\end{verbatim}

\constructorblurb{\thisname}

\begin{AttrDecl}{label\_values}
Tells \thisclass what kind of value labels to show alongside the pie.
Valid values are \literal{percent}, \literal{value}, \literal{both} and
\literal{none}. Defaults to \literal{percent}.
\end{AttrDecl}

\begin{AttrDecl}{legend\_label\_values}
Tells \thisclass what kind of labels to show in the legend. Valid values
are \literal{percent}, \literal{value}, \literal{both} and
\literal{none}. Defaults to \literal{value}.
\end{AttrDecl}

\begin{AttrDecl}{legend\_lines}
The labels drawn alongside the pie are connected with a line to the
segment if this option is set to \literal{true}.
\end{AttrDecl}

\begin{AttrDecl}{ring}
The pie can have a ring shape instead of the usual disc shape. This
option determines the thickness of the ring as a fraction of the radius.
Default is 1, \ie, a full pie.
\end{AttrDecl}