Graphs In Perl And flot.js


Published on

A look at what is available to create graphs for Perl programmers, leading into what is flot.js and why I, as a Perl programmer, use it to create graph for my web applications. flot.js is a jQuery (javascript) based graphing renderer.

Published in: Technology, Education
1 Like
  • Thanks for such a nice presentation Phil

    I have been banging my head over for long time to make perl and jquery work together
    but i have no clue where i am going wrong. I am using CGI::Application and HTML::Template
    with it. It will b great if you can post some example here for the same
    Are you sure you want to  Yes  No
    Your message goes here
  • I use Catalyst web framework, encode Perl data structure using JSON::XS and set as the response body, set the content type as application/json and use jQuery on the browser side.
    Are you sure you want to  Yes  No
    Your message goes here
  • Phil,

    Thanks for the nice presentation. Can you share some examples of how your Perl script sends JSON data to HTML/JavaScript?

    Bob Wang
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Graphs In Perl And flot.js

  1. 1. Graphs for the Perl programmer?! by Phil Whelan 9th July 2009
  2. 2. Resources CPAN barbie/graphing/ mailing list! External tools - Excel, Java...
  3. 3. Perl Modules GD::Graph Chart::ThreeD::Pie Chart::Gnuplot SVGGraph::Pie Chart::Clicker
  4. 4. Graph::GD Does the job Images blatantly stolen from
  5. 5. Graph::GD It ain’t pretty Images blatantly stolen from
  6. 6. Graph::GD Does 3D!! Images blatantly stolen from
  7. 7. Graph::GD It still ain’t pretty Images blatantly stolen from
  8. 8. Chart::ThreeD::Pie Still uses GD Images blatantly stolen from
  9. 9. Chart::Gnuplot gnuplot is powerful! Images blatantly stolen from
  10. 10. Chart::Gnuplot Still fugly for simple graphs Images blatantly stolen from
  11. 11. Work-arounds I’ve done the past Faking anti-aliasing Required Resized 500x700 500x700 Rendered 2000x2800 use Image::Resize; use GD::Graph::pie;
  12. 12. Work-arounds I’ve looked at in the past Using Java Using Excel
  13. 13. SVGGraph::Pie Vector graphics! Images blatantly stolen from
  14. 14. SVGGraph::Pie Requires SVG client browser “As of 2009, all major Windows browsers have committed to some level of SVG support, except for Internet Explorer even as of version 8” -wikipedia Images blatantly stolen from
  15. 15. Chart::Clicker Nice graphs in Perl! Export as PNG, SVG, PDF and PostScript Images blatantly stolen from
  16. 16. Chart::Clicker Example code Images blatantly stolen from
  17. 17. Chart::Clicker Conclusion By far the best graphing Perl package available Portal graph images Graphs are static once produced Greater control over rendering graphs Written in Perl - let’s hack!
  18. 18. flot.js It’s not Perl?! - don’t hurt me, please Supports IE6, IE7, IE8 (development version), Firefox 2.x+, Safari 3.0+, Opera 9.5+ and Konqueror 4.x+
  19. 19. flot.js So pretty. See the shadows?
  20. 20. flot.js No JavaScript diploma required HTML DIV JSON Data Render
  21. 21. flot.js Con - web-browser dependant Con - cannot automate exporting images as PNG, GIF easily
  22. 22. flot.js Pro - quick to render Pro - interactive, relative to user Pro - does not look out-of-place in your Web 2.0 application Pro - low bandwidth and ser ver CPU- time for ser ving up graphing
  23. 23. flot.js Demo Zooming MailChannels
  24. 24. flot.js Conclusion Ideal partner for Ajax to make graphs very interactive Not for exporting images (see Chart::Clicker) Yes, it even works on your iPhone!
  25. 25. Conclusion Conclusion Use Chart::Clicker for rendering on the ser ver and producing static images Use Chart::Clicker to protect your raw data Use flot.js if you want to do some cool interactive graphing within the browser Use flot.js if you want your web designers to control how your graphs look