Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Basic support for undef values #8

wants to merge 1 commit into from

2 participants


Hi, I'm trying out Chart::Clicker as a replacement for the ancient Chart module, and so far it looks great, except that it doesn't handle series with missing values. This might be needed, for example, if you have two share prices to plot but there is no price for one of them on a given day because of a holiday. This patch adds the minimal support for series with undef values to be handed; when drawing a line chart the line will go unbroken from the previous to the next observation, which is good enough. I may add more sophisticated support for series with missing values later.

Let me know what you think and whether you're willing to apply the patch and add this functionality.


While I like the feature, I'm not a fan of removing the type from the ArrayRef. This would make it possible for people to stuff all manner of things into the array.

Perhaps a Num|Undef instead?

Also, some tests would be welcome.

Yes, ArrayRef[Num|Undef] sounds better. I'll write a couple of tests.


Closing due to inaction.

@gphat gphat closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 11, 2012
  1. Basic support for series with undef values.

    Ed Avis authored
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +2 −1  lib/Chart/Clicker/
  2. +2 −2 lib/Chart/Clicker/Data/
3  lib/Chart/Clicker/
@@ -508,6 +508,7 @@ Given a span and a value, returns it's pixel position on this Axis.
sub mark {
my ($self, $span, $value) = @_;
+ return undef if not defined $value;
if($self->has_skip_range) {
# We must completely ignore values that fall inside the skip range,
@@ -712,4 +713,4 @@ __PACKAGE__->meta->make_immutable;
no Moose;
4 lib/Chart/Clicker/Data/
@@ -110,7 +110,7 @@ Get the count of values in this series.
has 'values' => (
traits => [ 'Array' ],
is => 'rw',
- isa => 'ArrayRef[Num]',
+ isa => 'ArrayRef',
default => sub { [] },
handles => {
'add_to_values' => 'push',
@@ -127,7 +127,7 @@ sub _build_range {
unless scalar(@{ $values });
return Chart::Clicker::Data::Range->new(
- lower => min(@{ $values }), upper => max(@{ $values})
+ lower => min(grep { defined } @{ $values }), upper => max(grep { defined } @{ $values})
Something went wrong with that request. Please try again.