Bienvenido a SOFTr utils. En este sitio encontrarás diversos recursos y/o utilidades para la programación nuestra de cada día, desarrolladas por SOFTr. Por ahora quizás verás uno que otro recurso, ya que vamos empezando, pero esperamos poder enriquecer a la brevedad esta sección. Podrás, además, encontrar múltiples tips, artículos, manuales y tutoriales relacionados todos con el mundo de la programación en el blog oficial de SOFTr, techNiq.

Último recurso de SOFTr utils:

Mayo 24

plOOtr

plOOtr

Actualización: Lista la versión 0.2.0!!!!

plOOtr es una librerí­a libre y gratuita para generar gráficas web utilizando el canvas html, y que está integrado totalmente con MooTools. Es realmente una adaptación de la librerí­a Plotr, la cual está integrada con Prototype, y que a su vez es una adaptación de PlotKit, que funciona con Mochikit.

Requerimientos:

Compatibilidad:

Cambios:

  • versión 0.20:
    • Optimización de código
    • Pueden usarse sombras
    • Gráficas de líneas sin relleno
    • Se agrega funcionalidad para mostrar leyendas
    • Se agrega a las gráficas la propiedad “showInSide“. Por default está en false y las leyendas se muestran en la parte inferior de las gráficas, al ponerla en true se muestra en la parte de un costado, a la derecha.

Descarga:

Instalación:

  1. Copiar la carpeta lib a tu proyecto
  2. Hacer la referencia a las librerias en la sección HEAD del documento.
    <script src=”lib/mootools/MT11.js” type=”text/javascript”></script>
    <script src=”lib/plotr/excanvas.js” type=”text/javascript”></script>
    <script src=”lib/plotr/Plotr.js” type=”text/javascript”></script>
  3. Poner el contenedor donde se visualizará el gráfico<div class=”graph”><canvas id=”plotr1″ height=”500″ width=”600″></canvas></div>
  4. Poner las opciones, y construir la gráfica. var Site={
    dataset1:{
    ‘myFirstDataset’: [[0, 1.4], [1, 3], [2, 1.414], [3, 1.73], [4, 2.56]]
    },
    options:{
    strokewidth: 1,
    backgroundColor: ‘#fff’,
    colorScheme: ‘blue’,
    xTicks: [{v:0, label:’Firefox’},
    {v:1, label:’Opera’},
    {v:2, label:’Safari’},
    {v:3, label:’IE6′},
    {v:4, label:’IE7′}
    ]
    },
    graph:function(){
    /*Se llama la instancia para la grafica, se le pasan los datos y se construye*/
    var pie = new Plotr.PieChart(’plotr1′,Site.options);
    pie.addDataset(Site.dataset1);
    pie.render();
    }
    /*Una vez listo el DOM, se llama la función que graficará*/
    window.addEvent(’domready’,Site.graph);
  5. Disfruta tus gráficas.

Documentación:

  • Por ahora básicamente es la de PlotKit, a la brevedad pondré una versión adaptada a plOOtr, resumida y en español.

Ejemplos(0.20):

Ejemplos(0.14):

Próximas mejoras:

  • Añadir eventos en las barras o en las rebanadas de las gráficas de barras y pastel, respectivamente.
9

comentarios a “plOOtr”

  1. Mike Marrone comenta:

    Hi,

    I’d like to first thank you for taking the time to port over this great library to Mootools.

    I am currently using it for a project I am developing, and was wondering if you were looking for contributing help. I am willing to help out if you are looking for some. Please let me know anyway I can contribute.

    If not, may I ask for a few updates to be included in the next release?

    1:
    For bar charts, it would be nice to be able to specify diffent colors for each bar in a single dataset. I had to modify the core code to achieve this with one line (line 1261 of uncompressed version):
    cx.fillStyle = $type(this.options.colorScheme[bar.name]) == ’string’ ? this.options.colorScheme[bar.name] : this.options.colorScheme[bar.name][index];
    Basically it mimics the old behaviour, but you can also pass in an array of colors for a single dataset.

    Also, I found that when updating a graph dynamically, the old labels were not removed. I had to manually remove them myself.
    $ES(’div’,$(’line-chart-canvas’)).each(function(el){el.remove();});
    Maybe I am just doing something wrong, but it might be nice if that were called in the reset() method.

    Anyways, please accept my thanks for the great work, and I am more than willing to help contribute if you are looking for help.

    Thanks again
    Mike Marrone

  2. Chad Smith comenta:

    I was hoping someone had some nice graphs for mootools, great work. Is there a way to add opacity so when shouldFill is true one set is visible if it drops below another set?

  3. David comenta:

    Gran trabajo !

    Solo una sugerencia: cuando el ancho ( o alto ) del se define con JavaScript ( $(’canvas’).setStyle(’width’, 500); ) en vez de a traves de la propia etiqueta ( width=”500″ ), el grafico sale distorsionado porque no detecta correctamente las dimensiones del canvas.

    Esto es útil para crear gráficas donde el ancho sea un porcentaje del ancho disponible, que se calcula a través de JavaScript. Estaría bien arreglar ese detalle…

    Espero haberme explicado…

  4. Brad Jones comenta:

    English Please!!!!! I would really like to uses this project but can’t seem to find any English Documentation.

  5. Metal3d comenta:

    I have worked about another way to use you class. This is documented into: http://www.copix.org/index.php/wiki/Mootools/Charts/en

    You could get my tabletochart.js in Copix CVS tree :
    http://adullact.net/plugins/scmcvs/cvsweb.php/Copix_3/www/js/mootools/plugins/?cvsroot=copix#dirlist

  6. Kovo comenta:

    it would be cool to have an option to show an effect….say if its a bar chart, we can see each bar raise up to its proper size. Its just adding an effect to the chart, it would be cool

    Good job though.

  7. JoshW comenta:

    How do you use a define a custom color scheme in the options (defining individual color hex values rather than a generated gradient)? The syntax used in plotr3.0 doesn’t work. I’ve been scouring through the code and can’t seem to figure it out.

  8. Jonathan Schemoul comenta:

    Someone knows if there is a mootools 1.2 port of plootr ? :)

  9. Metal3d comenta:

    Ok, there’s some bug and i want to port plootr to Mootools 1,2.

    Plotr has new version, Plootr isn’t still supported ?

    If you can help me to explain what you did to port Plotr to Plootr (mootools), I will be glade to continue development.

    Regards,

Por favor, escríbenos tu opinión