Perobl has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to figure out Chart::Clicker. The supporting documentation seems a bit thin.
I have everything working except for my axes. I am able to display domain_axis tick_labels save for the fact that some of the tick_labels appear to be "chopped off". For example, a tick_label that should say "Q 2" displays as "Q".
Further, the domain_axis label itself is limited to only a few characters. If I exceed a certain number of characters, the chart won't display at all.
I'm unable to display my range axis at all! As soon as I set hidden to zero, the chart disappears.
My code follows:
Can anyone lend me a hand? Thank you!# --------------------------------------------------- # create the survey 1 mean chart using Chart::Clicker # --------------------------------------------------- # instantiate new Chart::Clicker object my $cc = Chart::Clicker -> new(width => 800, height => 400); # define ticks, series and dataset for chart my $ticks = {labels => ['Q 1A', 'Q 2', 'Q 3', 'Q 4', 'Q 5', 'Q 6A'], " +values" => [1, 2, 3, 4, 5, 6],}; my $series = Chart::Clicker::Data::Series -> new(keys => $ticks -> {va +lues}, values => \@qavg); my $ds = Chart::Clicker::Data::DataSet -> new(series => [$series],); # define Chart::Clicker context my $context = $cc -> get_context('default'); $context -> range_axis -> hidden(1); $context -> range_axis -> fudge_amount(.01); $context -> range_axis -> ticks(5); $context -> range_axis -> range -> min(0); $context -> range_axis -> range -> max(5); $context -> range_axis -> label('Survey Scores'); $context -> range_axis -> brush -> width(1); $context -> domain_axis -> hidden(0); $context -> domain_axis -> fudge_amount(.1); $context -> domain_axis -> baseline(1); $context -> domain_axis -> tick_values($ticks -> {values}); $context -> domain_axis -> tick_labels($ticks -> {labels}); $context -> domain_axis -> tick_label_angle(); $context -> domain_axis -> label("Survey Questions"); $context -> domain_axis -> brush -> width(1); # define data allocator for the chart's bar color my $ca = Chart::Clicker::Drawing::ColorAllocator -> new(); my $blue = Graphics::Color::RGB -> new({red => .15, green => .3, blue +=> .5, alpha => .75}); $ca -> add_to_colors($blue); # instantiate a new renderer (bar chart) my $renderer = Chart::Clicker::Renderer::Bar -> new(); # finish setting the chart parameters $cc -> add_to_datasets($ds); $cc -> set_renderer($renderer); $cc -> color_allocator($ca); $cc -> border -> width(1); $cc -> legend -> visible(0); # define chart title $cc -> title -> text('Dynamic Charting: Survey 1 - Front End of Busine +ss (Mean Analysis)'); $cc -> title -> font -> size(20); $cc -> title -> padding -> bottom(10); # render the chart $cc -> draw; $cc -> write('/home/wiw/public_html/tmp/s1avg.png');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Chart::Clicker Question
by Khen1950fx (Canon) on Oct 30, 2010 at 13:03 UTC | |
by Perobl (Beadle) on Oct 30, 2010 at 14:49 UTC | |
by Khen1950fx (Canon) on Oct 31, 2010 at 00:19 UTC | |
by Perobl (Beadle) on Oct 31, 2010 at 15:17 UTC | |
by Anonymous Monk on Oct 31, 2010 at 15:29 UTC | |
|