From: Ariel G. <ag...@us...> - 2001-11-21 20:11:12
|
Update of /cvsroot/vagrant/vagrant In directory usw-pr-cvs1:/tmp/cvs-serv28431 Modified Files: VAGRANT.class Log Message: label height fixes, no data is customizable string Index: VAGRANT.class =================================================================== RCS file: /cvsroot/vagrant/vagrant/VAGRANT.class,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** VAGRANT.class 2001/11/21 19:43:11 1.33 --- VAGRANT.class 2001/11/21 20:11:08 1.34 *************** *** 259,262 **** --- 259,264 ---- function InitGraph($width,$height) { //$height = max(450,$height); + $this->no_data = 0; + $this->no_data_string = "No Data"; $this->perLegendHeight = 20; *************** *** 504,508 **** } // if we are drawing text horizontally else { ! $line_width = $text_size['width']; $line_list = array(); $word_line = ''; --- 506,510 ---- } // if we are drawing text horizontally else { ! $line_width = floor($text_size['width'] / 2); $line_list = array(); $word_line = ''; *************** *** 533,537 **** $num_lines = sizeof($line_list); $left_pos = $x - ($height_mod * $num_lines) + ($text_space * ($num_lines - 1)); ! $height_base = $y + $line_width / 2; while (list(, $word_line) = @each($line_list)) { --- 535,539 ---- $num_lines = sizeof($line_list); $left_pos = $x - ($height_mod * $num_lines) + ($text_space * ($num_lines - 1)); ! $height_base = $y + $height_mod + $text_space + $line_width / 2; while (list(, $word_line) = @each($line_list)) { *************** *** 721,732 **** */ function DrawGrid($color) { - $numGrid = 10; - // For labelling grids, we need to shrink the graph to fit the labels // ! $max_label_width = $this->GetMaxLabelSize("x"); $xNum = $this->graph_width / $this->xAxisSpacing; $numxGrid = round(min($numGrid, $xNum)); if ($this->xLabel) { --- 723,738 ---- */ function DrawGrid($color) { // For labelling grids, we need to shrink the graph to fit the labels // ! $max_label_width = $this->GetMaxLabelSize("x") / 2; ! $this->graph_height -= $max_label_width; + $numGrid = 10; + $xNum = $this->graph_width / $this->xAxisSpacing; + $yNum = $this->graph_height / $this->yAxisSpacing; + $numxGrid = round(min($numGrid, $xNum)); + $numyGrid = round(min($numGrid, $yNum)); if ($this->xLabel) { *************** *** 736,756 **** } - if (!$this->xTick) { - $xTick = $this->adjustNum(($this->xdata_diff / $numxGrid), $this->xdata_diff, $numxGrid, $xIntOnly); - } // if someone has set a x tick size - else { - $xTick = $this->xTick; - } // else set the tick - - if ($max_label_width > $xTick * 2) { - $this->graph_height -= $max_label_width; - } // if - else { - $this->graph_height -= $max_label_width / 2; - } // else - - $yNum = $this->graph_height / $this->yAxisSpacing; - $numyGrid = round(min($numGrid, $yNum)); - if (!$this->yTick) { $yTick = $this->adjustNum(($this->ydata_diff / $numyGrid), $this->ydata_diff, $numyGrid); --- 742,745 ---- *************** *** 760,763 **** --- 749,759 ---- } // else set the tick + if (!$this->xTick) { + $xTick = $this->adjustNum(($this->xdata_diff / $numxGrid), $this->xdata_diff, $numxGrid,$xIntOnly); + } // if someone has set a x tick size + else { + $xTick = $this->xTick; + } // else set the tick + $xLabelYMod = $this->x_label_y_mod; *************** *** 782,787 **** if ($this->show_axis2) { ! if (!$this->axis2_ytick) { ! $axis2_ytick = $this->adjustNum(($this->axis2['ydata_diff']/ ($numyGrid - 1)), $this->axis2['ydata_diff'], $numyGrid - 1); } else { $axis2_ytick = $this->axis2_ytick; --- 778,783 ---- if ($this->show_axis2) { ! if (!$this->axis2_ytick || ($this->axis2_ytick * ($numyGrid - 1) < $this->axis2['ymax'])) { ! $axis2_ytick = $this->adjustNum(($this->axis2['ydata_diff'] / ($numyGrid - 1)), $this->axis2['ydata_diff'], $numyGrid - 1); } else { $axis2_ytick = $this->axis2_ytick; *************** *** 851,859 **** $strSize = $this->GetTextSize($gridy,0); $this->axis1Padding = max($this->axis1Padding,$strSize['width']); - - $label_top = $y0 - ($strSize['height'] / 2); - $label_left = $x0 - $strSize['width'] - $this->xTickPadding; ! $this->DrawText($this->font,$label_left,$label_top,$gridy,"black",0); if ($axis2_ytick) { --- 847,852 ---- $strSize = $this->GetTextSize($gridy,0); $this->axis1Padding = max($this->axis1Padding,$strSize['width']); ! $this->DrawText($this->font,$x0 - $strSize['width'] - $this->xTickPadding,$y0 - ($strSize['height'] / 2),$gridy,"black",0); if ($axis2_ytick) { *************** *** 906,915 **** $legend_text_size = $this->GetTextSize($legend_title,0); ! $legend_top = $this->graph_height + $this->ypad + $this->max_x_label_height + $legend_text_size['height']; $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)) { --- 899,908 ---- $legend_text_size = $this->GetTextSize($legend_title,0); ! $legend_top = $this->graph_height + $this->ypad + $this->max_x_label_height + $this->x_label_y_mod * 2 + $this->xTickPadding + $legend_text_size['height']; $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'] + 2; while (list($dataset,$legendInfo) = @each($this->legend)) { *************** *** 1703,1707 **** $text_left = ($this->image_width / 2) - ($titleSize['width'] / 2); ! $text_top = $this->graph_height + $this->ypad + $this->max_x_label_height + $titleSize['height']; $this->DrawText($this->font,$text_left,$text_top,$this->xTitle,"black",0); --- 1696,1700 ---- $text_left = ($this->image_width / 2) - ($titleSize['width'] / 2); ! $text_top = $this->graph_height + $this->ypad + $this->max_x_label_height + $this->x_label_y_mod * 2 + $this->xTickPadding + $titleSize['height']; $this->DrawText($this->font,$text_left,$text_top,$this->xTitle,"black",0); *************** *** 1830,1836 **** ! function NoData() { ! $this->InitGraph(80,20); ! $this->DrawText($this->font,20,0, "No Data","black",0); } // function --- 1823,1835 ---- ! function NoData($message = "No Data") { ! $text_size = $this->GetTextSize($message,0); ! $xpad = 20; ! ! $this->InitGraph($text_size['width'] + 2*$xpad,20); ! $this->no_data_string = $message; ! $this->DrawText($this->font,20,0, $this->no_data_string,"black",0); ! ! $this->no_data = 1; } // function *************** *** 1846,1852 **** header ("Pragma: no-cache"); // HTTP/1.0 ! if ($this->max_num_points == 0) { ! $this->NoData(); } // if $this->DrawImage(); } // function ShowGraph --- 1845,1852 ---- header ("Pragma: no-cache"); // HTTP/1.0 ! if (($this->max_num_points == 0) && !$this->no_data) { ! $this->NoData('No Data'); } // if + $this->DrawImage(); } // function ShowGraph |