summaryrefslogtreecommitdiff
path: root/doc/user/pie.skb
blob: 70fa08d639a38e4a9e87d2d4305fde05ff3ab3b8 (about) (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
;;; pie.skb  --  Pie charts.
;;;
;;; Copyright 2006, 2009  Ludovic Court�s <ludovic.courtes@laas.fr>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;; USA.

;;; FIXME: This is a stub and must be completed!

(chapter :title [Pie Charts] :ident "pie-charts"

   (p [Skribilo contains a pie-chart formatting package, located in the
,(tt [(skribilo package pie)]) module.  It allows users to produces
represent numeric data as pie charts as in the following example:]

	(disp (pie :title [Use of Document Formatting Systems]
	           :fingers? #t :labels 'outside
	           :initial-angle 90
	           :ident "pie-skribilo-rulez"
                 (slice :weight 10 :color "red" :detach? #t
                   (bold [Skribilo]))
                 (slice :weight  6 :color "green"     "Skribe")
                 (slice :weight  6 :color "blue"      "Lout")
                 (slice :weight  4 :color "lightgrey" "LaTeX")
                 (slice :weight  2 :color "yellow"    "Docbook")
                 (slice :weight  1 :color "black"     "others"))))

   (p [A default implementation, which uses ,(ref :text [Ploticus] :url
"http://ploticus.sf.net") as an external program, is available for all
engines.  There is also a specific implementation for the Lout engine
which relies on Lout's own pie-chart package.  In the latter case, you
don't need to have Ploticus installed, but you need it in the former.])
   (p [Currently it only supports slice-coloring, but support for
textures (particularly useful for black & white printouts) could be
added in the future.])
   
   (section :title [Syntax]
            :info-node [Pie Syntax]
      
      (p [Let us start with a simple example:]
	
	(example-produce
	  (example :legend "Example of a pie chart"
	     (prgm :file "src/pie1.skb"))
	  (disp (include "src/pie1.skb"))))
      
      (p [This illustrates the three markups provided by the ,(tt [pie])
package, namely ,(tt [pie]), ,(tt [slice]), and ,(tt [sliceweight]).
This last markup returns the weight of the slice it is used in, be it as
a percentage or an absolute value.  Note that the ,(tt [:total]) option
of ,(tt [pie]) can be used to create pie charts no entirely filled.])
      (p [Various options allow the pie layout to be controlled:]
	
	(example-produce
	  (example :legend "Specifying the layout of a pie chart"
	     (prgm :file "src/pie2.skb"))
	  (disp (include "src/pie2.skb"))))
   
      (p [The available markups and their options are described below.])
      
      (doc-markup 'pie
      		  `((:title         ,[The title of the pie chart.])
		    (:initial-angle ,[The initial angle of the pie, in degrees.])
		    (:total         ,[If a number, specifies the
"weight" of the whole pie; in this case, if the pie's slices don't add
up to that number, then part of the pie is shown as empty.  If ,(code
[#f]), the total that is used is the sum of the weight of each slice.])
                    (:radius        ,[The pie's radius.  How this value
is interpreted depends on the engine used.])
                    (:fingers?      ,[Indicates whether to add "fingers"
(arrows) from labels to slices when labels are outside of slices.])
	            (:labels        ,[A symbol indicating where slice
labels are rendered: ,(code [outside]) to have them appear outside of
the pie, ,(code [inside]) to have them appear inside the pie, and ,(code
[legend]) to have them appear in a separate legend.]))
	           :source "skribilo/package/pie.scm"
		   :see-also '(slice))
      
      (doc-markup 'slice
      		  `((#!rest label ,[The label of the node.  It can
contain arbitrary markup, notably instances of ,(markup-ref
"sliceweight").  However, some engines, such as the Ploticus-based
rendering, are not able to render markup other than ,(markup-ref
"sliceweight"); consequently, they render the label as though it were
markup-free.])
		    (:weight      ,[An integer indicating the weight of this
slice.])
	            (:color       ,[The background color of the slice.])
		    (:detach?     ,[Indicates whether the slice should be
detached from the pie.]))
	           :source "skribilo/package/pie.scm"
		   :see-also '(pie sliceweight))
      
      (p [As seen in the examples above, the body of a ,(markup-ref
"slice") markup can contain instances of ,(markup-ref "sliceweight") to
represent the weight of the slice:])
      
      (doc-markup 'sliceweight
            	  `((:percentage? ,[Indicates whether the slice's weight
should be shown as a percentage of the total pie weight or as a raw
weight.]))
	           :see-also '(slice)
		   :source "skribilo/package/pie.scm")))
      

;; Local Variables:
;; coding: latin-1
;; ispell-local-dictionary: "american"
;; End: