Tk-LineGraph

 view release on metacpan or  search on metacpan

LineGraph.pm  view on Meta::CPAN

$Tk::LineGraph::VERSION = '0.01';

package Tk::LineGraph;

use POSIX;
use Carp;
use Tk::widgets qw/Canvas/;
use base qw/Tk::Derived Tk::Canvas/;
require Tk::DialogBox; 
require Tk::BrowseEntry;
use strict;

Construct Tk::Widget 'LineGraph';
# Tk::Widget->Construct('LineGraph');

sub ClassInit {

    my($class, $mw ) = @_;
    $class->SUPER::ClassInit($mw);

    $Tk::LineGraph::MW = $mw;   # save the main window 
}

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

my $MW;    # main window refer to by $Tk::LineGraph::MW

sub Populate {
  
  my($self, $args) = @_;
  $self->SUPER::Populate($args);


  my @def_colors = qw/ gray SlateBlue1 blue1 DodgerBlue4  DeepSkyBlue2  SeaGreen3 green4 khaki4 gold3 gold1 firebrick1 brown4 magenta1 purple1 HotPink1 chocolate1 black/;
  $self->ConfigSpecs
    (
     -colors       => ['PASSIVE', 'colors',        'Colors',     \@def_colors],
     -boarder      => ['PASSIVE', 'boarder',       'Boarder',    [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',7 ] ],
     -xlabel       => ['PASSIVE', 'xlabel',        'Xlabel',     'X Axis Default Label'],
     -ylabel       => ['PASSIVE', 'ylabel',        'Ylabel',     'Y Axis Default Label'],
     -y1label      => ['PASSIVE', 'Y1label',       'Y1label',    'Y1 Axis Default Label'],
     -xTickLabel   => ['PASSIVE', 'xticklabel',    'Xticklabel',     undef],
     -yTickLabel   => ['PASSIVE', 'yticklabel',    'Yticklabel',     undef],
     -y1TickLabel  => ['PASSIVE', 'y1ticklabel',   'Y1ticklabel',    undef],
     -xType        => ['PASSIVE', 'xtype',         'Xtype',       'linear'],  # could be time, but not yet
     -yType        => ['PASSIVE', 'ytype',         'Ytype',       'linear'],  # could be log
     -y1Type       => ['PASSIVE', 'y1type',        'Y1type',      'linear'],  # could be log
     -fonts        => ['PASSIVE', 'fonts',         'Fonts',       ['Times 10','Times 15','Times 18','Times 18'] ],
     -autoScaleY   => ['PASSIVE', 'autoscaley',    'AutoScaleY',      'On'],
     -autoScaleX   => ['PASSIVE', 'autoscalex',    'AutoScaleX',      'On'],
     -autoScaleY1  => ['PASSIVE', 'autoscaley1',   'AutoScaleY1',     'On'],
     -logMin       => ['PASSIVE', 'logMin',        'LogMin',         0.001],

    );
  #helvetica Bookman Schumacher
  # The four fonts are axis ticks[0], axis lables[1], plot title[2], and legend[3]
  $self->{-logCheck} = 0; # false, don't need to check on range of log data  
  # OK, setup the dataSets list
  $self->{-datasets}  = []; # empty array, will be added to 
  $self->{-zoomStack} = []; # empty array which will get the zoom stack
  #Some bindings here
  # use button 1 for zoom
  $self->Tk::bind("<Button-1>" ,        [  \&zoom, 0 ]   );



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