|
proportional |
Posted by Leo on Jan-08-2012 07:51 |
|
Hi, Peter,
I was unable to produce a bar chart with reasonable scale.
The output doesn't seem proportional, is that any way I can make it more to scale like
the hand-drawn one?
Thanks.
code:
#!/usr/bin/perl
use perlchartdir;
my $data = [709.72, 677.93, 678.59, 678.59, 678.59];
my $labels = ["Mon", "Tue", "Wed", "Thu", "Fri"];
my $c = new XYChart(250, 250);
$c->getLegend()->setPos(-9999, -9999);
$c->setPlotArea(-1, -1, $c->getWidth() + 2, $c->getHeight() + 2, 0xFFFFFF, 0xFFFFFF,
0xFFFFFF, 0xFFFFFF);
$c->addBarLayer($data, 0x000099);
$c->xAxis()->setLabels($labels);
$c->xAxis->setColors(0xFF0000,0xFF0000,0xFF0000,0xFF0000);
$c->yAxis->setColors(0xFF0000,0xFF0000,0xFF0000,0xFF0000);
$c->makeChart("test1.png");
|
Re: proportional |
Posted by Peter Kwan on Jan-10-2012 00:48 |
|
Hi Leo,
The chart you get is using an axis that does not start from y = 0. The y-axis is probably from y = 670 to 720 or something similar. If you would like the y-axis to always from 0, you may use Axis.setAutoScale and set the "zero affinity" parameter to 1. For example:
$c->yAxis->setAutoScale(0, 0, 1);
Hope this can help.
Regards
Peter Kwan |
Re: proportional |
Posted by Javier Navarrete on Jan-21-2012 06:32 |
|
Thats very useful.
Thanks |
|