CGIGraph

 view release on metacpan or  search on metacpan

lib/CGI/Graph/Layout.pm  view on Meta::CPAN

sub header_bars {
	my $self = shift;
	my @header = $self->{table}->header;
	my %header=();
	my @Yheader=();
	for ($i=0; $i<scalar @header; $i++) {
		$header{$header[$i]} = substr($header[$i], 2);
		push @Yheader, $header[$i] if ($header[$i] =~ /^[ir]_/);
	}

	my $final = $self->{CGI}->scrolling_list("X",\@header,undef,1,0,\%header);
	$final .= "vs".$self->{CGI}->scrolling_list("Y",\@Yheader,undef,1,0,\%header) if @Yheader;
	return $final;
}

sub info_bar {
	$self = shift;
	my @header = $self->{table}->header;
	my %header;	
	foreach $header (@header) {
		$header{$header} = substr($header, 2);
	}

	my $final = "Pop-up info: ";
	$final .= $self->{CGI}->scrolling_list("info",\@header,undef,1,0,\%header);
	return $final;
}

sub zoom_bar {
	my $self = shift;
	my $final = "zoom factor ";
	$final .= $self->{CGI}->popup_menu(-name => "zoom",
				 -values   => [1,2,3,4,5],
				 -onChange => "this.form.submit()");
	return $final;
}

sub select_bars {
	my $self = shift;
	my $final;
        $self->{CGI}->delete('select_list');
        $final.= $self->{CGI}->scrolling_list(-name=>'select_list',
                                -values=>['--Select--','Visible','All'],
                                -default=>['--Select--'],
                                -size=>1,
                                -onChange => 'this.form.submit()');

        $self->{CGI}->delete('unselect_list');
        $final.= $self->{CGI}->scrolling_list(-name=>'unselect_list',
                                -values=>['--Unselect--','Visible','All'],
                                -default=>['--Unselect--'],
                                -size=>1,
                                -onChange => 'this.form.submit()');
	return $final;
}

sub zoom_type {
	my $self = shift;
	my $final = "bar zoom type<BR>";
	$final.= $self->{CGI}->radio_group(-name=> 'zoom_type',
                                              -values=> ['vertical lock','unlocked int','unlocked'],
                                              -default=> 'vertical lock',
					      -linebreak => 'true',
                                              -onClick=> "this.form.submit()");
	return $final;
}

sub histogram_type {
	my $self = shift;
	my $final = "histogram type<BR>";
	$final.= $self->{CGI}->radio_group(-name=> 'histogram_type',
                                              -values=> ['variable','fixed'],
                                              -default=> 'variable',
					      -linebreak => 'true',
                                              -onClick=> "this.form.submit()");
	return $final;
}

sub textbox {
	my $self = shift;
	my $cols = $self->{table}->nofCol;

	my $final = $self->{CGI}->textarea(-name     => 'myarea',
		                 -default  => '',
		                 -rows     => $cols,
	        	         -columns  => $default{columns});
	return $final;
}

sub icons {
	my ($self,$points,$bar,$save) = @_;
	my $final;

	if ($points) {
		$final = $self->{CGI}->image_button( -name => 'points',
	                        -src => $points,
	                        -onClick => "graph_type.value='points'");
	}

	else {
		$final = $self->{CGI}->submit(-name=>'points',
			        -value=>'Point Graph',
	                        -onClick => "graph_type.value='points'");
	}

	$final.= ' ';

	if ($bar) {
		$final.= $self->{CGI}->image_button( -name => 'bar',
	                        -src => $bar,
	                        -onClick => "graph_type.value='bar'");
	}

	else {
		$final .= $self->{CGI}->submit(-name=>'bar',
			        -value=>'Bar Graph',
	                        -onClick => "graph_type.value='bar'");
	}

	$final.= ' ';



( run in 0.341 second using v1.01-cache-2.11-cpan-39bf76dae61 )