coef=>[0.1, 0.2, 0.4, 0.6, 0.7, 0.9, 1.2,
0.9, 0.7, 0.6, 0.4, 0.2, 0.1 ] },
},
+ # controls the outline of graph elements representing data, eg. pie
+ # slices, bars or columns
outline => {
line =>'lookup(line)',
lineaa => 'lookup(lineaa)',
},
+ # controls the outline and background of the data area of the chart
+ graph =>
+ {
+ fill => "lookup(bg)",
+ outline => "lookup(fg)",
+ },
size=>256,
width=>'scale(1.5,size)',
height=>'lookup(size)',
}
# features are handled specially
- $work{features} = {};
+ my %features;
+ $work{features} = \%features;
for my $src (@search_list) {
if ($src->{features}) {
if (ref $src->{features}) {
if (ref($src->{features}) =~ /ARRAY/) {
# just set those features
for my $feature (@{$src->{features}}) {
- $work{features}{$feature} = 1;
+ if ($feature =~ /^no(.+)$/) {
+ delete $features{$1};
+ }
+ else {
+ $features{$feature} = 1;
+ }
}
}
elsif (ref($src->{features}) =~ /HASH/) {
}
}
}
- #use Data::Dumper;
- #print Dumper(\%work);
$self->{_style} = \%work;
}
my $tic_distance = ($graph_height-1) / ($tic_count - 1);
$graph_height = int($tic_distance * ($tic_count - 1));
- my $bottom = $chart_box[1];
- my $left = $chart_box[0];
+ my $top = $chart_box[1];
+ my $left = $chart_box[0];
$self->{'_style'}{'graph_width'} = $graph_width;
$self->{'_style'}{'graph_height'} = $graph_height;
- my @graph_box = ($left, $bottom, $left + $graph_width, $bottom + $graph_height);
+ my @graph_box = ($left, $top, $left + $graph_width, $top + $graph_height);
$self->_set_graph_box(\@graph_box);
- $img->box(
- color => $self->_get_color('outline.line'),
- xmin => $left,
- xmax => $left+$graph_width,
- ymin => $bottom,
- ymax => $bottom+$graph_height,
- );
+ my @fill_box = ( $left, $top, $left+$graph_width, $top+$graph_height );
+ if ($self->{_style}{features}{graph_outline}) {
+ $img->box(
+ color => $self->_get_color('graph.outline'),
+ xmin => $left,
+ xmax => $left+$graph_width,
+ ymin => $top,
+ ymax => $top+$graph_height,
+ );
+ ++$fill_box[0];
+ ++$fill_box[1];
+ --$fill_box[2];
+ --$fill_box[3];
+ }
$img->box(
- color => $self->_get_color('bg'),
- xmin => $left + 1,
- xmax => $left+$graph_width - 1,
- ymin => $bottom + 1,
- ymax => $bottom+$graph_height-1 ,
- filled => 1,
+ $self->_get_fill('graph.fill'),
+ box => \@fill_box,
);
my $min_value = $self->_get_min_value();
my $zero_position;
if ($value_range) {
- $zero_position = $bottom + $graph_height - (-1*$min_value / $value_range) * ($graph_height-1);
+ $zero_position = $top + $graph_height - (-1*$min_value / $value_range) * ($graph_height-1);
}
if ($min_value < 0) {
xmin => $left + 1,
xmax => $left+$graph_width- 1,
ymin => $zero_position,
- ymax => $bottom+$graph_height - 1,
+ ymax => $top+$graph_height - 1,
filled => 1,
);
$img->line(
{
opacity => 0.5,
};
+ push @{$work{features}}, qw/graph_outline graph_fill/;
return \%work;
}
+sub _composite {
+ my ($self) = @_;
+ return ( $self->SUPER::_composite(), "graph" );
+}
+
1;