ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文

  メンテナンス 前画面に戻る

対象スレッド 件名: 円グラフ
名前: lightbox
処理選択
パスワード

件名 円グラフ
名前 lightbox
コメント
@DIV
<script type="text/javascript">
$(function(){
	$("#target_table9").visualize({
		type: "pie",
		width: "400px",
		height: "300px",
		top: 1300,
		bottom: 400,
		parseDirection: "",
		pieLabelPos: "outside",
		pieMargin: 40,
		colors: ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#EBA36C','#26a4ed','#f45a90','#e9e744',"#ffffff","#DB30CD","#44DB30"],
		textColors: ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#EBA36C','#26a4ed','#f45a90','#e9e744',"#ffffff","#DB30CD","#44DB30"]
	});
});
</script>
@END

@SHOW
ラベルがデフォルトでは円グラフ内に表示されるので(pieLabelPos: "intside")、データが多い場合は [[pieLabelPos: "outside"]] を指定します。

さらに、ラベルの色を指定しないと良く見えない場合は、[[textColors]] で個別に指定します。そして、[[pieMargin]] を指定してグラフエリアの外側からの距離指定する事によって外側のラベルをうまく表示できるようにします。

データは、この場合 [[parseDirection を "x" 以外]]に設定しますが、データは2行あるので内部で[[合計されてその値が使用されて% 表示]]されます。

値を直接表示したい場合は、[[pieLabelsAsPercent を false]] に設定します
@END

@HTML
</pre>
<script type="text/javascript">
if ( !window.jQuery ) {
	document.write("<"+"script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></"+"script>");
}
</script>
<script type="text/javascript">
if ( window[window.location.hostname+'.visualize'] !== true ) { 
	window[window.location.hostname+'.visualize'] = true; 
	(function(){
		var str="";
		str+="<link href=\"http://winofsql.jp/jquery/plugins/visualize/visualize-dark.css\" type=\"text/css\" rel=\"stylesheet\"> \n";
		str+="<"+"script type=\"text/javascript\" src=\"http://winofsql.jp/jquery/plugins/visualize/excanvas.js\"></"+"script> \n";
		str+="<"+"script type=\"text/javascript\" src=\"http://winofsql.jp/jquery/plugins/visualize/visualize.jQuery.js\"></"+"script> \n";
		document.write(str);
	})();
} 
</script> 
<script type="text/javascript">
$(function(){
	$("#target_table9").visualize({
		type: "pie",
		width: "400px",
		height: "300px",
		top: 1300,
		bottom: 400,
		parseDirection: "",
		pieLabelPos: "outside",
		pieMargin: 40,
		colors: ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#EBA36C','#26a4ed','#f45a90','#e9e744',"#ffffff","#DB30CD","#44DB30"],
		textColors: ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#EBA36C','#26a4ed','#f45a90','#e9e744',"#ffffff","#DB30CD","#44DB30"]
	});
});
</script>
<style>
.visualize * {
	font-size: 12px!important;
	font-family: Arial,"メイリオ","MS Pゴシック";
}
.visualize .visualize-title {
	font-size: 24px!important;
	font-family: Arial,"メイリオ","MS Pゴシック";
}
.visualize { 
	margin: 20px 0 0 15px;
}
#target_table9 {
	border-collapse: collapse;
}
#target_table9 caption {
	padding:10px;
	border: solid 1px #c0c0c0;
	margin-bottom: 10px;
	border-radius: 10px;
	background: linear-gradient(to bottom, #777, #000);
	color: #fff;
}
#target_table9 td, #target_table9 th {
	text-align: center;
	border: 1px solid #ddd;
	padding:2px 5px;
}
</style>
<table id="target_table9">
<caption>電気使用量の月別比率</caption>
<thead>
<tr>
	<td></td>
	<th>1月</th>
	<th>2月</th>
	<th>3月</th>
	<th>4月</th>
	<th>5月</th>
	<th>6月</th>
	<th>7月</th>
	<th>8月</th>
	<th>9月</th>
	<th>10月</th>
	<th>11月</th>
	<th>12月</th>
</tr>
</thead>
<tbody>
<tr>
	<th>2013</th>
	<td>1144</td>
	<td>938</td>
	<td>972</td>
	<td>714</td>
	<td>771</td>
	<td>515</td>
	<td>641</td>
	<td>1051</td>
	<td>1018</td>
	<td>658</td>
	<td>681</td>
	<td>712</td>
</tr>
<tr>
	<th>2014</th>
	<td>1219</td>
	<td>927</td>
	<td>947</td>
	<td>709</td>
	<td>674</td>
	<td>495</td>
	<td>537</td>
	<td>900</td>
	<td>758</td>
	<td>536</td>
	<td>550</td>
	<td>857</td>
</tr>
</tbody>
</table>
<pre>
@HEND