Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Gtk2 of GD::Graph two_axis

by deadpickle (Pilgrim)
on Mar 05, 2009 at 18:15 UTC ( [id://748626]=perlquestion: print w/replies, xml ) Need Help??

deadpickle has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to build a two_axis graph using Gtk2__Ex::Graph::GD. I can't get the second axis to display on my test build. It is probably something simple that is wrong but I have been staring at it for awhile and can't find it. Any ideas?
#!/usr/bin/perl -w use strict; use Gtk2 '-init'; use Glib qw/TRUE FALSE/; use Gtk2::Ex::Graph::GD; use GD::Graph::Data; &data_build; Gtk2->main; sub data_build { my $data_window = Gtk2::Window->new('toplevel'); $data_window->signal_connect(delete_event=> sub{Gtk2->main_quit}); $data_window->set_title('Sonde Data'); $data_window->set_position('center'); $data_window->set_default_size(350,350); my $data_table = Gtk2::Table->new(6,2,FALSE); my $utc_label = Gtk2::Label->new("UTC"); my $utc_entry = Gtk2::Entry->new(); $utc_entry->set_editable(0); my $temp_label = Gtk2::Label->new("Temperature"); my $temp_entry = Gtk2::Entry->new(); $temp_entry->set_editable(0); my $pres_label = Gtk2::Label->new("Pressure"); my $pres_entry = Gtk2::Entry->new(); $pres_entry->set_editable(0); my $rh1_label = Gtk2::Label->new("Relative Humidity(1)"); my $rh1_entry = Gtk2::Entry->new(); $rh1_entry->set_editable(0); my $rh2_label = Gtk2::Label->new("Relative Humidity(2)"); my $rh2_entry = Gtk2::Entry->new(); $rh2_entry->set_editable(0); my $met_data1 = GD::Graph::Data->new([ [ 201002,201004,201006,201008,201010,201012], [ 0,10,20,30,40,50], [ 1000,975,950,925,920,910] ]) or die GD::Graph::Data->error; my $met_graph1 = Gtk2::Ex::Graph::GD->new(350, 200, 'lines'); $met_graph1->set( x_label => 'UTC', y1_label => 'Celcius', y2_label => 'Millibars', y1_max_value => 50, y1_min_value => 0, y2_max_value => 1000, y2_min_value => 900, y1_tick_number => 14, y2_tick_number => 14, two_axis => 2, line_width => 3, transparent => 0, dclrs => [ qw(red blue) ], x_label_position => 1/2, ); my $met_image1 = $met_graph1->get_image($met_data1); $data_table->attach_defaults($utc_label,0,1,0,1); $data_table->attach_defaults($utc_entry,1,2,0,1); $data_table->attach_defaults($temp_label,0,1,1,2); $data_table->attach_defaults($temp_entry,1,2,1,2); $data_table->attach_defaults($pres_label,0,1,2,3); $data_table->attach_defaults($pres_entry,1,2,2,3); $data_table->attach_defaults($rh1_label,0,1,3,4); $data_table->attach_defaults($rh1_entry,1,2,3,4); $data_table->attach_defaults($rh2_label,0,1,4,5); $data_table->attach_defaults($rh2_entry,1,2,4,5); $data_table->attach_defaults($met_image1,0,2,5,6); $data_window->add($data_table); $data_window->show_all; return 1; }

Replies are listed 'Best First'.
Re: Gtk2 of GD::Graph two_axis
by bellaire (Hermit) on Mar 05, 2009 at 18:44 UTC
    According to GD::Graph, the option for two axes is two_axes, but you have two_axis.
      Wow. If there was only a way to not feel stupid about asking that question.
        Nah, no need to beat yourself up. The very best of us can benefit from another pair of eyeballs on our code from time to time. Stare at something too long, and your brain just refuses to see anything more. :) Then you either have to wait for it (your brain) to reset, or get someone else to take a look.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://748626]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found