|
using data from perl array with chartdirector perl |
Posted by Harika on Mar-26-2010 04:04 |
|
Hi everyone,
I am newbie to Chartdirector. I am having trouble regarding getting data
from a perl array variable for creating a barchart. For example, in the sample
simplebar.pl the x-axis data is stored in,
my $data = [85 , 156 , 179.5, 211, 123];
If I have a large dataset in a perl array variable like @arr. How can I draw a chart for
the data ?
Thank you,
Harika. |
Re: using data from perl array with chartdirector perl |
Posted by Peter Kwan on Mar-26-2010 12:56 |
|
Hi Harika,
Instead of using $data, you just need to pass your own array reference to ChartDirector.
In Perl syntax, [1, 2, 3] is an array reference, while (1, 2, 3) is an array. If you get an array @arr, the array reference is \\@arr.
For example:
#Already get an array @arr, pass the array reference \\@arr to addLineLayer
$c->addLineLayer(\\@arr);
Hope this can help.
Regards
Peter Kwan |
|