Paprastas grafikų formavimas naudojant lenteles bei HTML5 & JQuery
Iš tiesų labai paprastas būdas gražiai atvaizduoti grafikus, naudojant paprastą lentelę (Table):

Pačios lenteles pavyzdžio kodas bei jquery funkcija:
-
<table >
-
<caption>2009 Individual Sales by Category</caption>
-
<thead>
-
<tr>
-
<td></td>
-
<th>food</th>
-
<th>auto</th>
-
<th>household</th>
-
<th>furniture</th>
-
<th>kitchen</th>
-
<th>bath</th>
-
</tr>
-
</thead>
-
<tbody>
-
<tr>
-
<th>Mary</th>
-
<td>150</td>
-
<td>160</td>
-
<td>40</td>
-
<td>120</td>
-
<td>30</td>
-
<td>70</td>
-
</tr>
-
<tr>
-
<th>Tom</th>
-
<td>3</td>
-
<td>40</td>
-
<td>30</td>
-
<td>45</td>
-
<td>35</td>
-
<td>49</td>
-
</tr>
-
…repetitive rows removed for brevity.
-
</tbody>
-
</table>
-
-
$(function(){
-
//make some charts
-
$('table').visualize({type: 'pie', pieMargin: 10, title: '2009 Total Sales by Individual'});
-
$('table').visualize({type: 'line'});
-
$('table').visualize({type: 'area'});
-
$('table').visualize();
-
});
Ir viskas, belieka įterpti šias bylas: JQuery, visualize plugin (js), visualize stilius (css). Tiesa, IE nesupranta HTML5, todėl papildomai reikia įterpti konverterį (archyve rasite):
-
<!–[if IE]><script type="text/javascript" src="excanvas.compiled.js"></script><![endif]–>
Plačiau filamentgroup.com

2009.07.08

