Tk-PlotDataset

 view release on metacpan or  search on metacpan

lib/Tk/PlotDataset.pm  view on Meta::CPAN

#  * Added -pointSize dataset option to set the size of a point
#  * Added -fillPoint dataset option to set whether a point should be filled.
#  * Added -xlabelPos, -ylabelPos, and -y1labelPos plot options to specify
#    the distance these labels should be from the plot area.
#  * Added extra information to the legend, to show the line style and point
#     style for each line.
#  * Added -legendPos plot option to allow the legend to be placed either at
#    the side or bottom of the plot area, and specify the distance between the
#    legend and the plot area.
# Fixed some issues:
#  * When no x data was specified _data_sets_min_max() assumed there was one
#    extra data point on the x axis, so scaled wrongly.
#  * Graphs with '-noLine' set, but less than 20 points on the screen are not
#    visible until the user zooms.
#  * Fixed a problem with the alignment of the x-axis label.
#  * Fixed a problem with the alignment of the title.
#
# Version 9 by ss on 23/05/2007
# Fixed a problem with legend where a line was shown when -lineStyle was set to
# none.
#
# Version 10 by tc on 01/06/2007
# Modified code to meet I.T. Dev Perl Coding Standard and to comply more with
# the perlstyle documentation. Functionality not changed.
#
# Version 11 by ac on 06/11/2007
# New features:
#  * Added -xTickFormat, -yTickFormat and -y1TickFormat options to configure
#    the format of the number labels on each axis.
#  * Added -balloons option to enable/disable the coordinates balloons.
# Bug fixes:
#  * Fixed a memory leak that occurred when the value passed to the configure
#    method was an array reference.
#
# Version 12 by tc on 09/11/2007
# Documented the additional LineGraphDataset options supported by the module.
# Removed support for the -noLine option in LineGraphDataset - its
# functionality is now incorporated in the -lineStyle option.
#
# Version 13 by tc on 02/01/2008
# Wraps legend when it is displayed at the bottom of the graph. Added the
# -zoomButton option.
#
# Version 14 by tc on 02/11/2012
# Added support for reversing an axis by swapping its minimum and maximum
# scale values around.
#
# Version 15 by pi on 11/04/2013
# Added support for y-error bars.
#
# Version 16 by sd on 15/08/2016
# Fixed double usage of my in declaration of variable.

use strict;
use warnings;

use 5.005_03;

use Carp;
use POSIX;
use base qw/Tk::Derived Tk::Canvas/;
use Tk::Balloon;
use vars qw($VERSION);

$VERSION = '2.05';

Construct Tk::Widget 'PlotDataset';

sub ClassInit  ## no critic (NamingConventions::ProhibitMixedCaseSubs)
{
  my ($class, $mw ) = @_;
  $class -> SUPER::ClassInit($mw);

  return (1);
}

# Class data to track mega-item items. Not used as yet.
my $id = 0;
my %ids = ();

sub Populate  ## no critic (NamingConventions::ProhibitMixedCaseSubs)
{
  my ($self, $args) = @_;

  my @def_colors =
  qw/
    gray SlateBlue1 blue1 DodgerBlue4 DeepSkyBlue2 SeaGreen3
    green4 khaki4 gold3 gold1 firebrick1 brown4 magenta1 purple1 HotPink1
    chocolate1 black
  /;
  my @def_point_shapes = qw/circle square triangle diamond/;
  $self -> ConfigSpecs
  (
    -colors       => ['PASSIVE', 'colors',       'Colors',       \@def_colors],
    -pointShapes  => ['PASSIVE', 'pointShapes',  'PointShapes',  \@def_point_shapes],
    -border       => ['PASSIVE', 'border',       'Border',       [25, 50, 100, 50]],
    -scale        => ['PASSIVE', 'scale',        'Scale',        [0, 100, 10, 0, 100, 10, 0, 100, 10]],
    -zoom         => ['PASSIVE', 'zoom',         'Zoom',         [0, 0, 0, 0, 0]],
    -plotTitle    => ['PASSIVE', 'plottitle',    'PlotTitle',    ['Default Plot Title', 25 ]],
    -xlabel       => ['PASSIVE', 'xlabel',       'Xlabel',       'X Axis Default Label'],
    -ylabel       => ['PASSIVE', 'ylabel',       'Ylabel',       'Y Axis Default Label'],
    -y1label      => ['PASSIVE', 'Y1label',      'Y1label',      'Y1 Axis Default Label'],
    -xlabelPos    => ['PASSIVE', 'xlabelPos',    'XlabelPos',    40],
    -ylabelPos    => ['PASSIVE', 'ylabelPos',    'YlabelPos',    40],
    -y1labelPos   => ['PASSIVE', 'Y1labelPos',   'Y1labelPos',   40],
    -xTickLabel   => ['PASSIVE', 'xticklabel',   'Xticklabel',   undef],
    -yTickLabel   => ['PASSIVE', 'yticklabel',   'Yticklabel',   undef],
    -y1TickLabel  => ['PASSIVE', 'y1ticklabel',  'Y1ticklabel',  undef],
    -xTickFormat  => ['PASSIVE', 'xtickformat',  'Xtickformat',  undef],
    -yTickFormat  => ['PASSIVE', 'ytickformat',  'Ytickformat',  undef],
    -y1TickFormat => ['PASSIVE', 'y1tickformat', 'Y1tickformat', undef],
    -balloons     => ['PASSIVE', 'balloons',     'Balloons',     1],
    -legendPos    => ['PASSIVE', 'legendPos',    'LegendPos',    ['bottom', 80]],
    -xType        => ['PASSIVE', 'xtype',        'Xtype',        'linear'],  # could be log
    -yType        => ['PASSIVE', 'ytype',        'Ytype',        'linear'],  # could be log
    -y1Type       => ['PASSIVE', 'y1type',       'Y1type',       'linear'],  # could be log
    -fonts        => ['PASSIVE', 'fonts',        'Fonts',        ['Arial 8', 'Arial 8', 'Arial 10 bold', 'Arial 10']],
    -autoScaleY   => ['PASSIVE', 'autoscaley',   'AutoScaleY',   'On'],
    -autoScaleX   => ['PASSIVE', 'autoscalex',   'AutoScaleX',   'On'],
    -autoScaleY1  => ['PASSIVE', 'autoscaley1',  'AutoScaleY1',  'On'],
    -showError    => ['PASSIVE', 'showError',    'ShowError',    1],



( run in 1.337 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )