<p>How do I use Perl to create graphs?</p>

<p>I'm running scheduled job that creates text reports.  I'd like to move this to the next step (for the management) and also create some graphs that go along with this.  Is this possible / feasible?   It'd be great if I could do this using Office some how.</p>

<h2>update: solutions i'm going to investigate in this order</h2>

<ul>
<li>Spreadsheet::WriteExcel (this seems to now have changed from the last time i investigated this .... wait, this was suggested by the author of the module.  cool.)</li>
<li>GD Graph - this is now available for ActivePerl(wasn't last time i looked)</li>
<li>SVG</li>
<li>Open Charts look interesting.</li>
<li>Chartdirector</li>
</ul>

[{'answer_id': 64556, 'author': 'user8456', 'author_id': 8456, 'author_profile': 'https://Stackoverflow.com/users/8456', 'pm_score': 2, 'selected': False, 'text': '<pre><code>Spreadsheet::WriteExcel::Chart\n</code></pre>\n\n<p>You might need something like strawberry or vanilla Perl to get this to compile. Or PPM might have the module.</p>\n\n<p>Tutorial link:\n<a href="http://search.cpan.org/dist/Spreadsheet-WriteExcel/charts/charts.pod" rel="nofollow noreferrer">http://search.cpan.org/dist/Spreadsheet-WriteExcel/charts/charts.pod</a></p>\n'}, {'answer_id': 64566, 'author': 'shelfoo', 'author_id': 3444, 'author_profile': 'https://Stackoverflow.com/users/3444', 'pm_score': 3, 'selected': False, 'text': '<p>GD and GD::Graph are probably your best bets, you can use them to create images that you can then embed into whatever you need.</p>\n'}, {'answer_id': 64589, 'author': 'Anders Sandvig', 'author_id': 1709, 'author_profile': 'https://Stackoverflow.com/users/1709', 'pm_score': 2, 'selected': False, 'text': '<p>Depending on the complexity of your graph, simply generating a command file for <a href="http://www.gnuplot.info/" rel="nofollow noreferrer">Gnuplot</a>&mdash;or <a href="http://www.graphviz.org/" rel="nofollow noreferrer">GraphViz/Dotty</a>, depending on what kind of graph you are referring to&mdash;might do the trick? </p>\n'}, {'answer_id': 64601, 'author': 'Alister Bulman', 'author_id': 6216, 'author_profile': 'https://Stackoverflow.com/users/6216', 'pm_score': 2, 'selected': False, 'text': '<p>It depends to a great extent what sort of graphs (the look of them), and the data-source. I\'ve had some good result by using the <a href="http://developer.yahoo.com/yui/charts/" rel="nofollow noreferrer">YUI Charts</a> and feeding them some JSON style versions of the original source data. Rolling over a live chart for exact values is quite easy for example.  There are plenty of examples on the developer pages.</p>\n'}, {'answer_id': 64676, 'author': 'Dave Cross', 'author_id': 7231, 'author_profile': 'https://Stackoverflow.com/users/7231', 'pm_score': 3, 'selected': False, 'text': '<p>All of the methods mentioned above are really good, but personally I like <a href="http://search.cpan.org/dist/SVG-TT-Graph/" rel="noreferrer">SVG::TT::Graph</a>. I really like the power that SVG gives you to draw really nice-looking graphs.</p>\n'}, {'answer_id': 64731, 'author': 'Michael Carman', 'author_id': 8233, 'author_profile': 'https://Stackoverflow.com/users/8233', 'pm_score': 1, 'selected': False, 'text': '<p>If you\'re set on doing this in MS Office you can use the Win32::OLE module to control Excel via <a href="http://en.wikipedia.org/wiki/Object_Linking_and_Embedding" rel="nofollow noreferrer">OLE</a>. Be warned, that this tends to run slowly and it can be difficult to find documentation for Excel\'s API. On the plus side, it allows you to do pretty much everything that you can do manually.</p>\n'}, {'answer_id': 66276, 'author': 'Pat', 'author_id': 238, 'author_profile': 'https://Stackoverflow.com/users/238', 'pm_score': 3, 'selected': False, 'text': '<p>Also you can take a look at <a href="http://search.cpan.org/perldoc?Google::Chart" rel="noreferrer">Google Charts CPAN module</a></p>\n\n<pre><code>use Google::Chart;\n\n  my $chart = Google::Chart-&gt;new(\n    type =&gt; "Bar",\n    data =&gt; [ 1, 2, 3, 4, 5 ]\n  );\n\n  print $chart-&gt;as_uri, "\\n"; # or simply print $chart, "\\n"\n\n  $chart-&gt;render_to_file( filename =&gt; \'filename.png\' );\n</code></pre>\n'}, {'answer_id': 66963, 'author': 'ollyg', 'author_id': 4871, 'author_profile': 'https://Stackoverflow.com/users/4871', 'pm_score': 3, 'selected': False, 'text': '<p>At work we have used the excellent <a href="http://www.advsofteng.com/" rel="noreferrer">Chartdirector</a>.</p>\n\n<p>It\'s not free, but is very cheap (maybe 50 bucks or so). The cost is well worth it, as the API and docs are both excellent (way better than GD!), so easily saved more than that amount of my time.</p>\n\n<p>There\'s also a free version, which includes a small yellow banner advertising the product on each chart - to be honest if this is for personal use, you can go for that as it\'s really not very intrusive at all.</p>\n\n<p>Chartdirector is available for lots of platforms (Win, Linux, Solaris, BSD, OSX) and has an API for lots of languages, too (Perl, ASP, .NET, Java, PHP, Python, Ruby, C++).</p>\n\n<p>The output is easy on the eye, as you can see at <a href="http://www.advsofteng.com/gallery.html" rel="noreferrer">their examples page</a>.</p>\n'}, {'answer_id': 67502, 'author': 'jmcnamara', 'author_id': 10238, 'author_profile': 'https://Stackoverflow.com/users/10238', 'pm_score': 2, 'selected': False, 'text': '<p>The Perl module <a href="http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/" rel="nofollow noreferrer">Spreadsheet::WriteExcel</a> allows you to create Excel workbooks that include charts.</p>\n\n<p>You first have to create the type of chart that you want in Excel and then extract it out using a utility called <a href="http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/bin/chartex" rel="nofollow noreferrer">chartex</a> which is installed with Spreadsheet::WriteExcel.</p>\n\n<p>The chart template can then be added to a new workbook and made to reference new data.</p>\n\n<p>The documentation is <a href="http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/charts/charts.pod" rel="nofollow noreferrer">here</a> and there are <a href="http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.25/charts/README" rel="nofollow noreferrer">several examples</a> in the charts directory of the distro.</p>\n\n<p>The mechanism is a little inflexible however and the it is sometimes tricky to get the exact result that you want.</p>\n'}, {'answer_id': 75062, 'author': 'Mark Grimes', 'author_id': 13233, 'author_profile': 'https://Stackoverflow.com/users/13233', 'pm_score': 2, 'selected': False, 'text': '<p>It won\'t work with Office, but I really like <a href="http://search.cpan.org/~drolsky/Chart-OFC-0.08/lib/Chart/OFC.pm" rel="nofollow noreferrer">Chart::OFC</a> which will create <a href="http://teethgrinder.co.uk/open-flash-chart/" rel="nofollow noreferrer">Open Flash Charts</a>. Very slick looking and easy to use.</p>\n'}, {'answer_id': 84540, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://search.cpan.org/dist/Spreadsheet-WriteExcel" rel="nofollow noreferrer">Spreadsheet::WriteExcel</a> will let you just get the data into Excel, then write Excel equations for the graphs.</p>\n'}, {'answer_id': 104752, 'author': 'Barbie', 'author_id': 12647, 'author_profile': 'https://Stackoverflow.com/users/12647', 'pm_score': 2, 'selected': False, 'text': '<p>Sorry for blowing my own trumpet, but you might be interested to have a look some slides I did for a short presentation about <a href="http://birmingham.pm.org/talks/barbie/graphing/index.html" rel="nofollow noreferrer">Graphing With Perl</a>.</p>\n\n<p>It mentions some of the suggestions here, but also gives you some code snippets that you might be able to use to help you get the most of what you\'re doing.</p>\n'}, {'answer_id': 181908, 'author': 'draegtun', 'author_id': 12195, 'author_profile': 'https://Stackoverflow.com/users/12195', 'pm_score': 2, 'selected': False, 'text': '<p>Haven\'t tried it yet but <a href="http://search.cpan.org/dist/Chart-Clicker/lib/Chart/Clicker.pm" rel="nofollow noreferrer">Chart::Clicker</a> looks quite nifty.</p>\n\n<p>I think it uses the Cairo graphic library (alternative to GD) but is actually built on top of <a href="http://search.cpan.org/dist/Graphics-Primitive/lib/Graphics/Primitive.pm" rel="nofollow noreferrer">Graphics::Primitive</a> which is an "interesting" graphics agnostic package.</p>\n\n<p>The author in question (<a href="http://search.cpan.org/~gphat/" rel="nofollow noreferrer">GPHAT</a>) seems to be putting together some integrated tools for producing reports... <a href="http://www.onemogin.com/blog/582-pixels-and-painting-my-recent-cpan-releases" rel="nofollow noreferrer">http://www.onemogin.com/blog/582-pixels-and-painting-my-recent-cpan-releases</a></p>\n\n<p>On a side note... have used both ChartDirector and OFC and both are good (especially if web based).</p>\n'}, {'answer_id': 212934, 'author': 'Rob Kam', 'author_id': 25093, 'author_profile': 'https://Stackoverflow.com/users/25093', 'pm_score': 1, 'selected': False, 'text': '<p>PGPlot does great graphs. There are some <a href="http://www.astro.caltech.edu/%7Etjp/pgplot/example.html" rel="nofollow noreferrer">examples here</a>. It works fine with Perl 5.8.8 but is broken in 5.10.0</p>\n'}, {'answer_id': 212980, 'author': 'Watson Ladd', 'author_id': 29025, 'author_profile': 'https://Stackoverflow.com/users/29025', 'pm_score': 1, 'selected': False, 'text': '<p>Metaprograming of course! Output an R script that creates the graph.</p>\n'}]
['https://Stackoverflow.com/questions/64537', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8676/']