www.un.org/Depts/DGACM/index_spanish.htm 能够照此等数据(html表格):。
<table border="0">
<thead>
<tr>
<th scope="row" class="n-1">Month</th>
<th class="n-2">N.o.L.</th>
<th class="n-3">Val.</th>
<th class="n-4">Total</th>
<th class="n-5">Num.o.Val.Total</th>
</tr>
</thead>
<tbody>
<tr>
<td class="n-1">1</td>
<td class="n-2">125</td>
<td class="n-3">0</td>
<td scope="col" class="n-4">125</td>
<td class="n-5">0</td>
</tr>
<tr>
<td class="n-1">2</td>
<td class="n-2">125</td>
<td class="n-3">48.75</td>
<td scope="col" class="n-4">173.75</td>
<td class="n-5">5</td>
</tr>
<tr>
<td class="n-1">3</td>
<td class="n-2">125</td>
<td class="n-3">97.5</td>
<td scope="col" class="n-4">222.5</td>
<td class="n-5">10</td>
</tr>
</tbody>
</table>
< with jQuery and put within the谷歌视觉化文字 in this form?
data.addRows(13); // number of rows + 1
data.setValue(0, 0, 1 ); // month = 1 (index, 0, $month)
data.setValue(0, 1, 125); // for Month =1, Total = 123 (index, 1, $total)
data.setValue(0, 2, 0); // for Month = 1, Num.o.Val.Total = 5 (index, 2, $Num.o.Val.Total)
etc...
The goal is to create this kind of chart: CHART URL from html table.
我期待着建立<代码>。 MONTH COLUMN as hAxis
and TOTAL COLUMN
as vAxis
+>Num.o.Val.Total (second line).
任何建议都受到高度赞赏。
http://www.un.org。
不是百分之百为之自豪,而是努力:
var data = new google.visualization.DataTable();
data.addColumn( string , Month );
data.addColumn( number , Total );
data.addColumn( number , Num.o.Val.Total );
var NumOfRows = $( table tbody tr ).length; // number of rows
data.addRows(NumOfRows);
for ( i = 0; i < NumOfRows; ++i) {
var CurrentPlusOne = i+1;
var Month = $( table tbody tr:nth-child( + CurrentPlusOne + ) ).children( :first-child ).html();
var Total = parseInt($( table tbody tr:nth-child( + CurrentPlusOne + ) ).children().eq(3).html());
var TotalNum = parseInt($( table tbody tr:nth-child( + CurrentPlusOne + ) ).children().eq(4).html());
data.setValue(i, 0, Month);
data.setValue(i, 1, Total);
data.setValue(i, 2, TotalNum);
}
www.un.org/Depts/DGACM/index_spanish.htm 我能改进该守则的任何方式?