jQuery UI es una abstracción de bajo nivel para iteración y animación, efectos avanzados, widgets personalizables y otros componentes, que permiten construir aplicaciones web muy interactivas que enriquecen y potencian la experiencia del usuario.

En otras entradas, ya había hablado sobre jQuery UI, esta vez vamos a hablar sobre crear gráficos de barras usando estos componentes construidos con la biblioteca jQuery.

Nota de referencia: Este tutorial se basa en Creating Bar Graphs using jQuery UI publicado en tuttoaster.com.
Implementación de gráficos de barras con jQuery UI

Para este tutorial se requiere enlazar las bibliotecas jQuery UI, jQuery MIN, jQuery Custom MIN y Graph.js, además de los archivos CSS. El siguiente código está extraído del HTML del demo de Creating Bar Graphs using jQuery UI.

<!DOCTYPE html PUBLIC «-//W3C//DTD XHTML 1.0 Transitional//EN» «http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd»>
<html xmlns=»http://www.w3.org/1999/xhtml»>
<head>

/* Temas*/

<link rel=»stylesheet» type=»text/css» href=»css/custom-theme/jquery-ui-1.8.2.custom.css» />

/* Bibliotecas*/

<script type=»text/javascript» src=»js/jquery-1.4.2.min.js»></script>
<script type=»text/javascript» src=»js/jquery-ui-1.8.2.custom.min.js»></script>
<script type=»text/javascript» src=»js/graph.js»></script>
<meta http-equiv=»Content-Type» content=»text/html; charset=utf-8″ />
<title>CSS Graphs</title>

/*Código Javascript que implementa la funcionalidad del gráfico*/

<script type=»text/javascript»>
$(function(){
var d = [34,23,12,45,67,34,78,44];
var c = [«January»,»Febuary»,»March»,»April»,»May»,»June»,»July»,»August»];
$(«#graph»).graph({data:d,categories:c,legend:»This is a test»});
});
$(document).ready(function(){
$(‘#switcher’).themeswitcher();
});
</script>
<style>
body { background:#dbdadb url(css/bg-slice.jpg) center repeat-y; }
h1.title { font-family:»Lucida Sans Unicode», «Lucida Grande», sans-serif; border-bottom:1px solid #ccc; margin:40px 0px; font-weight:400; }
#container {  width:960px; margin-left:auto; margin-right:auto; margin-top:190px; }
#graph { padding-left:10px; width:800px}
.ui-widget-header { padding:10px; width:790px; margin-bottom:10px; margin-top:10px;}
</style>
</head>
<body>

/*Contenedor – Muestra el selector de estilos y el gráfico*/

<div id=»container»>
<div id=»switcher»></div>
<div id=»graph»>
</div>
</div>
</body>
<script type=»text/javascript»
src=»http://jqueryui.com/themeroller/themeswitchertool/»>
</script>
</html>

 

Via: pixelcoblog

Por admin

Deja una respuesta

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO