Graphs In Perl And flot.js

7,761 views

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
3 Comments
1 Like
Statistics
Notes
  • 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
       Reply 
    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.
       Reply 
    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
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
7,761
On SlideShare
0
From Embeds
0
Number of Embeds
81
Actions
Shares
0
Downloads
62
Comments
3
Likes
1
Embeds 0
No embeds

No notes for slide

Graphs In Perl And flot.js

  1. 1. Graphs for the Perl programmer?! by Phil Whelan Van.pm 9th July 2009
  2. 2. Resources CPAN http://birmingham.pm.org/talks/ barbie/graphing/ Van.pm 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 http://birmingham.pm.org/talks/barbie/graphing/
  5. 5. Graph::GD It ain’t pretty Images blatantly stolen from http://birmingham.pm.org/talks/barbie/graphing/
  6. 6. Graph::GD Does 3D!! Images blatantly stolen from http://birmingham.pm.org/talks/barbie/graphing/
  7. 7. Graph::GD It still ain’t pretty Images blatantly stolen from http://birmingham.pm.org/talks/barbie/graphing/
  8. 8. Chart::ThreeD::Pie Still uses GD Images blatantly stolen from http://birmingham.pm.org/talks/barbie/graphing/
  9. 9. Chart::Gnuplot gnuplot is powerful! Images blatantly stolen from http://www.gnuplot.info/
  10. 10. Chart::Gnuplot Still fugly for simple graphs Images blatantly stolen from http://www.gnuplot.info/
  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 http://birmingham.pm.org/talks/barbie/graphing/
  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 http://birmingham.pm.org/talks/barbie/graphing/
  15. 15. Chart::Clicker http://www.onemogin.com/clicker/ Nice graphs in Perl! Export as PNG, SVG, PDF and PostScript Images blatantly stolen from http://www.onemogin.com/clicker/
  16. 16. Chart::Clicker Example code Images blatantly stolen from http://birmingham.pm.org/talks/barbie/graphing/
  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 http://code.google.com/p/flot/ 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 http://people.iola.dk/olau/flot/examples/zooming.html MailChannels https://walla.wla.mailchannels.com/graph/walla/week
  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

×