<!--
document.write("<script type=\"text/javascript\" src=\"/common/script/prototype.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"/common/script/excanvas.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"/common/script/plotr/plotr.js\"></script>");

function displayGraph(){
	var answer = "";
	var paramList = "";
//	var url = "piechart_kr.xml";
	var url = "piechart_kr.php";

	if (document.question_form.answer[0].checked) {
		answer = "yes";
	} else if (document.question_form.answer[1].checked) {
		answer = "no";
	} else {
		window.alert('選択されていません');
		return false; // 送信を中止
	}

	paramList = 'answer=' + answer;

	new Ajax.Request(url,
	{
		// method: 'get' だとIEでキャッシュされてしまうのでpost
		method: 'post',
		parameters: paramList,
		onSuccess: getData,
		onFailure: showErrMsg
	});

	function getData(data){
		var numyes = data.responseXML.getElementsByTagName('num_yes');
		var numyesValue = numyes[0].firstChild.nodeValue;

		var numno = data.responseXML.getElementsByTagName('num_no');
		var numnoValue = numno[0].firstChild.nodeValue;

		displayPieChart(numyesValue/(numyesValue+numnoValue), numnoValue/(numyesValue+numnoValue));
//		window.alert(numyesValue);
//		window.alert(numnoValue);
	}

	function showErrMsg(){
		window.alert('取得できませんでした');
	}
}
function displayPieChart(numyesValue, numnoValue){

	var dataset = {
		'はい': [[0, numyesValue]],
		'いいえ': [[0, numnoValue]]
	};

	// Define options.
	var options = {
		// Define a padding for the canvas node.
		padding: {
			left: 40,
			right: 0,
			top: 10,
			bottom: 0
		},
		// Background color to render.
		background: {
			color: '#ffffff'
		},
		// Use the predefined blue colorscheme.
		colorScheme: '#FF7F50',
		axis: {
			// The fontcolor of the labels is black.
			labelColor: '#000000',
			// Add the ticks. Keep in mind, x and y axis are swapped
			// when the BarOrientation is horizontal.
			x: {
				ticks: [
					{v:0, label:'はい'},
					{v:1, label:'いいえ'}
				]
			}
		},
		legend: {"hide": true}
	};

	// Change some attributes.
	Object.extend(options,{
		// Change the radius to 0.2 (default = 0.4).
		pieRadius: '0.4'
	});

	// hide inputs
	displayMode('piechart_input', 'none');
	createCanvas();

	// Instantiate a new PieCart.
	var pie = new Plotr.PieChart('graph', options);
	// Add a dataset to it.
	pie.addDataset(dataset);
	// Render it.
	pie.render();
}

function displayMode ( id, mode ) {
	if(document.getElementById( id )){
		document.getElementById( id ).style.display = mode;
	}
}

function createCanvas() {
	divNode = document.createElement('div');
	divNode.setAttribute("id", "piechart_output");
	divNode.style.position = 'relative';
	divNode.style.left = '-20px';
	divNode.style.top = '-25px';

	canvasNode = document.createElement('canvas');
	canvasNode.setAttribute("id", "graph");
	canvasNode.setAttribute("height", "130");
	canvasNode.setAttribute("width", "180");

	divNode.appendChild(canvasNode);

	containerNode = document.getElementById("piechart");
	containerNode.appendChild(divNode);
}
-->