Chart-Graph

 view release on metacpan or  search on metacpan

Graph/Xmgrace/Graph_Options.pm  view on Meta::CPAN

@ISA = qw(Chart::Graph::Xmgrace::Base_Option);

sub _init {
    my $self = shift;  
    $self->{name} = "title";
    $self->{print_order} = ["title","font","size","color"];
    $self->{length} = 4;
    $self->{options} = {
			"title" => '""',
			"font" => "0",
			"size" => "1.250000",
			"color" => "1",					
		       };
}

sub print($$ ) {
    my $self = shift;
    my $handle = shift;
    my $string = "";
    my $substr = "";		# for making arrays into a string

    foreach $option (@{ $self->{"print_order"} }) {
	my $option_ref = $self->{"options"};
	
	if ($option eq "title") {
	    $string = "$self->{name} \"$option_ref->{$option}\"\n";
	} else {
	    # print function handles both scalars and lists
	    if (ref($option_ref->{$option}) eq ARRAY) {
		$substr = join (", ", (@{ $option_ref->{$option} })); 
		$string = "$self->{name} $option $substr\n";
	    } else {
		$string = "$self->{name} $option $option_ref->{$option}\n";
	    }
	}	
    $self->_printline($handle, $string, $self->{"length"}); 
    }
}

package Chart::Graph::Xmgrace::Subtitle_Options;
@ISA = qw(Chart::Graph::Xmgrace::Title_Options);

sub _init {
    my $self = shift;  
    $self->{name} = "subtitle";
    $self->{print_order} = ["title","font","size","color"];
    $self->{length} = 4;
    $self->{options} = {
			"title" => '""',
			"font" => "0",
			"size" => "1.000000",
			"color" => "1",		
		       };
}

package Chart::Graph::Xmgrace::Legend_Options;
@ISA = qw(Chart::Graph::Xmgrace::Base_Option);

sub _init {
    my $self = shift;  
    $self->{name} = "legend";
    $self->{print_order} = ["status","loctype","x1","y1","box color",
			    "box pattern","box linewidth","box linestyle",
			    "box fill color","box fill pattern","font",
			    "char size","color","length","vgap","hgap",
			    "invert"];
    $self->{length} = 4;
    $self->{options} = {
			"status" => "on",
			"loctype" => "view",
			"x1" => "0.85",
			"y1" => "0.8",
			"box color" => "1",
			"box pattern" => "1",
			"box linewidth" => "1.0",
			"box linestyle" => "1",
			"box fill color" => "0",
			"box fill pattern" => "1",
			"font" => "0",
			"char size" => "1.000000",
			"color" => "1",
			"length" => "4",
			"vgap" => "1",
			"hgap" => "1",
			"invert" => "false",
		       };
}

sub box_color ($$) {
    $self = shift;
    $val = shift;
    $self->{options}->{"box color"} = $val;
    return 1;
}

sub box_linewidth ($$) {
    $self = shift;
    $val = shift;
    $self->{options}->{"box linewidth"} = $val;
    return 1;
}

sub box_linestyle ($$) {
    $self = shift;
    $val = shift;
    $self->{options}->{"box linestyle"} = $val;
    return 1;
}

sub box_fill_color ($$) {
    $self = shift;
    $val = shift;
    $self->{options}->{"box fill color"} = $val;
    return 1;
}

sub box_fill_pattern ($$) {
    $self = shift;
    $val = shift;
    $self->{options}->{"box fill pattern"} = $val;
    return 1;



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