コード例 #1
0
ファイル: SVGGraphRadarGraph.php プロジェクト: gotcms/gotcms
 /**
  * Adjusts the spacing for labels on all sides
  */
 protected function LabelAdjustment($longest_v = 1000, $longest_h = 100)
 {
     // prevent parent from adjusting for Y-axis label and axis text
     $y_label = !empty($this->label_v) ? $this->label_v : $this->label_y;
     $show_axes = $this->show_axes;
     $this->label_v = $this->label_y = $this->show_axes = NULL;
     parent::LabelAdjustment($longest_v, $longest_h);
     $this->label_v = $y_label;
     $this->show_axes = $show_axes;
     if ($this->show_axes) {
         // y-axis labels don't affect graph padding, but it is needed by label
         if ($this->show_axis_text_v) {
             $len_v = strlen(is_string($longest_v) ? $longest_v : $this->NumString($longest_v)) + 1;
             $this->pad_v_axis_label = $this->axis_font_size * ($len_v - 1) * $this->axis_font_adjust * cos(deg2rad($this->axis_text_angle_v)) + $this->axis_font_size + 2 * $this->axis_text_space;
         }
         $space = 0;
         if ($this->show_axis_text_h) {
             $space += $this->axis_font_size + 2 * $this->axis_text_space;
         }
         // pad for the axis divisions
         $div_size = 0;
         if ($this->show_divisions) {
             $div_size = $this->division_size;
         }
         if ($this->show_subdivisions && $this->subdivision_size > $div_size) {
             $div_size = $this->subdivision_size;
         }
         $space += $div_size;
         $this->pad_top += $space;
         $this->pad_left += $space;
         $this->pad_right += $space;
         $this->pad_bottom += $space;
     }
 }