#!/usr/bin/perl
use GD::Graph::bars3d;

my $xlabel = shift;
my $ylabel = shift;
my (@data);
my $i = 0;
while (my $x = shift) {
	my ($l, $r, $t) = split(/,/,$x);
	$data[0][$i] = $l;
	$data[1][$i] = $r;
	$data[2][$i] = $t;
	$data[3][$i] = $r + $t;
	$i++;
}

my $graph = GD::Graph::bars3d->new(600, 300);
$graph->set_text_clr("black");
$graph->set_legend_font(GD::Text::gdTinyFont);
$graph->set(
	x_label => $xlabel,
	y_label => $ylabel,
	bar_spacing => 2,
	y_tick_number => 7,
	y_label_skip => 1);
print $graph->plot(\@data)->png;
