From Patrick Michaud:
authorpmichaud <pmichaud@pobox.com>
Thu, 21 May 2009 07:18:44 +0000 (07:18 +0000)
committerTony Cook <tony@develop-help.com>
Thu, 21 May 2009 07:18:44 +0000 (07:18 +0000)
This one makes it so bars and columns use the fill
styles instead of the flat colors.  It also improves the light color in
the ocean style, and adds an ocean_flat style.

Graph.pm
lib/Imager/Graph/Horizontal.pm
lib/Imager/Graph/Vertical.pm

index a9aaec2a95905d8983b482c26ab1fbfc7f7b335e..f1f545972c5ec69285f2ce9af183e093e69d4bdf 100644 (file)
--- a/Graph.pm
+++ b/Graph.pm
@@ -1438,49 +1438,49 @@ $styles{'ocean'} = {
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('E6E2AF') ]),
+                                                    colors=>[ NC('EFEDCF'), NC('E6E2AF') ]),
             },
              {
               fountain =>'linear',
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('A7A37E') ]),
+                                                    colors=>[ NC('DCD7AB'), NC('A7A37E') ]),
             },
              {
               fountain =>'linear',
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('80B4A2') ]),
+                                                    colors=>[ NC('B2E5D4'), NC('80B4A2') ]),
             },
             {
               fountain =>'linear',
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('046380') ]),
+                                                    colors=>[ NC('7aaab9'), NC('046380') ]),
             },
             {
               fountain =>'linear',
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('877EA7') ]),
+                                                    colors=>[ NC('c3b8e9'), NC('877EA7') ]),
             },
             {
               fountain =>'linear',
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('67A35E') ]),
+                                                    colors=>[ NC('A3DF9A'), NC('67A35E') ]),
             },
             {
               fountain =>'linear',
               xa_ratio => 0, ya_ratio=>0, xb_ratio=>1.0, yb_ratio=>1.0,
               segments => Imager::Fountain->simple(
                                                     positions=>[0, 1],
-                                                    colors=>[ NC('FFFFFF'), NC('B4726F') ]),
+                                                    colors=>[ NC('E19C98'), NC('B4726F') ]),
             },
     ],
     colors  => [
@@ -1493,6 +1493,22 @@ $styles{'ocean'} = {
 
 };
 
+$styles{'ocean_flat'} = {
+    fills=>
+    [
+     qw(E6E2AF A7A37E 80B4A2 046380 877EA7 67A35E B4726F)
+    ],
+    colors  => [
+     qw(E6E2AF A7A37E 80B4A2 046380 877EA7 67A35E B4726F)
+    ],
+    fg=>'000000',
+    negative_bg=>'EEEEEE',
+    bg=>'FFFFFF',
+    features=>{ dropshadow=>1 },
+
+};
+
+
 =item $self->_style_setup(\%opts)
 
 Uses the values from %opts to build a customized hash describing the
index d083fbe513da3df695be5a9d2e92e8a34ac5948a..f143d01a02c7e1f864606837302eace18b0cb5a8 100644 (file)
@@ -498,7 +498,6 @@ sub _draw_bars {
     my $series = $col_series->[$series_pos];
     my @data = @{$series->{'data'}};
     my $data_size = scalar @data;
-    my $color = $self->_data_color($series_counter);
     for (my $i = 0; $i < $data_size; $i++) {
 
       my $y1 = int($bottom + $bar_height * (scalar @$col_series * $i + $series_pos)) + scalar @$col_series * $i + $series_pos + ($column_padding / 2);
@@ -509,9 +508,9 @@ sub _draw_bars {
 
       my $color = $self->_data_color($series_counter);
 
-    #  my @fill = $self->_data_fill($series_counter, [$x1, $y1, $x2, $zero_position]);
       if ($data[$i] > 0) {
-        $img->box(xmax => $x1, xmin => $zero_position+1, ymin => $y1, ymax => $y2, color => $color, filled => 1);
+        my @fill = $self->_data_fill($series_counter, [$zero_position+1, $y1, $x1, $y2]);
+        $img->box(xmax => $x1, xmin => $zero_position+1, ymin => $y1, ymax => $y2, @fill);
         if ($style->{'features'}{'outline'}) {
           $img->box(xmax => $x1, xmin => $zero_position, ymin => $y1, ymax => $y2, color => $outline_color);
         }
@@ -519,7 +518,8 @@ sub _draw_bars {
       elsif ($data[$i] == 0) {
       }
       else {
-        $img->box(xmax  => $zero_position , xmin => $x1, ymin => $y1, ymax => $y2, color => $color, filled => 1);
+        my @fill = $self->_data_fill($series_counter, [$x1, $y1, $zero_position, $y2]);
+        $img->box(xmax  => $zero_position , xmin => $x1, ymin => $y1, ymax => $y2, @fill);
         if ($style->{'features'}{'outline'}) {
           $img->box(xmax => $zero_position, xmin => $x1, ymin => $y1, ymax => $y2, color => $outline_color);
         }
index b152d758fad0bc758edad40b443adf6c5b668ac2..2dcf2d1441b9b45bc776f9e8dddd0543ccea7202 100644 (file)
@@ -666,7 +666,6 @@ sub _draw_columns {
     my $series = $col_series->[$series_pos];
     my @data = @{$series->{'data'}};
     my $data_size = scalar @data;
-    my $color = $self->_data_color($series_counter);
     for (my $i = 0; $i < $data_size; $i++) {
       my $x1 = int($left + $bar_width * (scalar @$col_series * $i + $series_pos)) + scalar @$col_series * $i + $series_pos + ($column_padding / 2);
       if ($has_stacked_columns) {
@@ -678,15 +677,16 @@ sub _draw_columns {
 
       my $color = $self->_data_color($series_counter);
 
-    #  my @fill = $self->_data_fill($series_counter, [$x1, $y1, $x2, $zero_position]);
       if ($data[$i] > 0) {
-        $img->box(xmin => $x1, xmax => $x2, ymin => $y1, ymax => $zero_position-1, color => $color, filled => 1);
+        my @fill = $self->_data_fill($series_counter, [$x1, $y1, $x2, $zero_position-1]);
+        $img->box(xmin => $x1, xmax => $x2, ymin => $y1, ymax => $zero_position-1, @fill);
         if ($style->{'features'}{'outline'}) {
           $img->box(xmin => $x1, xmax => $x2, ymin => $y1, ymax => $zero_position, color => $outline_color);
         }
       }
       else {
-        $img->box(xmin => $x1, xmax => $x2, ymin => $zero_position+1, ymax => $y1, color => $color, filled => 1);
+        my @fill = $self->_data_fill($series_counter, [$x1, $zero_position+1, $x2, $y1]);
+        $img->box(xmin => $x1, xmax => $x2, ymin => $zero_position+1, ymax => $y1, @fill);
         if ($style->{'features'}{'outline'}) {
           $img->box(xmin => $x1, xmax => $x2, ymin => $zero_position+1, ymax => $y1+1, color => $outline_color);
         }
@@ -746,7 +746,6 @@ sub _draw_stacked_columns {
   foreach my $series (@$col_series) {
     my @data = @{$series->{'data'}};
     my $data_size = scalar @data;
-    my $color = $self->_data_color($series_counter);
     for (my $i = 0; $i < $data_size; $i++) {
       my $x1 = int($left + $bar_width * ($column_series * $i)) + $column_series * $i + ($column_padding / 2);
       my $x2 = $x1 + $bar_width - $column_padding;
@@ -754,13 +753,15 @@ sub _draw_stacked_columns {
       my $y1 = int($bottom + ($value_range - $data[$i] + $min_value)/$value_range * $graph_height);
 
       if ($data[$i] > 0) {
-        $img->box(xmin => $x1, xmax => $x2, ymin => $y1, ymax => $zero_position-1, color => $color, filled => 1);
+        my @fill = $self->_data_fill($series_counter, [$x1, $y1, $x2, $zero_position-1]);
+        $img->box(xmin => $x1, xmax => $x2, ymin => $y1, ymax => $zero_position-1, @fill);
         if ($style->{'features'}{'outline'}) {
           $img->box(xmin => $x1, xmax => $x2, ymin => $y1, ymax => $zero_position, color => $outline_color);
         }
       }
       else {
-        $img->box(xmin => $x1, xmax => $x2, ymin => $zero_position+1, ymax => $y1, color => $color, filled => 1);
+        my @fill = $self->_data_fill($series_counter, [$x1, $zero_position+1, $x2, $y1]);
+        $img->box(xmin => $x1, xmax => $x2, ymin => $zero_position+1, ymax => $y1, @fill);
         if ($style->{'features'}{'outline'}) {
           $img->box(xmin => $x1, xmax => $x2, ymin => $zero_position+1, ymax => $y1+1, color => $outline_color);
         }