memo.xight.org

日々のメモ

PHP/SWF Charts の利用

Summary

  PHP/SWF Charts[2005-03-10-6]を実際に利用してみる.
  とても便利!.だけど表示されないグラフが….

Sample

include "charts/charts.php";
$chart [ 'chart_type' ] = "pie";
$chart [ 'chart_data' ] = array(
	array('','とても良い','良い','普通','悪い','とても悪い'),
	array('',20,10,30,10,10),
);
$chart ['series_color'] = array(
	'4e62dd',
	'88dd11',
	'ffcc41',
	'aa6622',
	'aa3322',
);
$chart [ 'chart_value' ] = array(
	'font' => "Sans Serif",
);
$chart [ 'legend_label' ] = array(
	'font' => "Sans Serif",
);
$chart ['draw'] = array(
	array(
		'type'      => 'text',
		'text'      => 'アンケート',
		'font'      => 'Sans Serif',
		'x'         => '0',
		'y'         => '-10',
		'h_align'   => "center",
		'v_align'   => "bottom",
		'width'     => '400',
		'height'    => '250',
		'color'     => "000000",
		'size'      => 14,
		'bold'      => true,
	),
);

mb_convert_variables('UTF-8','EUC-JP',$chart);

SendChartData($chart);


Point

・配列をUTF-8に変換する
・font を Sans Serifにすることで日本語を表示可能に.