Hypatia-Chart-Clicker

 view release on metacpan or  search on metacpan

lib/Hypatia/Chart/Clicker/Types.pm  view on Meta::CPAN

subtype Color, as class_type("Graphics::Color::RGB");
coerce Color, from HashRef, via {Graphics::Color::RGB->new($_)};
coerce Color, from NumBetween0And1, via { Graphics::Color::RGB->new({r=>$_,g=>$_,b=>$_,a=>$_}) };

subtype Padding, as class_type("Graphics::Primitive::Insets");
coerce Padding, from PositiveInt, via { Graphics::Primitive::Insets->new({top=>$_,bottom=>$_,right=>$_,left=>$_}) };
coerce Padding, from HashRef[PositiveInt], via { Graphics::Primitive::Insets->new($_) };

enum Position,[qw(north south east west center North South East West Center)];

enum Format, [qw(png pdf ps svg PNG PDF PS SVG Png Pdf Ps Svg)];

subtype Font, as class_type("Graphics::Primitive::Font");
coerce Font, from HashRef, via {Graphics::Primitive::Font->new($_)};

subtype RangeArrayRef, as ArrayRef[Num], where{@{$_} == 2 and $_->[0] < $_->[1]};

subtype AxisRange, as class_type("Chart::Clicker::Data::Range");
coerce AxisRange, from RangeArrayRef, via {
    Chart::Clicker::Data::Range->new({min=>$_->[0], max=>$_->[1]});
};

t/sqlite/options/format.t  view on Meta::CPAN

    eval "require DBD::SQLite";
    if($@)
    {
	require Test::More;
	Test::More::plan(skip_all=>"DBD::SQLite is required to run these tests.")
    }
}

my $hdts=Hypatia::DBI::Test::SQLite->new({table=>"hypatia_test_xy"});

my @formats=qw(png pdf ps svg PNG PDF PS SVG Png Pdf Ps Svg);

foreach my $format(@formats)
{

    my $hypatia=Hypatia->new({
	dbi=>{dbh=>$hdts->dbh,table=>"hypatia_test_xy"},
	columns=>{x=>"x1",y=>"y1"},
	back_end=>"Chart::Clicker",
	graph_type=>"Line",
	options=>{format=>$format}



( run in 0.503 second using v1.01-cache-2.11-cpan-0a6323c29d9 )