縦棒グラフを生成するために googlecharts プラグインを使用しています。
また、td に存在する値の平均も取得したいと考えています。Googleチャートプラグインを介して可能ですか、それとも平均を計算するためのajqueryを書くのを手伝ってくれますか? 平均を計算した後、クラス「avg」の段落タグに追加する必要があります。助けてくれてありがとう。
私のコードは次のとおりです。
<table id="weather">
<thead>
<tr>
<th></th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
</tr>
</thead>
<tbody>
<tr>
<th>Weather</th>
<td>20</td>
<td>22</td>
<td>18</td>
<td>24</td>
<td>20</td>
<td>22</td>
</tr>
</tbody>
</table>
そしてJavaScriptコード:
<script type="text/javascript">
gvChartInit();
$(document).ready(function(){
$('#weather').gvChart({
chartType: 'ColumnChart',
gvSettings: {
width: 100,
height: 40,
colors:['gray'],
hAxis: {textPosition: 'none'},
vAxis: {minValue: 0, textPosition: 'none', gridlines: {color: '#ffffff'}},
legend: {position: 'none'}
}
});
</script>