From c9157a3905fc17a70d36ec46db809efb91c14887 Mon Sep 17 00:00:00 2001
From: Ludovic Courtès
Date: Wed, 27 May 2009 21:27:54 +0200
Subject: pie: Choose saner defaults for Ploticus.

* src/guile/skribilo/package/pie.scm (ploticus-script)[radius]: Default
  to 2.5.
  [center]: Default to (6.25, 6.25).
  The latter allows pie charts to not be truncated, even in
  `line+label', provided RADIUS remains in the [0..4cm] range.
---
 NEWS                               |  1 +
 src/guile/skribilo/package/pie.scm | 27 +++++++++++----------------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/NEWS b/NEWS
index 96fcdb0..ca23411 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Previously, footnotes would not get printed in the case of chapters that
 are not output in a separate file.
 
 ** HTML engine: use ". " as the default chapter number-title separator
+** Improved rendering of pie charts with Ploticus
 ** New experimental `--enable-guile-vm' configure switch
 
 This allows compilation with the compiler of "Guile-VM", i.e., the
diff --git a/src/guile/skribilo/package/pie.scm b/src/guile/skribilo/package/pie.scm
index 0b0d622..f99c725 100644
--- a/src/guile/skribilo/package/pie.scm
+++ b/src/guile/skribilo/package/pie.scm
@@ -1,6 +1,6 @@
 ;;; pie.scm  --  An pie-chart formatting package.
 ;;;
-;;; Copyright 2005, 2006, 2007  Ludovic Court�s <ludovic.courtes@laas.fr>
+;;; Copyright 2005, 2006, 2007, 2009  Ludovic Court�s <ludo@gnu.org>
 ;;;
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
@@ -202,19 +202,9 @@ the string \"hello\".  Implement `sliceweight' markups too."
 
 	 (initial-angle (or (markup-option pie :initial-angle)
 			    0))
-	 (radius (or ;;FIXME
-		  (markup-option pie :radius) 3))
-	 (max-radius (+ radius (apply max detached)))
-
-	 ;; center coordinates must take into account (i) the
-	 ;; maxium radius when detached slices are considered and
-	 ;; (ii) the fact that labels may get displayed to the
-	 ;; left of the pie.
-	 ;; FIXME: labels to the left (ii) end up being truncated
-	 ;; when the radius is e.g. < 2.
-	 (center `(,(+ max-radius
-		       (* max-radius max-radius)) .
-		       ,(* max-radius max-radius))))
+	 (radius (or (markup-option pie :radius)
+                     ;; 2.5cm is the default used in `pie.pl'.
+                     2.5)))
 
     (string-concatenate
 	   (append (list "#proc getdata\n" "data: ")
@@ -233,8 +223,13 @@ the string \"hello\".  Implement `sliceweight' markups too."
 		     "datafield: " "1" "\n")
 		   `("firstslice: " ,(number->string initial-angle) "\n")
 		   `("radius: " ,(number->string radius) "\n")
-		   `("center: " ,(number->string (car center))
-		     " " ,(number->string (cdr center)) "\n")
+
+                   ;; This value is the default used in `pie.pl'.  It happens
+                   ;; to work well (at least in PNG output) for 1 < RADIUS < 4.
+                   ;; XXX: For RADIUS beyond that, the pie or labels are
+                   ;; often truncated.
+		   `("center: 6.25 6.25\n")
+
 		   `("labelmode: "
 		     ,(case (markup-option
 			     pie :labels)
-- 
cgit v1.2.3