Skip Menu |
 

This queue is for tickets about the Chart-Gnuplot CPAN distribution.

Report information
The Basics
Id: 101950
Status: new
Priority: 0/
Queue: Chart-Gnuplot

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Allow *tics to specify start/incr/end for making automatic ranges
Download (untitled) / with headers
text/plain 224b
Rather than require the user to specify literal 'labels' values directly, this patch adds the ability to say xtics => { incr => 10 }, or xtics => { start => 100, incr => 1, end => 200 }, for example. -- Paul Evans
Subject: start-incr-end.patch
=== modified file 'lib/Chart/Gnuplot.pm' --- lib/Chart/Gnuplot.pm 2015-02-05 15:57:22 +0000 +++ lib/Chart/Gnuplot.pm 2015-02-05 16:07:50 +0000 @@ -654,6 +654,15 @@ $out .= " scale $$tic{length}" if (defined $$tic{length}); $out .= " rotate by $$tic{rotate}" if (defined $$tic{rotate}); $out .= " offset $$tic{offset}" if (defined $$tic{offset}); + if (defined $$tic{incr}) { + if (defined $$tic{start}) { + $out .= " $$tic{start}, $$tic{incr}"; + $out .= ", $$tic{end}" if (defined $$tic{end}); + } + else { + $out .= " $$tic{incr}"; + } + } $out .= " (". join(',', @{$$tic{labels}}) . ")" if (defined $$tic{labels}); @@ -2980,6 +2989,9 @@ Supported properties are: labels : the locations of the tic labels + start : the starting value for manually-specified range + incr : the increment for manually-specified range + end : the ending value for manually-specified range labelfmt : format of the labels font : font of the labels fontsize : font size of the lebals === modified file 't/axisTics.t' --- t/axisTics.t 2015-02-05 15:57:22 +0000 +++ t/axisTics.t 2015-02-05 16:07:50 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w use strict; -use Test::More (tests => 1); +use Test::More (tests => 2); BEGIN {use Chart::Gnuplot;} @@ -31,6 +31,23 @@ ok(&diff($c->{_script}, "axisTics_1.gp") == 0); } +{ + my $c = Chart::Gnuplot->new( + output => $temp, + xtics => { + incr => 10, + }, + ytics => { + start => 100, + incr => 5, + end => 200, + }, + ); + + $c->_setChart(); + ok(&diff($c->{_script}, "axisTics_2.gp") == 0); +} + ################################################################### # Compare two files === added file 't/axisTics_2.gp' --- t/axisTics_2.gp 1970-01-01 00:00:00 +0000 +++ t/axisTics_2.gp 2015-02-05 16:07:50 +0000 @@ -0,0 +1,4 @@ +set terminal postscript enhanced color +set output "temp.ps" +set xtics 10 +set ytics 100, 5, 200


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.