Graph-ChartSVG

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

  frame

      a Frame object to surround the active part of the graph

  grid

      a Grid oject to add to the graph
      
      

  overlay

     a Overlay to add on top of the graph ( useful to enhance a period in alarm )
      

  layer

     a Layer object
      

  border

lib/Graph/ChartSVG.pm  view on Meta::CPAN

package  Graph::ChartSVG::Layer;
use Moose;

has 'data'    => ( isa => 'Graph::ChartSVG::Data',    is => 'rw', required => 0 );
has 'glyph'   => ( isa => 'Graph::ChartSVG::Glyph',   is => 'rw', required => 0 );
has 'overlay' => ( isa => 'Graph::ChartSVG::Overlay', is => 'rw', required => 0 );

1;

package  Graph::ChartSVG::Data;
use Moose;

has 'data_set'  => ( isa => 'ArrayRef',       is => 'rw', required => 0 );
has 'type'      => ( isa => 'Str',            is => 'rw', required => 0, default => 'line' );
has 'thickness' => ( isa => 'Num',            is => 'rw', required => 0, default => 1 );
has 'color'     => ( isa => 'Str | ArrayRef', is => 'rw', required => 0, default => '00000000' );

lib/Graph/ChartSVG.pm  view on Meta::CPAN

use vars qw( $VERSION );

$VERSION = '2.07';

has 'active_size' => ( isa => 'ArrayRef', is => 'rw', required => 0 );
has 'total_size'  => ( isa => 'ArrayRef', is => 'rw', required => 0 );
has 'bg_color'    => ( isa => 'Str',      is => 'rw', required => 0, default => 'ffffffff' );
has 'frame'       => ( isa => 'Graph::ChartSVG::Frame',    is => 'rw', required => 0, default => sub { Graph::ChartSVG::Frame->new } );
has 'grid'        => ( isa => 'Graph::ChartSVG::Grid',     is => 'rw', required => 0 );
#has 'reticle'     => ( isa => 'HashRef',  is => 'rw', required => 0 );
has 'overlay' => ( isa => 'Graph::ChartSVG::Overlay',  is => 'rw', required => 0 );
has 'glyph'   => ( isa => 'ArrayRef', is => 'rw', required => 0 );
#has 'layer'    => ( isa => 'ArrayRef', is => 'rw' ,default => sub { [ Layer->new]} );
has 'layer'   => ( isa => 'ArrayRef[Layer]', is => 'rw' );
has 'image'   => ( isa => 'Str',             is => 'rw' );
has 'svg_raw' => ( isa => 'Str',             is => 'rw' );
has 'border'  => ( isa => 'Graph::ChartSVG::Border',          is => 'rw', required => 0, default => sub { Graph::ChartSVG::Border->new } );
has 'tag' => ( isa => 'Bool', is => 'rw', required => 0 );
#has 'tag' => ( isa => 'Tag', is => 'rw', required => 0 );
#has 'tag' =>  ( isa => 'HashRef', is => 'rw', required => 0 );

lib/Graph/ChartSVG.pm  view on Meta::CPAN

                        y      => -$layer->{ debord_1 },
                        width  => $stop - $start,
                        height => $self->{ active_size }->[1] + $layer->{ debord_1 } + $layer->{ debord_2 },
                        style  => {

                            'opacity' => eval( hex( ( unpack "a6 a2", $color_hex )[1] ) / 255 ) || 1,
                            'fill' => '#' . ( unpack "a6", $color_hex ) || 0,
                            'fill-opacity' => eval( hex( ( unpack "a6 a2", $color_hex )[1] ) / 255 ) || 1,
                            'fill-rule' => 'nonzero'
                        },
                        id => 'v_overlay_' . $layer_ind . '_' . $ind
                    );
                    $ind++;
                }
            }
            if ( $layer->{ type } eq 'h' )
            {
                foreach my $start ( keys %{ $layer->{ data_set } } )
                {
                    my $stop = $layer->{ data_set }->{ $start };
                    my $k    = $layer_goup->rectangle(
                        x      => -$layer->{ debord_1 },
                        y      => $start,
                        width  => $self->{ active_size }->[0] + $layer->{ debord_1 } + $layer->{ debord_2 },
                        height => $stop - $start,
                        style  => {
                            'opacity' => eval( hex( ( unpack "a6 a2", $color_hex )[1] ) / 255 ) || 1,
                            'fill' => '#' . ( unpack "a6", $color_hex ) || 0,
                            'fill-opacity' => eval( hex( ( unpack "a6 a2", $color_hex )[1] ) / 255 ) || 1,
                            'fill-rule' => 'nonzero'
                        },
                        id => 'h_overlay_' . $layer_ind . '_' . $ind
                    );
                    $ind++;
                }
            }
        }
        $layer_ind++;
    }

    my $info_data_group = $svg->group( id => "info_data" );
    my $obj = Data::Serializer->new( 'compress' => 1 );

lib/Graph/ChartSVG.pm  view on Meta::CPAN


=head3      grid
 
=over 

=back

  a Grid oject to add to the graph
  
  
=head3     overlay
 
=over 

=back

 a Overlay to add on top of the graph ( useful to enhance a period in alarm )
  
=head3     layer
 
=over



( run in 0.556 second using v1.01-cache-2.11-cpan-49f99fa48dc )