theravadamonk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Perl monks
I got this code from below URL
https://metacpan.org/pod/release/JMCNAMARA/Excel-Writer-XLSX-0.94/lib/Excel/Writer/XLSX/Chart/Doughnut.pm
#!/usr/bin/perl use strict; use warnings; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new( 'chart_doughnut.xlsx' ); my $worksheet = $workbook->add_worksheet(); my $bold = $workbook->add_format( bold => 1 ); # Add the worksheet data that the charts will refer to. my $headings = [ 'Category', 'Values' ]; my $data = [ [ 'Glazed', 'Chocolate', 'Cream' ], [ 50, 35, 15 ], ]; $worksheet->write( 'A1', $headings, $bold ); $worksheet->write( 'A2', $data ); # Create a new chart object. In this case an embedded chart. my $chart = $workbook->add_chart( type => 'doughnut', embedded => 1 ); # Configure the series. Note the use of the array ref to define ranges +: # [ $sheetname, $row_start, $row_end, $col_start, $col_end ]. $chart->add_series( name => 'Doughnut sales data', categories => [ 'Sheet1', 1, 3, 0, 0 ], values => [ 'Sheet1', 1, 3, 1, 1 ], ); # Add a title. $chart->set_title( name => 'Popular Doughnut Types' ); # Set an Excel chart style. Colors with white outline and shadow. $chart->set_style( 10 ); # Insert the chart into the worksheet (with an offset). $worksheet->insert_chart( 'C2', $chart, 25, 10 );
When I run perl filename.cgi, it creates the chart_doughnut.xlsx file. I copied it to web root /var/ww/html/chart_doughnut.xlsx. while accessing http://ipaddress/chart_doughnut.xlsx, Excel file will be downloaded to my Pc. Then, I can view it.
What I need is TO display it's image doughnut chart via my web browser.. I think I expalined correctly..
How can I achive it? Pls help me.. It may be a MINOR task for perl monks..
I found below Urls. I tried them. But, I am stil going without Succuess.
https://www.perlmonks.org/?node_id=1025384
https://fastapi.metacpan.org/source/JMCNAMARA/Excel-Writer-XLSX-0.98/examples/cgi.pl
below code from this URl
https://metacpan.org/pod/Excel::Writer::XLSX#EXAMPLES
binmode( STDOUT ); my $workbook = Excel::Writer::XLSX->new( \*STDOUT );
expect your INPUTS
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to display the Excel::Writer::XLSX chart image to the web browser with CGI?
by marto (Cardinal) on Aug 03, 2018 at 11:18 UTC | |
by theravadamonk (Scribe) on Aug 03, 2018 at 11:49 UTC | |
by marto (Cardinal) on Aug 03, 2018 at 12:46 UTC | |
Re: How to display the Excel::Writer::XLSX chart image to the web browser with CGI?
by bliako (Abbot) on Aug 03, 2018 at 12:41 UTC |