App-Widget-ChartDirector
view release on metacpan or search on metacpan
lib/App/Widget/ChartDirector.pm view on Meta::CPAN
my $options = $context->{options};
my $spec_tempdir = $options->{tempdir} || "$options->{prefix}/tmp";
my $image_tempdir = "$options->{html_dir}/temp";
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon++;
$year += 1900;
my $datetime = sprintf("%04d%02d%02d-%02d%02d%02d", $year, $mon, $mday, $hour, $min, $sec);
my $unique_tag = $datetime . "-" . $$ . "-" . $serial;
my $spec_file = "$unique_tag.graph";
my $spec_path = "$spec_tempdir/$spec_file";
my $image_file = "$unique_tag.png";
my $image_path = "$image_tempdir/$image_file";
while (-f $spec_path || -f $image_path) {
$serial++;
$unique_tag = $datetime . "-" . $$ . "-" . $serial;
$spec_file = "$unique_tag.graph";
$spec_path = "$spec_tempdir/$spec_file";
$image_file = "$unique_tag.png";
$image_path = "$image_tempdir/$image_file";
}
my %spec = %$self;
delete $spec{context};
$spec{graphtype} ||= "bar";
if ($spec{graphtype} eq "area") {
$spec{graphtype} = "line";
$spec{area} = 1;
}
elsif ($spec{graphtype} eq "stacked_bar") {
( run in 1.625 second using v1.01-cache-2.11-cpan-df04353d9ac )