in reply to Data labels for Chart::Points
poj#!perl use strict; use Data::Dump 'pp'; use Chart::Points; use GD; my $obj = Chart::Points->new ( 400,300 ); $obj->{'imagemap'}=1; my @labels = ('A','B','C'); $obj->set ('legend_labels' => \@labels); $obj->add_pt ('foo', 1,3,2); $obj->add_pt ('bar', 4,5,6); # create GD image my $img = GD::Image->new($obj->scalar_png); my $imagemap_data = $obj->imagemap_dump(); #pp $imagemap_data; # add labels my $black = $img->colorAllocate(0,0,0); for my $i (1..3){ for my $j (0..1){ my $text = $labels[$i-1]; my ($x,$y) = @{$imagemap_data->[$i][$j]}; $img->string(gdSmallFont,$x-10,$y-10,$text,$black); } } open (PNG,'>','chart.png') or die "$!"; binmode PNG; print PNG $img->png; close PNG;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Data labels for Chart::Points
by AndreaN (Novice) on Sep 14, 2013 at 17:02 UTC | |
|
Re^2: Data labels for Chart::Points
by attiamx (Initiate) on Jun 22, 2014 at 12:11 UTC | |
by poj (Abbot) on Jun 22, 2014 at 12:40 UTC | |
by attiamx (Initiate) on Jun 23, 2014 at 04:35 UTC | |
by poj (Abbot) on Jun 23, 2014 at 08:54 UTC | |
by attiamx (Initiate) on Jun 23, 2014 at 12:17 UTC | |
by poj (Abbot) on Jun 23, 2014 at 12:30 UTC | |
by attiamx (Initiate) on Jun 25, 2014 at 07:45 UTC |