Source for file SC_GraphBase.php
Documentation is available at SC_GraphBase.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
define("FONT_REALFILE", DATA_REALDIR . "fonts/wlmaru20044.ttf");
define("TITLE_FONT_SIZE", 11);
/** フォント補正値(実際の描画幅/フォントサイズ) */
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
define("PIE_SHADE_IMPACT", 0.1);
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
define("LINE_AREA_WIDTH", 600);
define("LINE_AREA_HEIGHT", 300);
define("LINE_XLABEL_MAX", 30);
define("LINE_XTITLE_PAD", - 5);
define("LINE_YTITLE_PAD", 15);
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
* @author LOCKON CO.,LTD.
* @version $Id: SC_GraphBase.php 20764 2011-03-22 06:26:40Z nanasess $
$this->image = imagecreatetruecolor($bgw, $bgh);
$new_width = $this->bgw * 0.8;
$new_height = $this->bgh * 0.8;
$tmp_image = imagecreatetruecolor($new_width, $new_height);
if(imagecopyresampled($tmp_image, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->bgw, $this->bgh)) {
$this->image = $tmp_image;
for($i = 0; $i < $count; $i++ ) {
for($i = 0; $i < $count; $i++ ) {
header('Content-type: image/png');
imagepng($this->image, $filename);
imagedestroy($this->image);
$arrPos = imagettfbbox($font_size, 0, FONT_REALFILE, $text);
$ret = $arrPos[2] - $arrPos[0];
function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) {
imagefilledrectangle($this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color);
* XXX EUC-JP にしないと Warning がでる.
* --enable-gd-jis-conv も関係していそうだが, このオプションを
* Warning: imagettftext() [function.imagettftext]:
* any2eucjp(): something happen in
* http://www.php.net/imagettftext を見ると, UTF-8 にしろと
$text = mb_convert_encoding($text, "EUC-JP", CHAR_CODE);
//$text = mb_convert_encoding($text, CHAR_CODE);
ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_REALFILE, $text);
function drawTitle($text, $font_size = TITLE_FONT_SIZE) {
$left = ($this->bgw - $text_width) / 2;
$text = mb_convert_encoding($text, "UTF-8", CHAR_CODE);
function drawLegend($legend_max = "", $clabelbg = true) {
$label_max = $legend_max;
for($i = 0; $i < $label_max; $i++ ) {
if($text_max < $text_len) {
for($i = 0; $i < $label_max; $i++ ) {
imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color);
// {{{ protected functions
$this->ARR_MARK_COLOR = array(130, 130, 255);
* @param integer $cx 中心点X座標
* @param integer $cy 中心点Y座標
* @return array 円の中心点と直径から弧の終端座標の配列
$y = $cy - (($r * sin(deg2rad($s))) * ($ch / $cw));
function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) {
$color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]);
$text = mb_convert_encoding($text, "UTF-8", CHAR_CODE);
ImageTTFText($dst_image, $font_size, $angle, $left, $top, $color, $font, $text);
$ret = imagecolorallocate($image, $array[0], $array[1], $array[2]);
foreach($array as $val) {
$ret = imagecolorallocate($image, $dark[0], $dark[1], $dark[2]);
Documentation generated on Fri, 24 Feb 2012 14:02:36 +0900 by Seasoft
|