push(@{${$key}[0]},1,33); push(@{${$key}[0]},22,11); push(@{${$key}[1]},2,5); push(@{${$key}[2]},3,4); #### #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Tk; use Tk::Chart::Lines; my $mw = MainWindow->new( -title => 'Tk::Chart::Lines example', -background => 'white', ); my $chart = $mw->Lines( -title => 'My graph title', -xlabel => 'X Label', -ylabel => 'Y Label', )->pack(qw / -fill both -expand 1 /); my @a = qw/Mon Tue Wed Thurs/; my %days; foreach my $key (@a) { push @{$days{$key}}, [1, 33]; push @{$days{$key}}, [22, 11]; push @{$days{$key}}, [2, 5]; push @{$days{$key}}, [3, 4]; } my $c ='Mon'; # Add a legend to the graph my @legends = ( 'legend 1', 'legend 2', 'legend 3' ); $chart->set_legend( -title => 'Title legend', -data => \@legends, -titlecolors => 'blue', ); # Add help identification $chart->set_balloon(); #print Dumper \$days{$c}; # Create the graph $chart->plot( $days{$c} ); MainLoop;