SVGraph

 view release on metacpan or  search on metacpan

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

				
			$text = $min . " - ". int($legend[$_]/$divider);
		}
		# last loop
		elsif($_ == $#legend+1)
		{

			if($min > 0)
			{
				@rgb = SVGraph::colors::HSVtoRGB($h,1,$v);
				
				$text = $previous_num . " - " . $max;
			}
			else
			{
				@rgb = SVGraph::colors::HSVtoRGB($h,1,$v);
				
				$text = $max;
			}
		}		
		else
		{
			@rgb = SVGraph::colors::HSVtoRGB($h,$s*$_,$v);
				
			$text = $previous_num . " - ". int($legend[$_]/$divider+1);
		}

		$previous_num = int($legend[$_]/$divider);

		my $color = 'rgb('. $rgb[0] . ', ' . $rgb[1] . ', ' . $rgb[2] . ')';

		$self->{SVG}->rect(
			x=>int($x),
			y=>int($self->{block_up}+($_*($height*1.7)-$height)),
			rx=>"2pt",
			ry=>"2pt",
			width=>$width,
			height=>$height,
			'stroke-width'	=>"1pt" ,
			'stroke'       =>$color,
			'fill'         =>$color,
			'stroke-linecap'	=>"round",
			'stroke-linejoin'	=>"round",
		);

		my $textsize=$height*0.6;
		

		$self->{SVG}->text
		(
			x=>int($x+($width*1.5)),
			y=>int($self->{block_up}+($_*($height*1.7)-$height)+($textsize/2)+($height/4)),
			style =>
			{
				'text-anchor'	=>	'start',
				'font-family'	=> 'Verdana',
				'font-size'	=> int($textsize).'px',
				'font-weight'	=> "600",
				'fill'		=> "black",
			},
		)->cdata($text);
	}
 
	return 1;
}

1;



( run in 3.765 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )