Created
July 28, 2009 12:30
-
-
Save omega/157214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| use Chart::Clicker; | |
| use Chart::Clicker::Data::Series::Size; | |
| use Chart::Clicker::Data::DataSet; | |
| use Geometry::Primitive::Circle; | |
| use Chart::Clicker::Renderer::Bubble; | |
| my $ticks = { labels => ["omega", "nilsi", "gram"], "values" => [1, 3, 2] }; | |
| my @series_in = ( | |
| { | |
| "keys" => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], | |
| name => "omega", | |
| sizes => [ | |
| 1, | |
| "0.5", | |
| "0.5", | |
| 1, | |
| "1.5", | |
| 2, | |
| 1, | |
| "0.5", | |
| "0.5", | |
| "0.5", | |
| "0.5", | |
| "0.5", | |
| "0.5", | |
| 1, | |
| 1, | |
| ], | |
| "values" => [25, 3, 9, 17, 12, 14, 15, 20, 22, 8, 18, 23, 10, 19, 13], | |
| }, | |
| { | |
| "keys" => [3, 3, 3, 3], | |
| name => "nilsi", | |
| sizes => ["0.5", "0.5", "0.5", "0.5"], | |
| "values" => [23, 13, 12, 14], | |
| }, | |
| { | |
| "keys" => [2, 2, 2, 2, 2], | |
| name => "gram", | |
| sizes => ["0.5", 1, "0.5", "0.5", 1], | |
| "values" => [6, 16, 9, 10, 12], | |
| }, | |
| ); | |
| #### END DATA #### | |
| my $cc = Chart::Clicker->new( | |
| format => 'png', | |
| width => 900, | |
| height => 700, | |
| ); | |
| my $context = $cc->get_context('default'); | |
| $context->domain_axis->tick_values($ticks->{values}); | |
| $context->domain_axis->tick_labels($ticks->{labels}); | |
| $context->domain_axis->tick_label_angle(1.5); | |
| $cc->legend->visible(0); | |
| $context->range_axis->format('%d'); | |
| $context->range_axis->fudge_amount(0.5); | |
| $context->domain_axis->fudge_amount(0.1); | |
| $context->range_axis->ticks(20); | |
| { | |
| my @series; | |
| foreach my $s ( @series_in ) { | |
| push(@series, Chart::Clicker::Data::Series::Size->new(%{ $s })); | |
| } | |
| my $ds = Chart::Clicker::Data::DataSet->new( series => \@series ); | |
| $cc->add_to_datasets($ds); | |
| } | |
| $context->renderer( Chart::Clicker::Renderer::Bubble->new( ) ); | |
| $cc->write_output('foo.png'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment