in reply to Chart::Clicker Question

I tried this. I had to make some changes to get it to work, but this is as close as I could get.
#!/usr/bin/perl use strict; use warnings; use Chart::Clicker; use Chart::Clicker::Context; use Chart::Clicker::Data::DataSet; use Chart::Clicker::Data::Marker; use Chart::Clicker::Data::Series; use Chart::Clicker::Renderer::Bar; use Geometry::Primitive::Rectangle; use Graphics::Color::RGB; my $cc = Chart::Clicker->new(width => 500, height => 250); my $series = Chart::Clicker::Data::Series->new( keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], values => [ 4, 5.6, 7.9, 9, 13, 17, 23, 35, 46, 50 ], ); my $ds = Chart::Clicker::Data::DataSet->new(series => [$series]); $cc->add_to_datasets($ds); my $def = $cc->get_context('default'); my $area = Chart::Clicker::Renderer::Bar->new(opacity => .6); $area->brush->width(3); $def->renderer($area); $def->range_axis->tick_values([qw(1 3 5)]); $def->range_axis->label('Scores'); $def->range_axis->format('%d'); $def->domain_axis->tick_values([qw(2 4 6 8 10)]); $def->domain_axis->label('Survey Questions'); $def->domain_axis->format('%d'); $def->domain_axis->fudge_amount(.05); $cc->title->text('Dynamic Charting: Survey 1 - Front En +d '); $cc->title->font->size(20); $cc->title->padding->bottom(10); $cc->write_output('Dynamic Charting: Survey 1.png');

Replies are listed 'Best First'.
Re^2: Chart::Clicker Question
by Perobl (Beadle) on Oct 30, 2010 at 14:49 UTC

    Thanks so much for your help!

    I'm pulling my hair out with Chart::Clicker.

    I copied your code to my server and ran it. On my server, the resulting .PNG is simply a white rectangle with one thin horizontal line running along the bottom.

    This is typical of the output I usually see. When I run the tutorial programs on CPAN, I get the same sort of results.

    Do you think there might be a problem with the Chart::Clicker installation on my server? I've taken great care to load ALL of the prerequisite Perl modules. I did have some trouble getting Cairo loaded, but the server now reports that all modules are loaded okay (via CPanel). It just seems like things aren't working right (i.e. it seems like I'm not getting the results you are getting).

    My own program produces a chart that is about 85% complete. Like I said, some of the tick labels are incomplete. And no matter what I do, I cannot get the vertical axis to work!

    I am totally stuck, and I'd rather not pull the plug on this because I have too much time invested and need a good charting solution.

    Any other suggestions?

      Here's a bundle to check to see that you have all the prerequisites.
      #!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->install( "Test::PDF", "ExtUtils::PkgConfig", "ExtUtils::Depends", "Cairo", "Test::LongString", "Text::Flow", "Graphics::Primitive::Driver::Cairo", "Math::Gradient", "Set::Infinite", "DateTime::Set", "Algorithm::Diff", "Text::Diff", "Test::Differences", "Color::Scheme", "Class::Data::Inheritable", "Class::Accessor::Fast", "Module::Pluggable", "Color::Library", "Test::Number::Delta", "MooseX::Aliases", "Graphics::Color", "Forest", "Graphics::Primitive", "MooseX::AttributeHelpers", "JSON::Any", "File::Path", "File::NFSLock", "IO::Dir", "Path::Class", "Carp::Clan", "MooseX::Types", "MooseX::Types::Path::Class", "Test::TempDir", "Test::NoWarnings", "Test::Tester", "Test::Deep", "String::RewritePrefix", "MooseX::Storage", "Math::Complex", "Check::ISA", "Hash::Util::FieldHash::Compat", "Algorithm::C3", "Class::C3", "MRO::Compat", "Scope::Guard", "Devel::GlobalDestruction", "Class::MOP", "Try::Tiny", "Moose", "Task::Weaken", "XSLoader", "base", "Variable::Magic", "Data::OptList", "Sub::Install", "Params::Util", "Sub::Exporter", "B::Hooks::EndOfScope", "Sub::Identify", "Sub::Name", "Package::Stash", "namespace::clean", "Tie::RefHash", "Test::use::ok", "Tie::ToObject", "Data::Visitor", "MooseX::Clone", "Geometry::Primitive", "ExtUtils::MakeMaker", "Layout::Manager", "Time::Local", "List::MoreUtils", "DateTime::Locale", "File::Temp", "Exporter", "ExtUtils::ParseXS", "Module::Build", "Attribute::Handlers", "ExtUtils::CBuilder", "Params::Validate", "Class::Singleton", "DateTime::TimeZone", "Test", "Text::Wrap", "Pod::Escapes", "Pod::Simple", "File::Spec", "Pod::Man", "Sub::Uplevel", "Test::Exception", "Test::Harness", "Test::More", "Scalar::Util", "DateTime", "Chart::Clicker");

        Thank you. I actually happened upon this list earlier and have been using it.

        Initially, I installed all of these modules on our server (Red Hat). This weekend, I installed everything locally on my Mac. The installation on my Mac is better. I was able to run the program above and display the chart as expected.

        However, this really isn't an area where I have tremendous expertise! When I use your list as a guide to verify that all modules are installed, I run into some problems. I'm using the following program to check my installed modules:

        #!/usr/local/bin/perl use ExtUtils::Installed; my $instmod = ExtUtils::Installed -> new(); print "\n\nPerl Modules:\n\n"; foreach my $module ($instmod -> modules()) { my $version = $instmod -> version($module) || "???"; print "$module -- $version\n"; }; print "\n\nPerl Modules Are Stored Here:\n\n"; print map { $_ . "\n" } @INC;

        Many of the modules show up. Many do not. I think all of the modules are loaded, but some are buried. For example, Module::Pluggable is installed here on my Mac:

        /Library/Perl/Updates/5.8.9/darwin-thread-multi-2level/Module

        Module::Pluggable is one of the modules that is NOT showing up via the above program.

        It seems like the modules in the Updates directory aren't showing up when I run the small program above. However, @INC includes: /Library/Perl/Updates/5.8.9/darwin-thread-multi-2level

        Maybe this isn't even a problem?

        If is use the following in a test program:

        use Module::Pluggable;

        It doesn't throw any errors.

        If this is acceptable, then I think I have a good local install on my Mac. I still have to check the external server.

        Am I on the right track??? I feel like I'm in over my head with Chart::Clicker!

        Thank you!!!