I am using googlecharts plugin in order to generate a column chart.
i also want to get an average of the values present in the td. Is it possible through google charts plugin or can anyone help me in writing ajquery to calculate the avg.
After calculating the avg I need to add it in paragraph tag with class \”avg\”.
Thanks for the help.
My code is:
<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>
And the javascript code:
<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>





Rating:
The post html – jQuery to calculate avg of values present inside a td of a table appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/html-jquery-to-calculate-avg-of-values-present-inside-a-td-of-a-table.html
No comments:
Post a Comment