Hi Ben,
Thanks a lot for your reply. I will try to upgrade anyhow.
here is the code if you have a spare minute.
Cheers
JC
#!/usr/bin/perl
use CGI;
use CGI::Carp qw(fatalsToBrowser);
#use strict;
use GD::Graph::lines;
#require 'save.pl';
sub construct_graph {
$myTime = $_[0];
$myFstock = $_[1];
$mySstock = $_[2];
$myFname = $_[3];
$mySname = $_[4];
chop($myTime);
chop($myFstock);
chop($mySstock);
#print $myTime;
@aMyTime = split(/\|/,$myTime);
@aMyFstock = split(/\|/,$myFstock);
@aMySstock = split(/\|/,$mySstock);
#chop( @aMyTime);chop( @aMyTime); chop( @aMyTime);
#print "@aMyTime \n";
#print "@aMyFstock \n";
#print "@aMySstock \n";
foreach (@aMyTime) {
unshift(@resTimes, substr($_,8,2));
}
@data = (
[ reverse(@resTimes)],
[ reverse(@aMyFstock)],
[ reverse(@aMySstock)],
);
# foreach $loop(split(/\|/,$fStock))
#@data = (
# [ qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) ],
# [ reverse(4, 3, 5, 6, 3, 1.5, -1, -3, -4, -6, -7, -8)],
# [ (4, 3, 5, 6, 3, 1.5, -1, -3, -4, -6, -7, -8)],
# [ (2, 2, 2, 5, 5, 4.5,1.5, 2, 3, 5, 4, 3)],
#);
$my_graph = new GD::Graph::lines();
$my_graph->set(
x_label => 'Time',
y_label => 'Stock',
title => 'Stock Pair: '.$myFname. '-'.$mySname .' Cor= '.$aCorr . ' Per= '
.$aPeriod,
text => 'Stocks Line Graph',
x_min_value => undef,
y_min_value => 0,
x_tick_number => 'auto',
y_tick_number => 'auto',
# y_label_skip => 2,
box_axis => 1,
line_width => 1,
# zero_axis => 'true',
# zero_axis_only => 1,
x_label_position => 1/2,
y_label_position => 1/2,
x_number_format => undef,
y_number_format => undef,
# x_label_skip => 1/2,
# x_tick_offset => 2,
transparent => 0,
);
$my_graph->set_title_font('../Dustismo_Sans.ttf', 18);
$my_graph->set_x_label_font('../Dustismo_Sans.ttf', 10);
$my_graph->set_y_label_font('../Dustismo_Sans.ttf', 10);
$my_graph->set_x_axis_font('../Dustismo_Sans.ttf', 8);
$my_graph->set_y_axis_font('../Dustismo_Sans.ttf', 8);
$my_graph->set_legend_font('../Dustismo_Sans.ttf', 9);
# Put some background text in, but only if we have TTF support
if (1) {
my $gd = $my_graph->gd;
$gdta = GD::Text::Align->new($gd,
text => 'maximum',
font => ['../Dustismo_Sans.ttf', GD::Font->Small],
ptsize => 12,
colour => $red,
valign => 'bottom',
halign => 'center',
) or warn $gdta->error;
}
my $gd = $my_graph->gd;
my $white = $gd->colorAllocate(255,255,255);
my $pink = $gd->colorAllocate(255,240,240);
my $gdta;
$gdta = GD::Text::Align->new($gd,
text => 'Arsenal will win',
font => '../Dustismo_Sans.ttf',
ptsize => 72,
colour => $pink,
valign => 'center',
halign => 'center',
) or warn $gdta->error;
$gdta->draw();
$my_graph->set_legend( $myFname, $mySname);
my $chart = $my_graph->plot(\@data);
binmode STDOUT;
print $chart->png;
}
#########################################
sub getValues
#########################################
{
my $temp=shift;
my $column=shift;
my ($count,$countTwo);
my $ref;
@which=('','date','open','high','low','close','vol','adj');
foreach my $loop(split(/\n/,$temp))
{
$count++;
if ($count==1) {next;}
($date,$open,$high,$low,$close,$vol,$adj)=split(/,/,$loop);
$col=$which[$column];
if ($$col)
{
$ref.=$$col."|";
}
}
if (!$ref)
{
return 0;
}
else {
return $ref;
}
}
1;
Show quoted text>From: "Benjamin Warfield via RT" <bug-GDGraph@rt.cpan.org>
>Reply-To: bug-GDGraph@rt.cpan.org
>To: jctof@hotmail.com
>Subject: [rt.cpan.org #27228] X axis not rendered correctly Date: Mon, 21
>May 2007 18:21:30 -0400
>
>
><URL:
http://rt.cpan.org/Ticket/Display.html?id=27228 >
>
>I'm afraid that without actually seeing your code, I can't really tell
>you what's wrong, no. Also, unless you have a specific and verifiable
>bug to report against the GD::Graph distribution, this is not the right
>place to come for help: there's only one of me at the moment, and I may
>or may not have time to try to sort out your particular problem (this
>week, the latter applies).
>
>If you're using 1.43, you will probably find it worthwhile to go
>download version 1.44 from your local CPAN mirror in any case, since it
>has a goodly number of new features and bug fixes in it, but even if you
>don't, you might find the following FAQ entry helpful:
>
>
http://search.cpan.org/~bwarfield/GDGraph-1.44/Graph/FAQ.pod#Can_you_tell_me_how_to_do_X?
>
>Good luck!
>
> --Ben
Show quoted text