You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(12) |
Dec
(11) |
|---|
|
From: Ariel G. <ag...@us...> - 2001-10-25 18:47:16
|
Update of /cvsroot/vagrant/vagrant
In directory usw-pr-cvs1:/tmp/cvs-serv18791
Modified Files:
VAGRANT.class
Log Message:
Fixed how the legend was being placed. Sometimes it was appearing incorrectly
too far down in the image.
Index: VAGRANT.class
===================================================================
RCS file: /cvsroot/vagrant/vagrant/VAGRANT.class,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** VAGRANT.class 2001/10/24 21:33:21 1.29
--- VAGRANT.class 2001/10/25 18:47:13 1.30
***************
*** 301,304 ****
--- 301,306 ----
$this->polygon_max_verts = 2;
+ $this->x_label_y_mod = 3; // This is the pixel offset that x labels vary up and down with
+
$this->CreateColor("white" , 255, 255, 255, 255);
$this->CreateColor("black" , 0 , 0 , 0 , 255);
***************
*** 767,771 ****
} // else set the tick
! $xLabelYMod = 3;
$xStart = ($xTick ? floor ($this->xmin / $xTick) : $this->xmin);
--- 769,773 ----
} // else set the tick
! $xLabelYMod = $this->x_label_y_mod;
$xStart = ($xTick ? floor ($this->xmin / $xTick) : $this->xmin);
***************
*** 907,916 ****
function DrawLegend() {
if (@sizeof($this->legend)) {
! $legend_top = $this->graph_height + 2 * $this->ypad + $this->max_x_label_height;
! $current_top = $legend_top;
! $this->DrawText($this->font,10,$legend_top - 18,"Legend:","black",0);
! $this->DrawLine(10,$legend_top - 4,47,$legend_top - 4,"black");
while (list($dataset,$legendInfo) = @each($this->legend)) {
$legend_left = 10;
--- 909,922 ----
function DrawLegend() {
if (@sizeof($this->legend)) {
! $legend_top = $this->graph_height + $this->ypad + $this->max_x_label_height + $this->x_label_y_mod * 2;
! $legend_title = "Legend:";
! $legend_text_size = $this->GetTextSize($legend_title,0);
!
! $this->DrawText($this->font,10,$legend_top,"Legend:","black",0);
! $this->DrawLine(10,$legend_top + $legend_text_size['height'],47,$legend_top + $legend_text_size['height'],"black");
+ $current_top = $legend_top + $legend_text_size['height'];
+
while (list($dataset,$legendInfo) = @each($this->legend)) {
$legend_left = 10;
***************
*** 1703,1707 ****
$text_left = ($this->image_width / 2) - ($titleSize['width'] / 2);
! $this->DrawText($this->font,$text_left,($this->graph_height + $this->ypad + 35),$this->xTitle,"black",0);
} // function DrawxTitle
--- 1709,1713 ----
$text_left = ($this->image_width / 2) - ($titleSize['width'] / 2);
! $this->DrawText($this->font,$text_left,($this->graph_height + $this->ypad + $this->max_x_label_height + $this->x_label_y_mod * 2),$this->xTitle,"black",0);
} // function DrawxTitle
|
|
From: Ariel G. <ag...@us...> - 2001-10-24 21:33:24
|
Update of /cvsroot/vagrant/vagrant
In directory usw-pr-cvs1:/tmp/cvs-serv30986
Modified Files:
VAGRANT.class
Log Message:
Added the ability to have custom pie chart legends. The 4th argument (optional)
can be an array that has corresponding keys to the data array and custom text
for the legend. If you have $foo[<key>] = '' in the array, it adds the data
to the legend with the normal text (although percentages only show if no
custom legends are being used). If you never set <key> in the array, the
data is excluded from the legend, otherwise, the value is used in the legend.
Index: VAGRANT.class
===================================================================
RCS file: /cvsroot/vagrant/vagrant/VAGRANT.class,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** VAGRANT.class 2001/10/23 18:29:50 1.28
--- VAGRANT.class 2001/10/24 21:33:21 1.29
***************
*** 1264,1269 ****
* @param array $data The data associated with each name
* @param string $title If you want the graph to have a title, pass it here
*/
! function PieChart($name,$data,$title = "") {
$this->max_num_points = sizeof($data);
--- 1264,1275 ----
* @param array $data The data associated with each name
* @param string $title If you want the graph to have a title, pass it here
+ * @param array $legend_text If you want customized legend entries or a custom legend title, put it in an array:
+ * $legend_text[$key] where $key is a $key from the $data array -> Custom legend text for this data
*/
! function PieChart($name,$data,$title = '',$legend_text = '') {
! if (!is_array($legend_text)) {
! $legend_text = array();
! } // else make legend text a blank array
!
$this->max_num_points = sizeof($data);
***************
*** 1404,1416 ****
if (isset($total)) {
! // Add this to the legend
! //
! $this->DrawFilledRectangle($legend_left,$legend_top,$legendBoxHeight,$legendBoxHeight,$color[$colorCount]);
! $this->DrawRectangle($legend_left,$legend_top,$legendBoxHeight,$legendBoxHeight,"black");
! $totalPercentage = ($total ? (round($value / $total * 1000) / 10) : "0");
! $strLegend = " - " . $name[$pieceNumber] . ": " . $data[$pieceNumber] . " (" . $totalPercentage . "%)";
! $this->DrawText($this->font,$legend_left + 20, $legend_top, $strLegend,"black",0);
! $legend_top += $legendBoxHeight + $legendBoxSpace;
$pieColors[$pieceNumber] = $colorCount;
++$colorCount;
--- 1410,1436 ----
if (isset($total)) {
! if (!sizeof($legend_text) || isset($legend_text[$pieceNumber])) {
! $totalPercentage = ($total ? (round($value / $total * 1000) / 10) : "0");
!
! if (!sizeof($legend_text) || ((string) $legend_text[$pieceNumber] === '')) {
! $strLegend = " - " . $name[$pieceNumber] . ": " . $data[$pieceNumber] . (!sizeof($legend_text) ? " (" . $totalPercentage . "%)" : "");
! } else if ((string) $legend_text[$pieceNumber] !== '') {
! $strLegend = " - " . $legend_text[$pieceNumber];
! } else {
! $strLegend = "";
! } // else
!
! if ($strLegend) {
! // Add this to the legend
! //
! $this->DrawFilledRectangle($legend_left,$legend_top,$legendBoxHeight,$legendBoxHeight,$color[$colorCount]);
! $this->DrawRectangle($legend_left,$legend_top,$legendBoxHeight,$legendBoxHeight,"black");
!
! $this->DrawText($this->font,$legend_left + 20, $legend_top, $strLegend,"black",0);
! $legend_top += $legendBoxHeight + $legendBoxSpace;
! } // if this gets added to the legend
! } // if we are adding this data to the legend
!
$pieColors[$pieceNumber] = $colorCount;
++$colorCount;
|