Re: Using Pixbufs and Pixmaps



Travis Boucher wrote:

My imaginary API would look something similar to this:

my $graph = MyGraphClass->new(); $window->add($graph);

$graph->add_object(MyGraphClass::Candlestick->new($graph, $open, $close,
$high, $low, $timestamp)); $graph->add_object(MyGraphClass::TrendLine->new($graph, $ts1, $val1, $ts2,
$val2)); $graph->add_object(MyGraphClass::Text->new($graph, "Hello World",
$timestamp_anchor, $value_anchor)); ... for every object on the graph

Each MyGraphClass::XXX class would inherit from a base 'MyGraphClass::Item'
class which would emit events for mouse overs, clicks, etc.

The main MyGraphClass class would call a render method for each object, which
would pass back a Pixmap?/Pixbuf? which would then be rendered onto the main
drawable widget for the graph.  I'd like to extend this eventually to include
a number of different types of objects on the graph including animations.

This sounds like you want to reinvent a canvas. Take a look at Gnome2::Canvas or Goo::Canvas. Or maybe you can even use an existing charting library? Take a look at Chart::Clicker, for example.

-Torsten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]