Plugin jQuery : Et le tableau devient graphique avec Visualize

plugin-jquery-et-le-tableau-devient-graphique-avec-visualizeVoici un plugin jQuery bien commode : générer un graphique à partir d’un simple tableau HTML.

Un exemple avec un tableau

[html]
<table class=visualize">
<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>
</tbody>
</table>
[/html]

plugin-jquery-et-le-tableau-devient-graphique-avec-visualize-1

Et on appel la fonction visualize()

[javascript]
<script type="text/javascript">
$(document).ready(function() {
$(‘table.visualize’).visualize();
});
</script>
[/javascript]

plugin-jquery-et-le-tableau-devient-graphique-avec-visualize-2

Des paramètres permettent également de « customizer » son graphique.

Téléchargement, options et démo sur le site officiel.

Ndlr : Ce plugin utilise les canvas HTML5 (pris en charge par beaucoup de navigateurs, mais pas dans toutes les versions)

Lien :

Article written by devzonefr

Développeur d'applications de formation, je me suis aujourd'hui spécialisé dans le développement web.

Laisser un commentaire