Skip to content

Commit

Permalink
Item8861: better parameter validation, minor doc updates
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/ChartPlugin@7122 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
WillNorris authored and WillNorris committed Apr 8, 2010
1 parent 891f54b commit a7cb98d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 32 deletions.
3 changes: 2 additions & 1 deletion data/System/ChartPlugin.txt
@@ -1,6 +1,6 @@
%META:TOPICINFO{author="ProjectContributor" date="1100674597" format="1.0" version="1.0"}%
<!--
* Set SHORTDESCRIPTION = Create PNG or GIF charts to visualize Foswiki tables
* Set SHORTDESCRIPTION = Create area, bar, line and scatter charts to visualize table data
-->

---+!! Chart Plugin
Expand Down Expand Up @@ -185,6 +185,7 @@ If the required parameters are not defined, then an error message is returned or
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- specify latest version first -->&nbsp; |
| 07 Apr 2010: | Foswiki:Main.WillNorris: better parameter validation, minor doc updates |
| 13 Mar 2010: | Foswiki:Main.WillNorris: work around "insecure dependency" error with certain perl/gd/cpan combinations (Foswikitask:Item1322) |
| 07 Jan 2010: | Foswiki:Main.AndrewJones, Foswiki:Main.SvenDowideit: Add dependencies (Foswikitask:Item8381) |
| 13 Oct 2009: | Kenneth Lavrsen: Fixed problem where the plugin could not chart the contents of a table if the table is at the end of a topic |
Expand Down
2 changes: 2 additions & 0 deletions data/System/ChartPluginTestsRemote.txt
Expand Up @@ -21,3 +21,5 @@ This topic just contains two tables which are referenced from the ChartPluginTes
| *Remote:Actual Value* | 39.52 | 55.52 | 36.52 | 62.52 | 72.52 | 68.52 |
| *Test:Averages* | %CALC{"$EVAL($SUM(xR3:C2..R7:C2)/5)"}% | %CALC{"$AVERAGE(R3:C3..R7:C3)"}%| %CALC{"$AVERAGE(R3:C4..R7:C4)"}%| %CALC{"$AVERAGE(R3:C5..R7:C5)"}%| %CALC{"$AVERAGE(R3:C6..R7:C6)"}%| %CALC{"$AVERAGE(R3:C7..R7:C7)"}%|
| *Remote:Comment* | initial measure | | | | | |

__Related topics:__ ChartPlugin, ChartPluginTests, VarCHART
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/ChartPlugin.pm
Expand Up @@ -49,9 +49,9 @@ use vars qw(
$defaultBarLeadingSpace $defaultBarTrailingSpace $defaultBarSpace
);

$VERSION = '$Rev: 13790 $';

$RELEASE = '13 Mar 2010';
our $VERSION = '$Rev: 13790 $';
our $RELEASE = '1.5.0 (7 Apr 2010)';
our $SHORT_DESCRIPTION = 'Create area, bar, line and scatter charts to visualize table data';

$pluginInitialized = 0;
$initError = '';
Expand Down
16 changes: 13 additions & 3 deletions lib/Foswiki/Plugins/ChartPlugin/Chart.pm
Expand Up @@ -2,7 +2,7 @@
#
# Copyright (C) 2004-2006 Peter Thoeny, Peter@Thoeny.org
# Plugin written by http://TWiki.org/cgi-bin/view/Main/TaitCyrus
# Copyright (C) 2008 Foswiki Contributors
# Copyright (C) 2008,2010 Foswiki Contributors
#
# For licensing info read LICENSE file in the Foswiki root.
# This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -365,12 +365,22 @@ sub getDataLabels { my ($this) = @_; return @{$$this{DATA_LABELS}}; }
sub setLegend { my ($this, @legend) = @_; $$this{LEGEND} = \@legend; }
sub getLegend { my ($this) = @_; return @{$$this{LEGEND}}; }

sub setImageWidth { my ($this, $imageWidth) = @_; $$this{IMAGE_WIDTH} = $imageWidth; }
sub setImageWidth { my ($this, $imageWidth) = @_; $$this{IMAGE_WIDTH} = _getInt( $imageWidth ); }
sub getImageWidth { my ($this) = @_; return $$this{IMAGE_WIDTH}; }

sub setImageHeight { my ($this, $imageHeight) = @_; $$this{IMAGE_HEIGHT} = $imageHeight; }
sub setImageHeight { my ($this, $imageHeight) = @_; $$this{IMAGE_HEIGHT} = _getInt( $imageHeight ); }
sub getImageHeight { my ($this) = @_; return $$this{IMAGE_HEIGHT}; }

# Return first integer number found in a string
sub _getInt {
my ( $str ) = @_;
$str = '0' unless( $str );
if( $str =~ s/^.*?(\-?)0*([0-9]+).*$/$1$2/o ) {
return int( $str );
}
return 0;
}

sub setAreaColors
{
my ($this, @AreaColors) = @_;
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/ChartPlugin/DEPENDENCIES
@@ -1,3 +1,3 @@
gd,>0,c,Required.
GD,>=0.01,cpan,Required.
POSIX,>0,cpan,Required.
gd,>0,c,Required. Available from http://www.libgd.org/
GD,>=0.01,cpan,Required. Available from CPAN:GD
POSIX,>0,cpan,Required. Available from CPAN:POSIX
45 changes: 23 additions & 22 deletions lib/Foswiki/Plugins/ChartPlugin/MANIFEST
@@ -1,22 +1,23 @@
data/System/ChartPlugin.txt NEW
data/System/ChartPluginTests.txt NEW
data/System/ChartPluginTestsRemote.txt NEW
lib/Foswiki/Plugins/ChartPlugin.pm NEW
lib/Foswiki/Plugins/ChartPlugin/Chart.pm NEW
lib/Foswiki/Plugins/ChartPlugin/Parameters.pm NEW
lib/Foswiki/Plugins/ChartPlugin/Table.pm NEW
pub/System/ChartPlugin/area1.png NEW
pub/System/ChartPlugin/area3.png NEW
pub/System/ChartPlugin/areaexample.png NEW
pub/System/ChartPlugin/arealine4.png NEW
pub/System/ChartPlugin/arealineexample.png NEW
pub/System/ChartPlugin/bar1.png NEW
pub/System/ChartPlugin/barexample.png NEW
pub/System/ChartPlugin/combo1.png NEW
pub/System/ChartPlugin/combo2.png NEW
pub/System/ChartPlugin/comboexample.png NEW
pub/System/ChartPlugin/line1.png NEW
pub/System/ChartPlugin/line2.png NEW
pub/System/ChartPlugin/lineexample.png NEW
pub/System/ChartPlugin/scatter1.png NEW
pub/System/ChartPlugin/scatterexample.png NEW
data/System/ChartPlugin.txt 0644
data/System/ChartPluginTests.txt 0644
data/System/ChartPluginTestsRemote.txt 0644
data/System/VarCHART.txt 0644
lib/Foswiki/Plugins/ChartPlugin.pm 0444
lib/Foswiki/Plugins/ChartPlugin/Chart.pm 0444
lib/Foswiki/Plugins/ChartPlugin/Parameters.pm 0444
lib/Foswiki/Plugins/ChartPlugin/Table.pm 0444
pub/System/ChartPlugin/area1.png 0644
pub/System/ChartPlugin/area3.png 0644
pub/System/ChartPlugin/areaexample.png 0644
pub/System/ChartPlugin/arealine4.png 0644
pub/System/ChartPlugin/arealineexample.png 0644
pub/System/ChartPlugin/bar1.png 0644
pub/System/ChartPlugin/barexample.png 0644
pub/System/ChartPlugin/combo1.png 0644
pub/System/ChartPlugin/combo2.png 0644
pub/System/ChartPlugin/comboexample.png 0644
pub/System/ChartPlugin/line1.png 0644
pub/System/ChartPlugin/line2.png 0644
pub/System/ChartPlugin/lineexample.png 0644
pub/System/ChartPlugin/scatter1.png 0644
pub/System/ChartPlugin/scatterexample.png 0644

0 comments on commit a7cb98d

Please sign in to comment.