[1.6.4][frontend]グラフ日本語化パッチ

グラフの日本語化…というかTrueTypeフォント対応化です。
ホスト名には日本語は使えませんが、
アイテム名やトリガー名、単位等に使ってしまった場合に
表示が化けるので作成しました。
はっきり言って、別物になってる気がしなくもないですが…汗

<code>
--- C:/org/chart.inc.php Fri Apr 03 23:44:06 2009
+++ C:/frp/chart.inc.php Wed Apr 22 17:04:25 2009
@@ -21,6 +21,31 @@
<?php
require_once('include/classes/graph.inc.php');

+// Modified by Fripper Begin
+// Add Position Info
+define('CHART_MARGIN_BOTTOM',6);
+
+define('CHART_XAXIS_DATATIME_BASE_HEIGHT', 55);
+define('CHART_XAXIS_DATATIME_MARGIN_TOP', 2);
+define('CHART_XAXIS_DATATIME_MARGIN_BOTTOM',2);
+define('CHART_XAXIS_DATATIME_HEIGHT',CHART_XAXIS_DATATIME_MARGIN_TOP+
+ CHART_XAXIS_DATATIME_BASE_HEIGHT+
+ CHART_XAXIS_DATATIME_MARGIN_BOTTOM);
+
+define('CHART_LEGENDS_BASE', CHART_XAXIS_DATATIME_HEIGHT);
+
+define('CHART_LEGENDS_FONT_SIZE', 9);
+define('CHART_LEGENDS_BASE_HEIGHT', 10);
+define('CHART_LEGENDS_MARGIN_TOP' , 2);
+define('CHART_LEGENDS_MARGIN_BOTTOM', 2);
+define('CHART_LEGENDS_MARK_SIZE', 6);
+define('CHART_LEGENDS_MARK_SHIFT', (CHART_LEGENDS_BASE_HEIGHT-CHART_LEGENDS_MARK_SIZE)/2);
+define('CHART_LEGENDS_TITLE_MARGIN', 2);
+define('CHART_LEGENDS_HEIGHT',CHART_LEGENDS_MARGIN_TOP+
+ CHART_LEGENDS_BASE_HEIGHT+
+ CHART_LEGENDS_MARGIN_BOTTOM);
+// Modified by Fripper End
+
class Chart extends Graph{

function Chart($type = GRAPH_TYPE_NORMAL){
@@ -174,26 +199,24 @@

$old_day=-1;
for($i=0;$i<=($vline_count+1);$i++){
- imagestringup($this->im,
- 1,
- $i*($this->sizeX/($vline_count+1))+$this->shiftXleft-3,
- $this->sizeY+$this->shiftY+57,
- date(' H:i',$this->from_time+$i*($this->period/($vline_count+1))),
- $this->GetColor('Black No Alpha')
- );
-
+// Modified by Fripper Begin
+// DateTime Format
$new_day=date('d',$this->from_time+$i*($this->period/($vline_count+1)));
+ $dateformat = ' H:i';
+ $colorstr = 'Black No Alpha';
if(($old_day != $new_day) || ($i==($vline_count+1))){
$old_day=$new_day;
- imagestringup($this->im,
- 1,
- $i*($this->sizeX/($vline_count+1))+$this->shiftXleft-3,
- $this->sizeY+$this->shiftY+57,
- date('m.d H:i',$this->from_time+$i*($this->period/($vline_count+1))),
- $this->GetColor('Dark Red No Alpha')
- );
-
+ $dateformat = 'm.d H:i';
+ $colorstr = 'Dark Red No Alpha';
}
+ imagestringup($this->im,
+ 1,
+ $i*($this->sizeX/($vline_count+1))+$this->shiftXleft-3,
+ $this->sizeY+$this->shiftY+CHART_XAXIS_DATATIME_MARGIN_TOP+CHART_XAXIS_DATATIME_BASE_HEIGHT,
+ date($dateformat,$this->from_time+$i*($this->period/($vline_count+1))),
+ $this->GetColor($colorstr)
+ );
+// Modified by Fripper End
}
}

@@ -372,56 +395,69 @@
str_pad($this->items[$i]['description'],$max_desc_len,' '));
}

+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $shiftYBase = $this->sizeY + $this->shiftY + CHART_LEGENDS_BASE+CHART_LEGENDS_MARGIN_TOP+(CHART_LEGENDS_HEIGHT*$i);
imagefilledrectangle($this->im,
$this->shiftXleft,
- $this->sizeY+$this->shiftY+62+12*$i,
- $this->shiftXleft+5,
- $this->sizeY+$this->shiftY+5+62+12*$i,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT,
+ $this->shiftXleft+CHART_LEGENDS_MARK_SIZE,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+CHART_LEGENDS_MARK_SIZE,
$color
);
imagerectangle($this->im,
$this->shiftXleft,
- $this->sizeY+$this->shiftY+62+12*$i,
- $this->shiftXleft+5,
- $this->sizeY+$this->shiftY+5+62+12*$i,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT,
+ $this->shiftXleft+CHART_LEGENDS_MARK_SIZE,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+CHART_LEGENDS_MARK_SIZE,
$this->GetColor('Black No Alpha')
);

- imagestring($this->im,
- 2,
- $this->shiftXleft+9,
- $this->sizeY+$this->shiftY+(62-5)+12*$i,
- $str,
- $this->GetColor('Black No Alpha')
- );
-
+ $str = mb_convert_encoding($str,'SJIS');
+ ImageTTFText(
+ $this->im,
+ CHART_LEGENDS_FONT_SIZE,
+ 0,
+ $this->shiftXleft+CHART_LEGENDS_BASE_HEIGHT+CHART_LEGENDS_TITLE_MARGIN,
+ $shiftYBase+CHART_LEGENDS_BASE_HEIGHT,
+ $this->GetColor('Black No Alpha'),
+ SAZANAMI_TTF_PATH,
+ $str);
+// Modified by Fripper End
$i +=($this->type == GRAPH_TYPE_STACKED)?-1:1;
}

if($this->sizeY < 120) return;

foreach($this->triggers as $trigger){
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $shiftYBase = $this->sizeY+$this->shiftY+CHART_LEGENDS_BASE+CHART_LEGENDS_MARGIN_TOP+(CHART_LEGENDS_HEIGHT*$i);
imagefilledellipse($this->im,
- $this->shiftXleft + 2,
- $this->sizeY+$this->shiftY+2+62+12*$i,
- 6,
- 6,
+ $this->shiftXleft+(CHART_LEGENDS_MARK_SIZE/2),
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+(CHART_LEGENDS_MARK_SIZE/2),
+ CHART_LEGENDS_MARK_SIZE,
+ CHART_LEGENDS_MARK_SIZE,
$this->GetColor($trigger['color']));

imageellipse($this->im,
- $this->shiftXleft + 2,
- $this->sizeY+$this->shiftY+2+62+12*$i,
- 6,
- 6,
+ $this->shiftXleft+(CHART_LEGENDS_MARK_SIZE/2),
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+(CHART_LEGENDS_MARK_SIZE/2),
+ CHART_LEGENDS_MARK_SIZE,
+ CHART_LEGENDS_MARK_SIZE,
$this->GetColor('Black No Alpha'));

- imagestring(
- $this->im,
- 2,
- $this->shiftXleft+9,
- $this->sizeY+$this->shiftY+(62-5)+12*$i,
- $trigger['description'],
- $this->GetColor('Black No Alpha'));
+ $str = mb_convert_encoding($trigger['description'],'SJIS');
+ ImageTTFText(
+ $this->im,
+ CHART_LEGENDS_FONT_SIZE,
+ 0,
+ $this->shiftXleft+CHART_LEGENDS_BASE_HEIGHT+CHART_LEGENDS_TITLE_MARGIN,
+ $shiftYBase+CHART_LEGENDS_BASE_HEIGHT,
+ $this->GetColor('Black No Alpha'),
+ SAZANAMI_TTF_PATH,
+ $str);
+// Modified by Fripper End
++$i;
}

@@ -438,11 +474,17 @@
$str.=' ['.$side.']';
}

+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $shiftYBase = $this->sizeY+$this->shiftY+CHART_LEGENDS_BASE+CHART_LEGENDS_MARGIN_TOP+(CHART_LEGENDS_HEIGHT*$i);
imagefilledpolygon($this->im,
array(
- $this->shiftXleft+2,$this->sizeY+$this->shiftY+61+12*$i,
- $this->shiftXleft-2,$this->sizeY+$this->shiftY+67+12*$i,
- $this->shiftXleft+6,$this->sizeY+$this->shiftY+67+12*$i,
+ $this->shiftXleft+(CHART_LEGENDS_MARK_SIZE/2),
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT,
+ $this->shiftXleft,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+CHART_LEGENDS_MARK_SIZE,
+ $this->shiftXleft+CHART_LEGENDS_MARK_SIZE,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+CHART_LEGENDS_MARK_SIZE,
),
3,
$this->GetColor($color)
@@ -450,21 +492,28 @@

imagepolygon($this->im,
array(
- $this->shiftXleft+2,$this->sizeY+$this->shiftY+61+12*$i,
- $this->shiftXleft-2,$this->sizeY+$this->shiftY+67+12*$i,
- $this->shiftXleft+6,$this->sizeY+$this->shiftY+67+12*$i,
+ $this->shiftXleft+(CHART_LEGENDS_MARK_SIZE/2),
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT,
+ $this->shiftXleft,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+CHART_LEGENDS_MARK_SIZE,
+ $this->shiftXleft+CHART_LEGENDS_MARK_SIZE,
+ $shiftYBase+CHART_LEGENDS_MARK_SHIFT+CHART_LEGENDS_MARK_SIZE,
),
3,
$this->GetColor('Black No Alpha')
);

- imagestring(
- $this->im,
- 2,
- $this->shiftXleft+9,
- $this->sizeY+$this->shiftY+(62-5)+12*$i,
- sprintf($str,$percentile['percent'],convert_units($percentile['value'],$units[$side])),
- $this->GetColor('Black No Alpha'));
+ $str = mb_convert_encoding(sprintf($str,$percentile['percent'],convert_units($percentile['value'],$units[$side])),'SJIS');
+ ImageTTFText(
+ $this->im,
+ CHART_LEGENDS_FONT_SIZE,
+ 0,
+ $this->shiftXleft+CHART_LEGENDS_BASE_HEIGHT+CHART_LEGENDS_TITLE_MARGIN,
+ $shiftYBase+CHART_LEGENDS_BASE_HEIGHT,
+ $this->GetColor('Black No Alpha'),
+ SAZANAMI_TTF_PATH,
+ $str);
+// Modified by Fripper End

$i++;
$color = '00AA00';
@@ -1290,18 +1339,28 @@

$this->correctMinMax();

+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $this->calcHeader();
+// Modified by Fripper End
$this->updateShifts();
$this->calcTriggers();
$this->calcZero();
$this->calcPercentile();

$this->fullSizeX = $this->sizeX+$this->shiftXleft+$this->shiftXright+1;
- $this->fullSizeY = $this->sizeY+$this->shiftY+62;
- $this->fullSizeY += 12*($this->num+(($this->sizeY < 120)?0:count($this->triggers)))+8;
+// Modified by Fripper Begin
+// Add Position Info
+ $this->fullSizeY = $this->sizeY+$this->shiftY+CHART_LEGENDS_BASE+CHART_MARGIN_BOTTOM;
+ $this->fullSizeY += CHART_LEGENDS_HEIGHT*($this->num+(($this->sizeY < 120)?0:count($this->triggers)));
+// Modified by Fripper End

foreach($this->percentile as $side => $percentile){
if(($percentile['percent']>0) && $percentile['value']){
- $this->fullSizeY += 12;
+// Modified by Fripper Begin
+// Add Position Info
+ $this->fullSizeY += CHART_LEGENDS_HEIGHT;
+// Modified by Fripper End
}
}

--- C:/org/graph.inc.php Fri Apr 03 23:44:06 2009
+++ C:/frp/graph.inc.php Wed Apr 22 17:15:25 2009
@@ -22,6 +22,11 @@
require_once('include/items.inc.php');
require_once('include/hosts.inc.php');

+// Modified by Fripper Begin
+// Add support Multibyte Font
+define('SAZANAMI_TTF_PATH', '/usr/share/fonts/ja/TrueType/sazanami-gothic.ttf');
+// Modified by Fripper End
+
define('GRAPH_YAXIS_TYPE_CALCULATED',0);
define('GRAPH_YAXIS_TYPE_FIXED',1);
define('GRAPH_YAXIS_TYPE_CALCULATED_0_MIN',2);
@@ -96,6 +101,10 @@

$this->axis_valuetype = array(); // overal items type (int/float)

+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $this->headerSize=11;
+// Modified by Fripper End
}

@@ -259,15 +268,59 @@

$str=$str.$this->period2str($this->period);

- if($this->sizeX < 500){
- $fontnum = 2;
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $str = mb_convert_encoding($str,'SJIS');
+
+ $bbox = ImageTTFBBox($this->headerSize, 0, SAZANAMI_TTF_PATH, $str);
+ $width = abs($bbox[4] - $bbox[0]);
+ $height = abs($bbox[5] - $bbox[1]);
+
+ $x = $this->fullSizeX/2 - $width/2;
+ $y = $height + 1;
+
+ ImageTTFText(
+ $this->im,
+ $this->headerSize,
+ 0,
+ $x,
+ $y,
+ $this->GetColor('Dark Red No Alpha'),
+ SAZANAMI_TTF_PATH,
+ $str);
+// Modified by Fripper End
+ }
+
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ function calcHeader(){
+ if(!isset($this->header)){
+ $str=$this->items[0]['host'].':'.$this->items[0]['description'];
}
else{
- $fontnum = 4;
+ $str=$this->header;
}
- $x=$this->fullSizeX/2-imagefontwidth($fontnum)*strlen($str)/2;
- imagestring($this->im, $fontnum,$x,1, $str , $this->GetColor('Dark Red No Alpha'));
+
+ $str = $str.$this->period2str($this->period);
+ $str = mb_convert_encoding($str,'SJIS');
+
+ $sizes=array(11,10,9,8,7);
+ foreach($sizes as $size)
+ {
+ $bbox = ImageTTFBBox($size, 0, SAZANAMI_TTF_PATH, $str);
+ $width = abs($bbox[4] - $bbox[0]);
+ $height = abs($bbox[5] - $bbox[1]);
+ $finalsize = $size;
+
+ if($this->sizeX * 0.98 > $width)
+ break;
+ }
+ if(!isset($finalsize)) $finalsize = end($sizes);
+ $this->headerSize=$finalsize;
+
+ $this->shiftY = $height + 5;
}
+// Modified by Fripper End

function setHeader($header){
$this->header=$header;
--- C:/org/pie.inc.php Fri Apr 03 23:44:06 2009
+++ C:/frp/pie.inc.php Wed Apr 22 17:13:04 2009
@@ -21,6 +21,22 @@
<?php
require_once "include/classes/graph.inc.php";

+// Modified by Fripper Begin
+// Add Position Info
+define('PIE_MARGIN_BOTTOM',4);
+
+define('PIE_LEGENDS_FONT_SIZE', 9);
+define('PIE_LEGENDS_BASE_HEIGHT', 10);
+define('PIE_LEGENDS_MARGIN_TOP' , 2);
+define('PIE_LEGENDS_MARGIN_BOTTOM', 2);
+define('PIE_LEGENDS_MARK_SIZE', 6);
+define('PIE_LEGENDS_MARK_SHIFT', (PIE_LEGENDS_BASE_HEIGHT-PIE_LEGENDS_MARK_SIZE)/2);
+define('PIE_LEGENDS_TITLE_MARGIN', 2);
+define('PIE_LEGENDS_HEIGHT',PIE_LEGENDS_MARGIN_TOP+
+ PIE_LEGENDS_BASE_HEIGHT+
+ PIE_LEGENDS_MARGIN_BOTTOM);
+// Modified by Fripper End
+
class Pie extends Graph{

function Pie($type = GRAPH_TYPE_PIE){
@@ -31,7 +47,18 @@
$this->exploderad = 1;
$this->exploderad3d = 3;
$this->graphheight3d = 12;
- $this->shiftlegendright = 17*7 + 7 + 10; // count of static chars * px/char + for color rectangle + space
+// Modified by Fripper Begin
+// Add Position Info
+// Add support Multibyte Font
+ // Legend string sample
+ $str = S_VALUE.': '.' (99.99%)';
+ $str = mb_convert_encoding($str,'SJIS');
+ $bbox = ImageTTFBBox(PIE_LEGENDS_FONT_SIZE, 0, SAZANAMI_TTF_PATH, $str);
+ $w = abs($bbox[4] - $bbox[0]);
+
+ // color rectangle + margin + Legend string width
+ $this->shiftlegendright = PIE_LEGENDS_HEIGHT + PIE_LEGENDS_TITLE_MARGIN + $w;
+// Modified by Fripper End
$this->drawlegendallow = 1;
}

@@ -83,7 +110,10 @@
$p = $this->to_time - $this->from_time; // graph size in time
$z = $p - $this->from_time % $p; //<strong></strong>
$x = $this->sizeX; // graph size in px
- $strvaluelength = 0; // we need to know how long in px will be our legend
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $strvaluewidth = 0; // we need to know how long in px will be our legend
+// Modified by Fripper End

for($i=0; $i < $this->num; $i++){

@@ -190,11 +220,21 @@
}

$this->sum += $item_value;
- $strvaluelength = max($strvaluelength,strlen(convert_units($item_value,$this->items[$i]['unit'])));
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $str = convert_units($item_value,$this->items[$i]['unit']);
+ $str = mb_convert_encoding($str,'SJIS');
+ $bbox = ImageTTFBBox(PIE_LEGENDS_FONT_SIZE, 0, SAZANAMI_TTF_PATH, $str);
+ $w = abs($bbox[4] - $bbox[0]);
+ $strvaluewidth = max($strvaluewidth,$w);
+// Modified by Fripper End
}

if(isset($graph_sum)) $this->sum = $graph_sum;
- $this->shiftlegendright += $strvaluelength * 7;
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $this->shiftlegendright += $strvaluewidth;
+// Modified by Fripper End
}

@@ -285,7 +325,10 @@

function drawLegend(){

- $shiftY = $this->shiftY + $this->shiftYLegend;
+// Modified by Fripper Begin
+// Add support Multibyte Font
+// Remove Contents
+// Modified by Fripper End

$max_host_len=0;
$max_desc_len=0;
@@ -321,41 +364,82 @@

$proc = ($datavalue * 100)/ $this->sum;
// convert_units($datavalue,$this->items[$i]["units"]),
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $strvalue = S_VALUE.': ';
+ $str = str_pad($this->items[$i]['host'],$max_host_len,' ').
+ ' : '.
+ str_pad($this->items[$i]['description'],$max_desc_len,' ').
+ ' [';
if(isset($data) && isset($datavalue)){
- $strvalue = sprintf(S_VALUE.': %s ('.((round($proc)!=$proc)?'%0.2f':'%s')."%s)",convert_units($datavalue,$this->items[$i]["units"]),$proc,'%');
-
- $str = sprintf('%s: %s [%s] ',
- str_pad($this->items[$i]['host'],$max_host_len,' '),
- str_pad($this->items[$i]['description'],$max_desc_len,' '),
- $fnc_name);
+ $strvalue .= convert_units($datavalue,$this->items[$i]['units']).' (';
+ if(round($proc)!=$proc)
+ $strvalue .= sprintf('%0.2f',$proc);
+ else
+ $strvalue .= $proc;
+ $strvalue .= '%)';
+ $str .= $fnc_name;
}
else{
- $strvalue = sprintf(S_VALUE.': '.S_NO_DATA_SMALL);
- $str=sprintf('%s: %s [ '.S_NO_DATA_SMALL.' ]',
- str_pad($this->items[$i]['host'],$max_host_len,' '),
- str_pad($this->items[$i]['description'],$max_desc_len,' '));
+ $strvalue .= S_NO_DATA_SMALL;
+ $str .= ' '.S_NO_DATA_SMALL.' ';
}
+ $str .= ']';
+
+ $shiftYBase = $this->sizeY + $this->shiftY + $this->shiftYLegend + (PIE_LEGENDS_HEIGHT*$i);

- ImageFilledRectangle($this->im,$this->shiftXleft,$this->sizeY+$shiftY+12*$i,$this->shiftXleft+5,$this->sizeY+$shiftY+5+12*$i,$color);
- ImageRectangle($this->im,$this->shiftXleft,$this->sizeY+$shiftY+12*$i,$this->shiftXleft+5,$this->sizeY+$shiftY+5+12*$i,$this->GetColor('Black No Alpha'));
-
- ImageString($this->im, 2,
- $this->shiftXleft+9,
- $this->sizeY+$shiftY-5+12*$i,
- $str,
+ ImageFilledRectangle($this->im,
+ $this->shiftXleft,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT,
+ $this->shiftXleft+PIE_LEGENDS_MARK_SIZE,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT+PIE_LEGENDS_MARK_SIZE,
+ $color);
+ ImageRectangle($this->im,
+ $this->shiftXleft,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT,
+ $this->shiftXleft+PIE_LEGENDS_MARK_SIZE,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT+PIE_LEGENDS_MARK_SIZE,
$this->GetColor('Black No Alpha'));

- $shiftX = $this->fullSizeX - $this->shiftlegendright - $this->shiftXright + 10;
+ $str = mb_convert_encoding($str,'SJIS');
+ ImageTTFText(
+ $this->im,
+ PIE_LEGENDS_FONT_SIZE,
+ 0,
+ $this->shiftXleft+PIE_LEGENDS_BASE_HEIGHT+PIE_LEGENDS_TITLE_MARGIN,
+ $shiftYBase+PIE_LEGENDS_BASE_HEIGHT,
+ $this->GetColor('Black No Alpha'),
+ SAZANAMI_TTF_PATH,
+ $str);
+
+ $shiftXBase = $this->fullSizeX - $this->shiftlegendright - $this->shiftXright;
+ $shiftYBase = $this->shiftY + $this->shiftYLegend + (PIE_LEGENDS_HEIGHT*$i);
// SDI($shiftX.','.$this->sizeX);
-
- ImageFilledRectangle($this->im,$shiftX,$this->shiftY+10+5+12*$i,$shiftX+5,$this->shiftY+10+10+12*$i,$color);
- ImageRectangle($this->im,$shiftX,$this->shiftY+10+5+12*$i,$shiftX+5,$this->shiftY+10+10+12*$i,$this->GetColor('Black No Alpha'));
-
- ImageString($this->im, 2,
- $shiftX+9,
- $this->shiftY+10+12*$i,
- $strvalue,
+
+ ImageFilledRectangle($this->im,
+ $shiftXBase,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT,
+ $shiftXBase+PIE_LEGENDS_MARK_SIZE,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT+PIE_LEGENDS_MARK_SIZE,
+ $color);
+ ImageRectangle($this->im,
+ $shiftXBase,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT,
+ $shiftXBase+PIE_LEGENDS_MARK_SIZE,
+ $shiftYBase+PIE_LEGENDS_MARK_SHIFT+PIE_LEGENDS_MARK_SIZE,
$this->GetColor('Black No Alpha'));
+
+ $strvalue = mb_convert_encoding($strvalue,'SJIS');
+ ImageTTFText(
+ $this->im,
+ PIE_LEGENDS_FONT_SIZE,
+ 0,
+ $shiftXBase+PIE_LEGENDS_BASE_HEIGHT+PIE_LEGENDS_TITLE_MARGIN,
+ $shiftYBase+PIE_LEGENDS_BASE_HEIGHT,
+ $this->GetColor('Black No Alpha'),
+ SAZANAMI_TTF_PATH,
+ $strvalue);
+// Modified by Fripper End
}

if($this->sizeY < 120) return;
@@ -513,22 +597,31 @@
$this->selectData();

$this->shiftY = 20;
- $this->shiftYLegend = 20;
- $this->shiftXleft = 10;
- $this->shiftXright = 0;
+// Modified by Fripper Begin
+// Change default value
+ $this->shiftYLegend = 5;
+ $this->shiftXleft = 15;
+ $this->shiftXright = 15;
+// Modified by Fripper End
+
+// Modified by Fripper Begin
+// Add support Multibyte Font
+ $this->calcHeader();
+// Modified by Fripper End

$this->fullSizeX = $this->sizeX;
$this->fullSizeY = $this->sizeY;

if(($this->sizeX < 300) || ($this->sizeY < 200)) $this->switchlegend(0);

+// Modified by Fripper Begin
+// Add Position Info
+ $this->sizeX -= ($this->shiftXleft+$this->shiftXright);
+ $this->sizeY -= ($this->shiftY + PIE_MARGIN_BOTTOM);
if($this->drawlegendallow == 1){
- $this->sizeX -= ($this->shiftXleft+$this->shiftXright+$this->shiftlegendright);
- $this->sizeY -= ($this->shiftY+$this->shiftYLegend+12*$this->num+8);
- }
- else {
- $this->sizeX -= ($this->shiftXleft*2);
- $this->sizeY -= ($this->shiftY*2);
+ $this->sizeX -= $this->shiftlegendright;
+ $this->sizeY -= $this->shiftYLegend+(PIE_LEGENDS_HEIGHT*$this->num);
+// Modified by Fripper End
}

// SDI($this->sizeX.','.$this->sizeY);
</code>