From 97c007d136346a6375f7ee1b392200d2a5a2d3a4 Mon Sep 17 00:00:00 2001 From: miker Date: Sat, 19 Nov 2005 05:15:27 +0000 Subject: [PATCH 1/1] trim "0" results from graphs (but not from raw data) git-svn-id: svn://svn.open-ils.org/ILS/trunk@2091 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/clark-kent.pl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 2681ab1678..bcd7622eff 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -416,22 +416,38 @@ sub draw_bars { my @leg; my $set = 1; + my %trim_candidates; + my $max_y = 0; for my $vcol (@values) { next unless (defined $vcol); push @leg, $settings->{columns}->[$vcol]; + my $pos = 0; for my $row (@$data) { my $val = $$row[$vcol] ? $$row[$vcol] : 0; push @{$pic_data[$set]}, $val; $max_y = $val if ($val > $max_y); + $trim_candidates{$pos}++ if ($val == 0); + $pos++; } $set++; } + my $set_count = scalar(@pic_data) - 1; + my @trim_cols = grep { $trim_candidates{$_} == $set_count } keys %trim_candidates; + + for my $dataset (@pic_data) { + for my $col (reverse sort { $a <=> $b } @trim_cols) { + splice(@$dataset,$col,1); + } + } + + my $w = 100 + 10 * scalar(@{$pic_data[0]}); + $w = 400 if ($w < 400); - my $pic = new GD::Graph::bars3d (100 + 10 * scalar(@$data), 500); + my $pic = new GD::Graph::bars3d ($w, 500); $pic->set( title => $p->{reportname}, -- 2.43.2