Chart-Clicker

 view release on metacpan or  search on metacpan

example/sparkline.pl  view on Meta::CPAN

$cc->add_to_datasets($ds);

my $defctx = $cc->get_context('default');

my $highds = Chart::Clicker::Data::DataSet->new(series => [ $series2 ]);
$cc->add_to_datasets($highds);

my $highctx = Chart::Clicker::Context->new(
  name => 'high',
  renderer => Chart::Clicker::Renderer::Point->new(
      shape => Geometry::Primitive::Rectangle->new(
          width => 3,
          height => 3
      )
  ),
  range_axis => $defctx->range_axis,
  domain_axis => $defctx->domain_axis
);
$cc->add_to_contexts($highctx);
$highds->context('high');
# 
my $noteds = Chart::Clicker::Data::DataSet->new(series => [ $series3 ]);
$cc->add_to_datasets($noteds);

my $notectx = Chart::Clicker::Context->new(
  name => 'notable',
  renderer => Chart::Clicker::Renderer::Point->new(
      shape => Geometry::Primitive::Rectangle->new(
          width => 3,
          height => 3
      )
  ),
  range_axis => $defctx->range_axis,
  domain_axis => $defctx->domain_axis
);
$cc->add_to_contexts($notectx);
$noteds->context('notable');

my $grey = Graphics::Color::RGB->new(
	red => .36, green => .36, blue => .36, alpha => 1
);
my $red = Graphics::Color::RGB->new(
	red => 1, green => 0, blue => 0
);
my $blue = Graphics::Color::RGB->new(
	red => .2, green => .6, blue => 1
);

my $mark = Chart::Clicker::Data::Marker->new(value => 2, value2 => 4);
$mark->brush->color(
    Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .15)
);
$mark->inside_color(
    Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .15)
);
$defctx->add_marker($mark);

$cc->color_allocator->colors([ $grey, $red, $blue ]);

$cc->plot->grid->visible(0);
$cc->legend->visible(0);
$cc->padding(2);
$cc->border->width(0);

$defctx->range_axis->hidden(1);
$defctx->range_axis->fudge_amount(.2);
$defctx->domain_axis->hidden(1);
$defctx->domain_axis->fudge_amount(.1);
$defctx->renderer->brush->width(1);

$cc->write_output('foo.png')



( run in 0.941 second using v1.01-cache-2.11-cpan-39bf76dae61 )