EC-CUBE グラフの項目ラベルが描画されない
<?php /** TTFフォントファイル */ define( 'FONT_REALFILE', '/usr/share/fonts/ipa-gothic/ipag.ttf' ); /** フォントサイズ */ define( 'FONT_SIZE', 12 ); /** タイトルフォントサイズ */ define( 'TITLE_FONT_SIZE', 13 ); /** 背景幅 */ define( 'BG_WIDTH', 850 ); /** 背景高さ */ define( 'BG_HEIGHT', 450 ); // ----------------------------------------------------------------------------- // 円グラフ // ----------------------------------------------------------------------------- /** 円グラフ位置 */ define( 'PIE_LEFT', 200 ); /** 円グラフ位置 */ define( 'PIE_TOP', 150 ); /** 円グラフ幅 */ define( 'PIE_WIDTH', 400 ); /** 円グラフ高さ */ define( 'PIE_HEIGHT', 150 ); /** 円グラフ太さ */ define( 'PIE_THICK', 30 ); /** 円グラフのラベル位置を上にあげる */ define( 'PIE_LABEL_UP', 20 ); /** 値が大きいほど影が長くなる */ define( 'PIE_SHADE_IMPACT', 0.1 ); // ----------------------------------------------------------------------------- // 折れ線グラフ // ----------------------------------------------------------------------------- /** Y軸の目盛り数 */ define( 'LINE_Y_SCALE', 5 ); /** X軸の目盛り数 */ define( 'LINE_X_SCALE', 10 ); /** 線グラフ位置 */ define( 'LINE_LEFT', 100 ); /** 線グラフ位置 */ define( 'LINE_TOP', 50 ); /** 線グラフ背景のサイズ */ define( 'LINE_AREA_WIDTH', 600 ); /** 線グラフ背景のサイズ */ define( 'LINE_AREA_HEIGHT', 300 ); /** 線グラフマークのサイズ */ define( 'LINE_MARK_SIZE', 6 ); /** 目盛り幅 */ define( 'LINE_SCALE_SIZE', 6 ); /** X軸のラベルの表示制限数 */ define( 'LINE_XLABEL_MAX', 30 ); /** X軸のタイトルと軸の間隔 */ define( 'LINE_XTITLE_PAD', - 5 ); /** Y軸のタイトルと軸の間隔 */ define( 'LINE_YTITLE_PAD', 15 ); require_once CLASS_REALDIR . 'graph/SC_Graph_Base.php'; class SC_Graph_Base_Ex extends SC_Graph_Base { // テキストを出力する /** * @param integer $color */ public function setText( $font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false ) { // 時計回りに角度を変更 $angle = - $angle; // ラベル背景 if( $labelbg ) { $text_width = $this->getTextWidth( $text, $font_size ); imagefilledrectangle( $this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color ); } $text = mb_convert_encoding( $text, CHAR_CODE ); if( $color != NULL ) { } else { $color = $this->color; } ImageTTFText( $this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_REALFILE, $text ); } }
require_once CLASS_REALDIR . 'graph/SC_Graph_Base.php';
より前に define を書かないと設定が反映されない。
初期の
<?php /** TTFフォントファイル */ define( 'FONT_REALFILE', DATA_REALDIR . 'fonts/wlmaru20044.ttf' );
はファイルが壊れてるっぽい