SVGraph

 view release on metacpan or  search on metacpan

lib/SVGraph/2D/columns.pm  view on Meta::CPAN

				'restart'=>"whenNotActive"
			);
=cut
	
			$data_w="0" unless $data_w;
			my $d_x=3;
			my $d_y=-2;
	
			if ($self->{ENV}{show_data_background} || $self->{columns}{$column}->{ENV}{show_data_background})
			{
				my $rx="2pt";
				my $ry="2pt";
				my $width=length($data_w)*5;
				my $fill="rgb(255,255,255)";
				my $fill_opacity="0.5";
		
				if ($self->{columns}{$column}->{ENV}{show_data_summary})
				{
					$width=length($self->GetRowSum($row))*5;
					$rx="0pt";
					$ry="0pt";
					$fill="rgb(255,255,255)";
					$fill_opacity="1";
				}
		
				$self->{SVG}->rect(
					'x' => (($self->{block_left}+$x)-1+$d_x),
					'y' => (($self->{block_down}-$height-3)-8+$d_y),
					'width' => $width+3,
					'height' => 10,
					'fill'	=>$fill,
					'fill-opacity'	=>$fill_opacity,
					'stroke'		=>"rgb(125,125,125)",
					'stroke-width'	=>"1pt",
					'stroke-linecap'	=>"round",
					'stroke-linejoin'	=>"round",
					'rx' => $rx,
					'ry' => $ry,
				);
		
			}
	
			if ($self->{ENV}{show_data} || $self->{columns}{$column}->{ENV}{show_data})
			{
				$self->{SVG}->text
				(
					'x'	=>	($self->{block_left}+$x+$d_x),
					'y'	=>	($self->{block_down}-$height-3+$d_y),
					style => 
					{
						'font-family'	=> 'Verdana',
						'font-size'		=> '8pt',
						'font-weight'	=> 400,
	#					'fill'		=>	"rgb(".$colors{B3}.")",
						'fill'	=>	"rgb(0,0,0)",
	#					'stroke'		=>	"rgb(0,0,0)",
	#					'stroke-width'	=>	"1pt",
						'stroke-linecap'	=>"round",
						'stroke-linejoin'	=>"round",
					},
				)->cdata($data_w.$self->{'ENV'}{'data_suffix'});
			}
	
			if ($self->{columns}{$column}->{ENV}{show_data_summary})
			{
				$self->{SVG}->text
				(
					'x'	=>	($self->{block_left}+$x+$d_x),
					'y'	=>	($self->{block_down}-$height-3+$d_y),
					style => 
					{
						'font-family'	=> 'Verdana',
						'font-size'		=> 8,
						'font-weight'	=> 400,
	#					'fill'		=>	"rgb(".$colors{B3}.")",
						'fill'	=>	"rgb(0,0,0)",
	#					'stroke'		=>	"rgb(0,0,0)",
	#					'stroke-width'	=>	"1pt",
						'stroke-linecap'	=>"round",
						'stroke-linejoin'	=>"round",
					},
				)->cdata($self->GetRowSum($row));
			}

   
#   $width=int($width*100)/100;
   
   			$rows++;
  		}

 	}
 
 
 
 
 
 # drawing the lines
=head1
	my @data_stacked;
	foreach my $column(keys %{$self->{columns}})
	{
		my $color=$self->{columns}->{$column}{ENV}{color};
		my %colors=%{$SVGraph::colors::table{$color}};
		
		my $count;
		my $points;
		
		foreach my $row(@{$self->{row}{label}})
		{
			my $data=$self->{columns}{$column}->{data}{$row};  
			my $data_o=$data; # data original
			my $data_w=$data; # data for display;
			$count++;   
			$data=$data/($self->GetRowSum($row)/100) if $self->{ENV}{type}=~/percentage/;   
			$data_stacked[$count]+=$data;
			#$data=$data_stacked[$count] if $self->{ENV}{type}=~/stacked/;
			if ($self->{ENV}{type}=~/stacked/)
			{
				if ($self->{ENV}{type}=~/percentage/)
				{
					#$data_w="$data_o(".((int($data*100))/100)."%)";
					$data_w=((int($data*100))/100)."%";
					$data=100-$data_stacked[$count]+$data;
   				}
				else
				{
					#$data=$self->GetRowSum($count-1)-$data_stacked[$count]+$data;
					$data=$self->GetRowSum($row)-$data_stacked[$count]+$data;
				}
   			}
   
			my $height=(($data-$self->{grid_y_scale_minimum})/($self->{grid_y_scale}/100))*($self->{block_height}/100);
			$height=int($height*100)/100;
			$height=0 if $height < 0;
			$height=$self->{block_height} if $height > $self->{block_height};
   
			my $width=($count-1)*($self->{block_width}/($self->{grid_x_main_lines}-1));
			
			$width+=($count*10);
			
			print "mam $count\n";
			



( run in 0.512 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )