ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Perl ChartDir not showing text/labels
Posted by Loyd Blankenship on Jun-16-2012 04:34
Attachments:
I'm attempting to get the CGI version of your threedbar.pl program to work. I've put a
CGI wrapper around it, and the graph displays fine -- but none of the labels show. I've
tried it in IE, Chrome and Firefox. Code follows, as does screenshot. Any light that you
could shed on this would be appreciated...

Thanks!

-- code

#!/usr/bin/perl

# Include current script directory in the module path (needed on Microsoft IIS).
# This allows this script to work by copying ChartDirector to the same directory
# as the script (as an alternative to installation in Perl module directory)
use File::Basename;
use lib dirname($0) =~ /(.*)/;
use CGI;
use perlchartdir;

$query = new CGI;
print $query->header;
print "<title>Test Chart</title>\\n";
print "</head>\\n";
print "<body>\\n";

#from here it's pasted from the demo program
# The data for the bar chart
my $data = [85, 156, 179.5, 211, 123];

# The labels for the bar chart
my $labels = ["Mon", "Tue", "Wed", "Thu", "Fri"];

# Create a XYChart object of size 300 x 280 pixels
my $c = new XYChart(300, 280);

# Set the plotarea at (45, 30) and of size 200 x 200 pixels
$c->setPlotArea(45, 30, 200, 200);

# Add a title to the chart
$c->addTitle("Weekly Server Load");

# Add a title to the y axis
$c->yAxis()->setTitle("MBytes");

# Add a title to the x axis
$c->xAxis()->setTitle("Work Week 25");

# Add a bar chart layer with green (0x00ff00) bars using the given data
$c->addBarLayer($data, 0x00ff00)->set3D();

# Set the labels on the x axis.
$c->xAxis()->setLabels($labels);

# Output the chart
$fname = "test.png";
$fname = $c->makeTmpFile('/var/www/html/tmp');
print "<OBJECT data=\\"redacted/tmp/$fname\\" type=\\"image/png\\"></OBJECT>";
print "<br />";
print "</body>\\n";
label-bug.jpg

  Re: Perl ChartDir not showing text/labels
Posted by Loyd Blankenship on Jun-16-2012 04:49
Protip: Make sure you remember to copy the fonts directory over... problem solved.

/smackhead