|
bar border |
Posted by Leo on Mar-29-2012 08:55 |
|
Hello, Peter,
How do I remove the black bar border, ie borderless bar.
Thanks.
code:
#!/usr/bin/perl
use perlchartdir;
# The data for the bar chart
my $data = [3.3,14.1,18.9,24.3,39.4,100];
# The labels for the bar chart
my $labels = ["Short Term Debt","Other Liabilities","Accts Payables","Long Term
Debt","Net Worth","Total Assets"];
# Create a XYChart object of size 600 x 250 pixels
my $c = new XYChart(310, 200);
# Add a title to the chart using Arial Bold Italic font
#$c->addTitle("Revenue Estimation - Year 2002", "arialbi.ttf");
# Set the plotarea at (100, 30) and of size 400 x 200 pixels. Set the plotarea #
border, background and grid lines to Transparent
$c->setPlotArea(140, 15, 150, 150, $perlchartdir::Transparent,
$perlchartdir::Transparent, $perlchartdir::Transparent,
$perlchartdir::Transparent, $perlchartdir::Transparent);
# Add a bar chart layer using the given data. Use a gradient color for the bars,
# where the gradient is from dark green (0x008000) to white (0xffffff) #my
$layer = $c->addBarLayer($data, $c->gradientColor(100, 0, 500, 0, 0x008000,
0xffffff));
my $layer = $c->addBarLayer($data, 0xffdd11);
# Swap the axis so that the bars are drawn horizontally
$c->swapXY(1);
# Set the bar gap to 10%
$layer->setBarGap(0.2);
# Use the format "US$ xxx millions" as the bar label
#$layer->setAggregateLabelFormat("US\\$ {value} millions");
$layer->setAggregateLabelFormat("{value}%");
# Set the bar label font to 10 pts Times Bold Italic/dark red (0x663300)
#$layer->setAggregateLabelStyle("timesbi.ttf", 10, 0x663300);
$layer->setAggregateLabelStyle("arialbd.ttf", 13, 0x000000);
# Set the labels on the x axis
my $textbox = $c->xAxis()->setLabels($labels);
# Set the x axis label font to 10pt Arial Bold Italic
$textbox->setFontStyle("arialbd.ttf");
$textbox->setFontSize(13);
# Set the x axis to Transparent, with labels in dark red (0x663300)
$c->xAxis()->setColors($perlchartdir::Transparent, 0x000000);
# Set the y axis and labels to Transparent
$c->yAxis()->setColors($perlchartdir::Transparent, $perlchartdir::Transparent);
# Output the chart
$c->makeChart("b.png")
|
Re: bar border |
Posted by Peter Kwan on Mar-30-2012 00:18 |
|
Hi Leo,
You may set the border color to $perlchartdir::Transparent, or to $perlchartdir::SameAsMainColor. For example:
$layer->setBorderColor($perlchartdir::Transparent);
Hope this can help.
Regards
Peter Kwan |
|