X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fgraph%2Felements%2Freport.html;h=98b477826e63ff5180311b7e9adddda0608d75b0;hb=0bd09a9eff467033be42f922f2297a7b488e7dc1;hp=3773fbf1d53c124be3bdb16ef242036077127299;hpb=665109510114cf56e5ebd8eda0bef24b12ca41a2;p=freeside.git
diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html
index 3773fbf1d..98b477826 100644
--- a/httemplate/graph/elements/report.html
+++ b/httemplate/graph/elements/report.html
@@ -14,6 +14,7 @@ Example:
'graph_labels' => \@graph_labels, #defaults to row_labels
'links' => \@links, #optional
+ 'no_graph' => \@no_graph, #optional
#these run parallel to the elements of each @item
'col_labels' => \@col_labels, #required
@@ -77,15 +78,16 @@ any delimiter and linked from the elements in @data.
% }
%
% } elsif ( $cgi->param('_type') =~ /(xls)$/ ) {
-%
-% #http_header('Content-Type' => 'application/excel' ); #eww
-% http_header('Content-Type' => 'application/vnd.ms-excel' );
-% #http_header('Content-Type' => 'application/msexcel' ); #alas
-% http_header('Content-Disposition' => "attachment;filename=$filename.xls");
+% #false laziness w/ search/elements/search-xls
+% my $format = $FS::CurrentUser::CurrentUser->spreadsheet_format;
+% $filename .= $format->{extension};
+%
+% http_header('Content-Type' => $format->{mime_type} );
+% http_header('Content-Disposition' => qq!attachment;filename="$filename"! );
%
% my $output = '';
% my $XLS = new IO::Scalar \$output;
-% my $workbook = Spreadsheet::WriteExcel->new($XLS)
+% my $workbook = $format->{class}->new($XLS)
% or die "Error opening .xls file: $!";
%
% my $worksheet = $workbook->add_worksheet(substr($opt{'title'},0,31));
@@ -127,7 +129,19 @@ any delimiter and linked from the elements in @data.
%
<% $output %>
% } elsif ( $cgi->param('_type') eq 'png' ) {
-%
+% # delete any items that shouldn't be on the graph
+% if ( my $no_graph = $opt{'no_graph'} ) {
+% my $i = 0;
+% while (@$no_graph) {
+% if ( shift @$no_graph ) {
+% splice @data, $i, 1;
+% splice @{$opt{'graph_labels'}}, $i, 1;
+% splice @{$opt{'colors'}}, $i, 1;
+% $i--; # because everything is shifted down
+% }
+% $i++;
+% }
+% }
% my $graph_type = 'LinesPoints';
% if ( $opt{'graph_type'} =~ /^(LinesPoints|Mountain|Bars)$/ ) {
% $graph_type = $1;
@@ -135,7 +149,21 @@ any delimiter and linked from the elements in @data.
% my $class = "Chart::$graph_type";
%
% my $chart = $class->new(976,384);
-%
+% # the chart area itself is 900 pixels wide, and the date labels are ~60 each.
+% # staggered, we can fit about 28 of them.
+% # they're about 12 pixels high, so vertically, we can fit about 60 (allowing
+% # space for them to be readable).
+% # after that we have to start skipping labels. also remove the dots, since
+% # they're just a blob at that point.
+% my $num_labels = scalar(@{ $opt{axis_labels} });
+% my %chart_opt = %{ $opt{chart_options} || {} };
+% if ( $num_labels > 28 ) {
+% $chart_opt{x_ticks} = 'vertical';
+% if ( $num_labels > 60 ) {
+% $chart_opt{skip_x_ticks} = int($num_labels / 60) + 1;
+% $chart_opt{pt_size} = 1;
+% }
+% }
% my $d = 0;
% $chart->set(
% #'min_val' => 0,
@@ -152,6 +180,7 @@ any delimiter and linked from the elements in @data.
% },
% 'legend_labels' => $opt{'graph_labels'},
% 'brush_size' => 4,
+% %chart_opt,
% );
%
% http_header('Content-Type' => 'image/png' );
@@ -169,9 +198,10 @@ any delimiter and linked from the elements in @data.
<% include('/elements/header.html', $opt{'title'} ) %>
% unless ( $opt{'graph_type'} eq 'none' ) {
-" WIDTH="976" HEIGHT="384">
+
" WIDTH="976" HEIGHT="384"
+ STYLE="page-break-after:always;">
% }
-
+
-<% include('/elements/table.html', 'f8f8f8') %> - -