r43605 - in /branches/upstream/svg-tt-graph/current: ./ lib/SVG/TT/ lib/SVG/TT/Graph/

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Thu Sep 3 21:11:09 UTC 2009


Author: ryan52-guest
Date: Thu Sep  3 21:10:53 2009
New Revision: 43605

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43605
Log:
[svn-upgrade] Integrating new upstream version, svg-tt-graph (0.12)

Modified:
    branches/upstream/svg-tt-graph/current/Changes
    branches/upstream/svg-tt-graph/current/META.yml
    branches/upstream/svg-tt-graph/current/generate_examples_pl
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph.pm
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Bar.pm
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarHorizontal.pm
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarLine.pm
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Line.pm
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Pie.pm
    branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/TimeSeries.pm
    branches/upstream/svg-tt-graph/current/timeseries_pl

Modified: branches/upstream/svg-tt-graph/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/Changes?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/Changes (original)
+++ branches/upstream/svg-tt-graph/current/Changes Thu Sep  3 21:10:53 2009
@@ -1,11 +1,24 @@
 Revision history for Perl extension SVG::TT::Graph.
 
-TODO - probably!
-	- max_scale_value
-	- format of scale & data values (e.g.  34,333.32)
-	- extra padding on right for long x labels
-	- Fix bug when text hides in pie chart if opacity off
+0.12 - Mon Feb 16 12:00:00 EST 2009
+    Missed updating the versions for some of the sub libraries.
 
+0.11 - Sun Feb 15 22:54:00 EST 2009
+    Applied patches:
+    http://rt.cpan.org/Ticket/Display.html?id=38441 - Ampersands in Fields cause XML error
+    http://rt.cpan.org/Ticket/Display.html?id=43326 - Multiple data sets in Bar.pm will now show stacked graphs
+    http://rt.cpan.org/Ticket/Display.html?id=43325 - Allow toggling the display of data on TimeSeries
+
+0.10 - Mon Apr 28 21:07:30 BST 2008
+ 	Applied patched:
+	http://rt.cpan.org/Ticket/Display.html?id=34491
+	http://rt.cpan.org/Ticket/Display.html?id=22896
+	http://rt.cpan.org/Ticket/Display.html?id=20828
+	http://rt.cpan.org/Ticket/Display.html?id=20475
+
+0.09	- Applied path patch for Firefox from Pat Ekman for Pie
+	- patched other modules so Firefox works (doesn't like comma's in a path)
+	
 0.08
 	- Fix stylesheet for Pie
 

Modified: branches/upstream/svg-tt-graph/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/META.yml?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/META.yml (original)
+++ branches/upstream/svg-tt-graph/current/META.yml Thu Sep  3 21:10:53 2009
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         SVG-TT-Graph
-version:      0.08
+version:      0.12
 version_from: lib/SVG/TT/Graph.pm
 installdirs:  site
 requires:
@@ -10,4 +10,4 @@
     Template:                      2.08
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.25
+generated_by: ExtUtils::MakeMaker version 6.30

Modified: branches/upstream/svg-tt-graph/current/generate_examples_pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/generate_examples_pl?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/generate_examples_pl (original)
+++ branches/upstream/svg-tt-graph/current/generate_examples_pl Thu Sep  3 21:10:53 2009
@@ -5,7 +5,7 @@
 # More example will be added for the next release.
 # See http://leo.cuckoo.org/projects/SVG-TT-Graph/ for more
 
-use lib qw( ./blib/lib ../blib/lib );
+use lib qw( ./lib ./blib/lib ../blib/lib );
 use SVG::TT::Graph::Bar;
 use SVG::TT::Graph::BarHorizontal;
 use SVG::TT::Graph::Line;

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph.pm Thu Sep  3 21:10:53 2009
@@ -6,7 +6,7 @@
 use Template;
 use POSIX;
 
-$VERSION = '0.08';
+$VERSION = '0.12';
 
 # set up TT object
 my %config = (
@@ -151,7 +151,7 @@
 
 	if(defined $conf->{'data'} && ref($conf->{'data'}) eq 'ARRAY') {
 		my %new_data;
-		@new_data{@{$self->{'config'}->{'fields'}}} = @{$conf->{'data'}};
+		@new_data{ map { s/&/&/; $_ } @{$self->{'config'}->{'fields'}}} = @{$conf->{'data'}};
 		my %store = (
 			'data' => \%new_data,
 		);
@@ -365,6 +365,7 @@
 Thanks to Foxtons for letting us put this on CPAN.
 Todd Caine for heads up on reparsing the template (but not using atm)
 David Meibusch for TimeSeries and a load of other ideas
+Thanks for all the patches supplied by Andrew Ruthven and others
 
 =head1 AUTHOR
 

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Bar.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Bar.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Bar.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Bar.pm Thu Sep  3 21:10:53 2009
@@ -3,7 +3,7 @@
 use strict;
 use Carp;
 use vars qw($VERSION);
-$VERSION = '0.07';
+$VERSION = '0.11';
 
 use SVG::TT::Graph;
 use base qw(SVG::TT::Graph);
@@ -569,17 +569,22 @@
 			[% max_x_label_size = field.length %]
 		[% END %]
 		
+        [% max_y_value = 0 %]
 		[% FOREACH dataset = data %]
-			[% IF min_value > dataset.data.$field && dataset.data.$field != '' %]
-				[% min_value = dataset.data.$field %]
-			[% END %]
-			[% IF max_value < dataset.data.$field && dataset.data.$field != '' %]
-				[% max_value = dataset.data.$field %]
-			[% END %]
+            [% IF dataset.data.$field != '' %]
+                [% max_y_value = max_y_value + dataset.data.$field %]
+            [% END %]
 			[% IF max_key_size < dataset.title.length %]
 				[% max_key_size = dataset.title.length %]
 			[% END %]
 		[% END %]
+
+		[% IF min_value > max_y_value %]
+			[% min_value = max_y_value %]
+		[% END %]
+		[% IF max_value < max_y_value %]
+			[% max_value = max_y_value %]
+		[% END %] -->
 	[% END %]
 
 
@@ -755,7 +760,7 @@
 				[% stagger_count = 0 %]
 			[% ELSE %]
 				<text x="[% x + i + (dw / 2) - (bar_gap / 2) %]" y="[% base_line + 15 + stagger %]" [% IF config.rotate_x_labels %]transform="rotate(90 [% x + i + (dw / 2) - (bar_gap / 2) - half_char_height %] [% base_line + 15 + stagger %])" style="text-anchor: start" [% END %]class="xAxisLabels">[% field %]</text>
-				<path d="M[% x + i + (dw / 2) - (bar_gap / 2) %] [% base_line %], v[% stagger %]" class="staggerGuideLine" />
+				<path d="M[% x + i + (dw / 2) - (bar_gap / 2) %] [% base_line %] v[% stagger %]" class="staggerGuideLine" />
 			[% END %]
 		[% END %]
 	[% i = i + dw %]
@@ -824,11 +829,13 @@
 		[% dcount = 1 %]
 		<!-- find the lowest data value for each dataset -->
 
+        [% start_x = base_line %]
 		[% FOREACH dataset = data %]
-			<path d="M[% (dw * xcount) + x %] [% base_line %] V[% base_line - (dataset.data.$field * divider) %] h[% bar_width %] V[% base_line %] Z" class="fill[% dcount %]"/>
+			<path d="M[% (dw * xcount) + x %] [% start_x %] V[% start_x - (dataset.data.$field * divider) %] h[% bar_width %] V[% start_x %] Z" class="fill[% dcount %]"/>
 			[% IF config.show_data_values %]
-				<text x="[% (dw * xcount) + x + (dw / 2) - (bar_gap / 2) %]" y="[% base_line - (dataset.data.$field * divider) - 6 %]" class="dataPointLabel">[% dataset.data.$field %]</text>
+				<text x="[% (dw * xcount) + x + (dw / 2) - (bar_gap / 2) %]" y="[% start_x - (dataset.data.$field * divider) - 6 %]" class="dataPointLabel">[% dataset.data.$field %]</text>
 			[% END %]
+            [% start_x = start_x - (dataset.data.$field * divider) %]
 			[% dcount = dcount + 1 %]	
 		[% END %]
 		[% xcount = xcount + 1 %]		
@@ -886,4 +893,4 @@
 		[% END %]
 		<text x="[% config.width / 2 %]" y="[% y_subtitle %]" class="subTitle">[% config.graph_subtitle %]</text>
 	[% END %]
-</svg>
+</svg>

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarHorizontal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarHorizontal.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarHorizontal.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarHorizontal.pm Thu Sep  3 21:10:53 2009
@@ -2,8 +2,6 @@
 
 use strict;
 use Carp;
-use vars qw($VERSION);
-$VERSION = '0.06';
 
 use SVG::TT::Graph;
 use base qw(SVG::TT::Graph);
@@ -735,7 +733,7 @@
 			[% ELSE %]
 				<text x="[% x + (dx * count) %]" y="[% base_line + 15 + stagger %]" class="xAxisLabels" style="text-anchor: middle;">[% y_value FILTER format('%2.01f') %]</text>
 				<path d="M[% x + (dx * count) %] [% base_line %] V[% y %]" class="guideLines"/>
-				<path d="M[% x + (dx * count) %] [% base_line %], v[% stagger %]" class="staggerGuideLine" />
+				<path d="M[% x + (dx * count) %] [% base_line %] v[% stagger %]" class="staggerGuideLine" />
 			[% END %]
 		[% END %]
 		[% y_value = y_value + scale_division %]

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarLine.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarLine.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarLine.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/BarLine.pm Thu Sep  3 21:10:53 2009
@@ -2,8 +2,6 @@
 
 use strict;
 use Carp;
-use vars qw($VERSION);
-$VERSION = '0.06';
 
 use SVG::TT::Graph;
 use base qw(SVG::TT::Graph);
@@ -893,7 +891,7 @@
 				[% stagger_count = 0 %]
 			[% ELSE %]
 				<text x="[% x + i + (dw / 2) - (bar_gap / 2) %]" y="[% base_line + 15 + stagger %]" [% IF config.rotate_x_labels %]transform="rotate(90 [% x + i + (dw / 2) - (bar_gap / 2) - half_char_height %] [% base_line + 15 + stagger %])" style="text-anchor: start" [% END %]class="xAxisLabels">[% field %]</text>
-				<path d="M[% x + i + (dw / 2) - (bar_gap / 2) %] [% base_line %], v[% stagger %]" class="staggerGuideLine" />
+				<path d="M[% x + i + (dw / 2) - (bar_gap / 2) %] [% base_line %] v[% stagger %]" class="staggerGuideLine" />
 			[% END %]
 		[% END %]
 	[% i = i + dw %]
@@ -1008,7 +1006,7 @@
     [% xcount = 0 %]
     [% FOREACH field = config.fields %]
         [% IF xcount == 1 %] L [% END %]
-      	[% (dw * xcount) + x + (bar_width / 2) %] [% base_line - (data.1.data.$field * secondary_divider) %],
+      	[% (dw * xcount) + x + (bar_width / 2) %] [% base_line - (data.1.data.$field * secondary_divider) %]
         [% xcount = xcount + 1 %]       
     [% END %]" class="line[% line %]"/>
 	
@@ -1078,4 +1076,4 @@
 		[% END %]
 		<text x="[% config.width / 2 %]" y="[% y_subtitle %]" class="subTitle">[% config.graph_subtitle %]</text>
 	[% END %]
-</svg>
+</svg>

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Line.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Line.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Line.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Line.pm Thu Sep  3 21:10:53 2009
@@ -2,8 +2,6 @@
 
 use strict;
 use Carp;
-use vars qw($VERSION);
-$VERSION = '0.07';
 
 use SVG::TT::Graph;
 use base qw(SVG::TT::Graph);
@@ -816,7 +814,7 @@
 				[% stagger_count = 0 %]
 			[% ELSE %]
 				<text x="[% x + i %]" y="[% base_line + 15 + stagger %]" [% IF config.rotate_x_labels %]transform="rotate(90 [% x + i - half_char_height %] [% base_line + 15 + stagger %])" style="text-anchor: start" [% END %]class="xAxisLabels">[% field %]</text>
-				<path d="M[% x + i %] [% base_line %], v[% stagger %]" class="staggerGuideLine" />
+				<path d="M[% x + i %] [% base_line %] v[% stagger %]" class="staggerGuideLine" />
 			[% END %]
 		[% END %]
 	[% i = i + dw %]
@@ -884,7 +882,7 @@
         <path d="M[% x %] [% base_line %] L
         [% xcount = 0 %]
         [% FOREACH field = config.fields %]
-            [% (dw * xcount) + x %] [% base_line - (dataset.data.$field * divider) %],
+            [% (dw * xcount) + x %] [% base_line - ((dataset.data.$field - min_scale_value) * divider) %]
             [% xcount = xcount + 1 %]
         [% END %]
         [% (dw * (xcount - 1)) + x %] [% base_line %] Z" class="fill[% line %]"/>
@@ -895,7 +893,7 @@
     [% xcount = 0 %]
     [% FOREACH field = config.fields %]
         [% IF xcount == 1 %] L [% END %]
-        [% (dw * xcount) + x %] [% base_line - (dataset.data.$field * divider) %],
+        [% (dw * xcount) + x %] [% base_line - ((dataset.data.$field - min_scale_value) * divider) %]
         [% xcount = xcount + 1 %]       
     [% END %]" class="line[% line %]"/>
     
@@ -904,12 +902,12 @@
         [% FOREACH field = config.fields %]
             [% IF config.show_data_points %]
                 <!-- datapoint shown -->
-                <circle cx="[% (dw * xcount) + x %]" cy="[% base_line - (dataset.data.$field * divider) %]" r="2.5" class="fill[% line %]"/>
+				<circle cx="[% (dw * xcount) + x %]" cy="[% base_line - ((dataset.data.$field - min_scale_value) * divider) %]" r="2.5" class="fill[% line %]"/>
             [% END %]
             
             [% IF config.show_data_values %]
                 <!-- datavalue shown -->
-                <text x="[% (dw * xcount) + x %]" y="[% base_line - (dataset.data.$field * divider) - 6 %]" class="dataPointLabel">[% dataset.data.$field %]</text>
+                <text x="[% (dw * xcount) + x %]" y="[% base_line - ((dataset.data.$field - min_scale_value) * divider) - 6 %]" class="dataPointLabel">[% dataset.data.$field %]</text>
             [% END %]
             [% xcount = xcount + 1 %]       
         [% END %]

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Pie.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Pie.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Pie.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/Pie.pm Thu Sep  3 21:10:53 2009
@@ -2,8 +2,6 @@
 
 use strict;
 use Carp;
-use vars qw($VERSION);
-$VERSION = '0.08';
 
 use SVG::TT::Graph;
 use base qw(SVG::TT::Graph);
@@ -88,6 +86,9 @@
     # Optional - defaults to using internal stylesheet
     'style_sheet'       => '/includes/graph.css',
 
+    # Use field names for in the stylesheet
+    'style_sheet_field_names' => 0,
+
   });
 
 The constructor takes a hash reference, fields (the name for each
@@ -155,6 +156,18 @@
 To create an external stylesheet create a graph using the
 default internal version and copy the stylesheet section to
 an external file and edit from there.
+
+If you use the style_sheet_field_names() option then you can
+use the field names within your stylesheet.  This allows
+consistent use of styles.  The names should be:
+
+=over 4
+
+=item <field>_dataPoint
+
+=item <field>_key
+
+=back
 
 =item show_graph_title()
 
@@ -308,6 +321,7 @@
 		'width'				=> '500',
 		'height'			=> '300',
 		'style_sheet'       => '',
+		'style_sheet_field_names' => 0,
 
 	    'show_graph_title'		=> 0,
 	    'graph_title'			=> 'Graph Title',
@@ -662,24 +676,24 @@
 		[% xe = re * cos(radians_half) FILTER format('%02.10f') %]
 		[% ye = re * sin(radians_half) FILTER format('%02.10f') %]
 
-        <path d="M[% px_start + xe %] [% pmin_scale_value + ye %] A[% r %] [% r %], 0, 
-        [% IF percent >= 50 %]1[% ELSE %]0[% END %], 1, [% x + px_end + xe %] [% y + py_end + ye %] L[% x + xe %] [% y + ye %], Z" class="dataPoint[% count %]"/>
+        <path d="M[% px_start + xe %] [% pmin_scale_value + ye %] A[% r %] [% r %] 0 
+        [% IF percent >= 50 %]1[% ELSE %]0[% END %] 1 [% x + px_end + xe %] [% y + py_end + ye %] L[% x + xe %] [% y + ye %] Z" class="[% IF config.style_sheet_field_names %][% field %]_dataPoint[% ELSE %]dataPoint[% count %][% END %]"/>
 	
 	[% ELSIF !config.expanded && config.expand_greatest %]
 		[% IF data.0.data.$field == max_value %]
 		    [% re = r / e %]
 		    [% xe = re * cos(radians_half) FILTER format('%02.10f') %]
 		    [% ye = re * sin(radians_half) FILTER format('%02.10f') %]
-		    <path d="M[% px_start + xe %] [% pmin_scale_value + ye %] A[% r %] [% r %], 0, 
-            [% IF percent >= 50 %]1[% ELSE %]0[% END %], 1, [% x + px_end + xe %] [% y + py_end + ye %] L[% x + xe %] [% y + ye %], Z" class="dataPoint[% count %]"/>
+		    <path d="M[% px_start + xe %] [% pmin_scale_value + ye %] A[% r %] [% r %] 0 
+            [% IF percent >= 50 %]1[% ELSE %]0[% END %] 1 [% x + px_end + xe %] [% y + py_end + ye %] L[% x + xe %] [% y + ye %] Z" class="[% IF config.style_sheet_field_names %][% field %]_dataPoint[% ELSE %]dataPoint[% count %][% END %]"/>
 		[% ELSE %]
-			<path d="M[% px_start %] [% pmin_scale_value %] A[% r %] [% r %], 0, 
-            [% IF percent >= 50 %]1[% ELSE %]0[% END %], 1, [% x + px_end %] [% y + py_end %] L[% x %] [% y %], Z" class="dataPoint[% count %]"/>    
+			<path d="M[% px_start %] [% pmin_scale_value %] A[% r %] [% r %] 0 
+            [% IF percent >= 50 %]1[% ELSE %]0[% END %] 1 [% x + px_end %] [% y + py_end %] L[% x %] [% y %] Z" class="[% IF config.style_sheet_field_names %][% field %]_dataPoint[% ELSE %]dataPoint[% count %][% END %]"/>    
 		[% END %]
 	
 	[% ELSE %]
-		<path d="M[% px_start %] [% pmin_scale_value %] A[% r %] [% r %], 0, 
-        [% IF percent >= 50 %]1[% ELSE %]0[% END %], 1, [% x + px_end %] [% y + py_end %] L[% x %] [% y %], Z" class="dataPoint[% count %]"/>    
+		<path d="M[% px_start %] [% pmin_scale_value %] A[% r %] [% r %] 0 
+        [% IF percent >= 50 %]1[% ELSE %]0[% END %] 1 [% x + px_end %] [% y + py_end %] L[% x %] [% y %] Z" class="[% IF config.style_sheet_field_names %][% field %]_dataPoint[% ELSE %]dataPoint[% count %][% END %]"/>    
 	[% END %]
 	
 	
@@ -716,10 +730,10 @@
 	[% percent = (100 / total) * data.0.data.$field FILTER format('%2.0f')%]
 		<!-- position key left or right -->
 		[% IF config.key_placement == 'R' %]
-			<rect x="[% x + r + x_key_start %]" y="[% (y - r) + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]"/>
+			<rect x="[% x + r + x_key_start %]" y="[% (y - r) + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="[% IF config.style_sheet_field_names %][% field %]_key[% ELSE %]key[% key_count %][% END %]"/>
 			<text x="[% x + r + x_key_start + key_box_size + key_padding %]" y="[% (y - r) + (key_box_size * key_count) + (key_count * key_padding) + key_box_size %]" class="keyText">[% IF config.show_key_data_labels %][% field %][% END %] [% IF config.show_key_actual_values %][[% data.0.data.$field %]][% END %] [% IF config.show_key_percent %][% percent %]%[% END %]</text>
 		[% ELSE %]
-			<rect x="[% x_key_start %]" y="[% (y - r) + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]"/>
+			<rect x="[% x_key_start %]" y="[% (y - r) + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="[% IF config.style_sheet_field_names %][% field %]_key[% ELSE %]key[% key_count %][% END %]"/>
 			<text x="[% x_key_start + key_box_size + key_padding %]" y="[% (y - r) + (key_box_size * key_count) + (key_count * key_padding) + key_box_size %]" class="keyText" style="text-anchor: start">[% IF config.show_key_data_labels %][% field %][% END %] [% IF config.show_key_actual_values %][[% data.0.data.$field %]][% END %] [% IF config.show_key_percent %][% percent %]%[% END %]</text>	
 		[% END %]
 		[% key_count = key_count + 1 %]
@@ -747,11 +761,11 @@
 		[% END %]
 		
 		[% IF config.key_placement == 'T' %]
-		<rect x="[% x_key %]" y="[% y_key + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]"/>
+		<rect x="[% x_key %]" y="[% y_key + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="[% IF config.style_sheet_field_names %][% field %]_key[% ELSE %]key[% key_count %][% END %]"/>
 
 		<text x="[% x_key + key_box_size + key_padding %]" y="[% y_key + (key_box_size * key_count) + (key_count * key_padding) + key_box_size %]" class="keyText">[% IF config.show_key_data_labels %][% field %][% END %] [% IF config.show_key_actual_values %][[% data.0.data.$field %]][% END %] [% IF config.show_key_percent %][% percent %]%[% END %]</text>
 		[% ELSE %]
-			<rect x="[% x_key %]" y="[% (r * 2) + (padding * 2) + y_key + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]"/>
+			<rect x="[% x_key %]" y="[% (r * 2) + (padding * 2) + y_key + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="[% IF config.style_sheet_field_names %][% field %]_key[% ELSE %]key[% key_count %][% END %]"/>
 
 			<text x="[% x_key + key_box_size + key_padding %]" y="[% (r * 2) + (padding * 2) + y_key + (key_box_size * key_count) + (key_count * key_padding) + key_box_size %]" class="keyText">[% IF config.show_key_data_labels %][% field %][% END %] [% IF config.show_key_actual_values %][[% data.0.data.$field %]][% END %] [% IF config.show_key_percent %][% percent %]%[% END %]</text>	
 		

Modified: branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/TimeSeries.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/TimeSeries.pm?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/TimeSeries.pm (original)
+++ branches/upstream/svg-tt-graph/current/lib/SVG/TT/Graph/TimeSeries.pm Thu Sep  3 21:10:53 2009
@@ -2,13 +2,13 @@
 
 use strict;
 use Carp;
+use vars qw($VERSION);
+$VERSION = '0.11';
+
 use Data::Dumper;
 use HTTP::Date;
 use DateTime;
 use POSIX;
-
-use vars qw($VERSION);
-$VERSION = '0.07';
 
 use SVG::TT::Graph;
 use base qw(SVG::TT::Graph);
@@ -429,7 +429,7 @@
 # override this so we can pre-manipulate the data
 sub add_data {
     my ($self, $conf) = @_;
-    
+
     croak 'no data provided'
     unless (defined $conf->{'data'} && ref($conf->{'data'}) eq 'ARRAY');
 
@@ -881,6 +881,23 @@
 </style>
 </defs>
 [% END %]
+
+<!-- Script to toggle paths when their key is clicked on -->
+<script language="JavaScript">
+function togglePath( series ) {
+    var path    = document.getElementById('groupDataSeries' + series)
+    var points  = document.getElementById('groupDataLabels' + series)
+    var current = path.getAttribute('opacity');
+    if ( path.getAttribute('opacity') == 0 ) {
+        path.setAttribute('opacity',1)
+        points.setAttribute('opacity',1)
+    } else {
+        path.setAttribute('opacity',0)
+        points.setAttribute('opacity',0)
+    }
+}
+</script>
+
 <!-- svg bg -->
 <rect x="0" y="0" width="[% config.width %]" height="[% config.height %]" class="svgBackground"/>
 
@@ -1035,7 +1052,7 @@
             [% WHILE ((x_value > calc.min_timescale_value) && ((x_value < calc.max_timescale_value))) %]
                 [% xpos = (dw * (x_value - calc.min_timescale_value)) + x %]
                 [% IF (config.stagger_x_labels && ((count % 2) == 0)) %]
-                    <path d="M[% xpos %] [% base_line %], v[% stagger %]" class="staggerGuideLine" />
+                    <path d="M[% xpos %] [% base_line %] v[% stagger %]" class="staggerGuideLine" />
                     <text x="[% xpos %]" y="[% base_line + 15 + stagger %]" [% IF config.rotate_x_labels %] transform="rotate(90 [% xpos  - half_char_height %] [% base_line + 15 + stagger %]) translate(-10,0)" style="text-anchor: start" [% END %] class="xAxisLabels">[% date.format(x_value,config.x_label_format) %]</text>        
                 [% ELSE %]
                     <text x="[% xpos %]" y="[% base_line + 15 %]" [% IF config.rotate_x_labels %] transform="rotate(90 [% xpos  - half_char_height %] [% base_line + 15 %]) translate(-10,0)" style="text-anchor: start" [% END %] class="xAxisLabels">[% date.format(x_value,config.x_label_format) %]</text>        
@@ -1048,7 +1065,12 @@
         [% END %]    
     [% END %]
     [% IF date.format(calc.max_timescale_value,config.x_label_format) != last_label %]
+        [% IF (config.stagger_x_labels && ((count % 2) == 0)) %]
+        <path d="M[% x + w %] [% base_line %] v[% stagger %]" class="staggerGuideLine" />
+        <text x="[% x + w %]" y="[% base_line + 15 + stagger %]" [% IF config.rotate_x_labels %] transform="rotate(90 [% x + w - half_char_height %] [% base_line + 15 + stagger %]) translate(-10,0)" style="text-anchor: start" [% END %] class="xAxisLabels">[% date.format(calc.max_timescale_value,config.x_label_format) %]</text>        
+        [% ELSE %]
         <text x="[% x + w %]" y="[% base_line + 15 %]" [% IF config.rotate_x_labels %] transform="rotate(90 [% x + w - half_char_height %] [% base_line + 15 %]) translate(-10,0)" style="text-anchor: start" [% END %] class="xAxisLabels">[% date.format(calc.max_timescale_value,config.x_label_format) %]</text>
+        [% END %]
     [% END %]
 [% END %]
 
@@ -1176,7 +1198,7 @@
 [% key_count = 1 %]
 [% IF config.key && config.key_position == 'right' %]
 	[% FOREACH dataset = data %]
-		<rect x="[% x + w + 20 %]" y="[% y + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]"/>
+		<rect x="[% x + w + 20 %]" y="[% y + (key_box_size * key_count) + (key_count * key_padding) %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]" onclick="togglePath([% key_count %]);"/>
 		<text x="[% x + w + 20 + key_box_size + key_padding %]" y="[% y + (key_box_size * key_count) + (key_count * key_padding) + key_box_size %]" class="keyText">[% dataset.title %]</text>
 		[% key_count = key_count + 1 %]
 	[% END %]
@@ -1200,8 +1222,7 @@
 			[% x_key = x_key + 200 %]
 			[% y_key = y_key - (key_box_size * 4) - 2 %]
 		[% END %]
-		<rect x="[% x_key %]" y="[% y_key + (key_box_size * key_count) + (key_count * key_padding) + stagger %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]"/>
-
+		<rect x="[% x_key %]" y="[% y_key + (key_box_size * key_count) + (key_count * key_padding) + stagger %]" width="[% key_box_size %]" height="[% key_box_size %]" class="key[% key_count %]" onclick="togglePath([% key_count %]);"/>
 		<text x="[% x_key + key_box_size + key_padding %]" y="[% y_key + (key_box_size * key_count) + (key_count * key_padding) + key_box_size + stagger %]" class="keyText">[% dataset.title %]</text>
 		[% key_count = key_count + 1 %]
 	[% END %]

Modified: branches/upstream/svg-tt-graph/current/timeseries_pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/svg-tt-graph/current/timeseries_pl?rev=43605&op=diff
==============================================================================
--- branches/upstream/svg-tt-graph/current/timeseries_pl (original)
+++ branches/upstream/svg-tt-graph/current/timeseries_pl Thu Sep  3 21:10:53 2009
@@ -1,4 +1,7 @@
 #!/usr/bin/env perl
+
+use lib qw( ./lib ./blib/lib ./lib);
+
 use strict;
 use Getopt::Long;
 use Data::Dumper;
@@ -455,7 +458,7 @@
 'title' => 'System',
 });
 
-open (SAMPLE_FILE, ">".$file_name.'7.svg') || die("ERROR: Could not open sample file: ${file_name}7.svg");
+open (SAMPLE_FILE, ">".$file_name.'7.svg.gz') || die("ERROR: Could not open sample file: ${file_name}7.svg");
 
 print SAMPLE_FILE $graph->burn();
 close SAMPLE_FILE;
@@ -585,7 +588,7 @@
 'title' => 'System',
 });
 
-open (SAMPLE_FILE, ">".$file_name.'9.svg') || die("ERROR: Could not open sample file: ${file_name}9.svg");
+open (SAMPLE_FILE, ">".$file_name.'9.svg.gz') || die("ERROR: Could not open sample file: ${file_name}9.svg");
 
 print SAMPLE_FILE $graph->burn();
 close SAMPLE_FILE;
@@ -603,7 +606,8 @@
 ;
     for my $i (1,2,3,4,5,6,7,8,9) {
         print SAMPLE_FILE "<object type=\"image/svg+xml\" name=\"sample$i\" width=\"500\" height=\"500\"\n";
-        print SAMPLE_FILE "data=\"${file_name}${i}.svg\">\n";
+        print SAMPLE_FILE "data=\"${file_name}${i}.svg\">\n" if $i != 7 && $i != 9;
+        print SAMPLE_FILE "data=\"${file_name}${i}.svg\">\n" if $i == 7 && $i == 9;
         print SAMPLE_FILE "Requires SVG plugin.\n</object>\n";
     }
     print SAMPLE_FILE <<FOOTER;




More information about the Pkg-perl-cvs-commits mailing list