<?php
// *************************************
// ライブラリの読み込み
// *************************************
require_once("../pchart/class/pData.class.php");
require_once("../pchart/class/pDraw.class.php");
require_once("../pchart/class/pImage.class.php");
$main_font = "./JKG-L_3.ttf";
$ttl_font = "./lightnovelpop.ttf";
$w = 600;
$h = 250;
// *************************************
// データ作成
// *************************************
$MyData = new pData();
// *************************************
// 座標設定
// ※ 最後の文字列は凡例用
// *************************************
$MyData->addPoints(array(-4,VOID,VOID,12,8,3),"凡例 壱");
$MyData->addPoints(array(3,12,15,8,5,-5),"凡例 弐");
$MyData->addPoints(array(2,7,5,18,19,22),"凡例 参");
// *************************************
// X 座標の表示内容
// *************************************
$MyData->addPoints(array("1月","2月","3月","4月","5月","6月"),"横軸の月");
// 後から設定する
$MyData->setAbscissa("横軸の月"); // 表示名
// *************************************
// ライン設定
// *************************************
$MyData->setSerieTicks("凡例 弐",4); // 間隔 4 の点線
$MyData->setSerieWeight("凡例 参",2); // 線幅
// デフォルトは 0
$MyData->setAxisName(0,"縦軸1");
// *************************************
// 画像のサイズ指定
// *************************************
$myPicture = new pImage($w,$h,$MyData);
// *************************************
// 画像の枠線指定
// *************************************
$myPicture->drawRectangle(0,0,$w-1,$h-1,array("R"=>0,"G"=>0,"B"=>0));
// アンチエイリアス
$myPicture->Antialias = TRUE;
// *************************************
// 使用するフォント
// *************************************
$myPicture->setFontProperties(array("FontName"=>$ttl_font,"FontSize"=>12));
// *************************************
// タイトル
// drawText($X,$Y,$Text,$Format="")
// *************************************
$myPicture->drawText(10,35,"ラノベポップは太めです",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
// *************************************
// 使用するフォント
// *************************************
$myPicture->setFontProperties(array("FontName"=>$main_font,"FontSize"=>12));
// *************************************
// グラフエリアの定義
// setGraphArea($X1,$Y1,$X2,$Y2)
// *************************************
$myPicture->setGraphArea(60,40,$w-70,$h-50);
// *************************************
// スケールの設定
// *************************************
$scaleSettings =
array(
"XMargin"=>10,
"YMargin"=>10,
"Floating"=>TRUE, // 座標外(マージン)をクリア
"GridR"=>100,"GridG"=>100,"GridB"=>100, // グリッド線の色
"DrawSubTicks"=>TRUE, // 目盛の中心に目盛
"CycleBackground"=>TRUE // 交互に色を付ける
);
// *************************************
// スケールの描画
// *************************************
$myPicture->drawScale($scaleSettings);
// *************************************
// グラフの描画
// *************************************
$myPicture->drawLineChart();
// *************************************
// 凡例の描画
// drawLegend($X,$Y,$Format="")
// *************************************
$myPicture->drawLegend(350,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
// *************************************
// 表示
// *************************************
$myPicture->stroke();
?>