SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
GD and GD::Graph
          Chart::Clicker
              GraphViz
                   SVG




      Graphic Visualization
There is a Life after GD and GD::Graph


                 Uwe Voelker

                     XING AG


             August 5th 2010




            Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                            History
                           Chart::Clicker
                                            Examples
                               GraphViz
                                            Code
                                    SVG


History



          1990 ImageMagick
          1994 gdlib
          1996 GD
          1997 GD::Graph
          1997 Image::Magick
          2003 Book “Grafiken mit Perl” (GD, ImageMagick, Gimp)




                             Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                History
               Chart::Clicker
                                Examples
                   GraphViz
                                Code
                        SVG


Examples




                 Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                History
               Chart::Clicker
                                Examples
                   GraphViz
                                Code
                        SVG


Examples




                 Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                            History
                           Chart::Clicker
                                            Examples
                               GraphViz
                                            Code
                                    SVG


Code
  use GD : : Graph : : b a r s ;
  use GD : : Graph : : Data ;

 my $ d a t a = GD : : Graph : : Data−>new ( [
   [ qw/1 s t 2 nd 3 r d 4 t h 5 t h 6 t h 7 t h 8 t h 9 t h / ] ,
   [ 1 , 2 , 5 , 6 , 3 , 1.5 , 1 , 3 , 4] ,
 ] ) o r d i e GD : : Graph : : Data−>e r r o r ;

 my $ g r a p h = GD : : Graph : : b a r s −>new ; # 400 x 300
 $graph−>s e t ( b a r s p a c i n g => 8 ,
                  s h a d o w d e p t h => 4 ,
                  shadowclr             => ’ d r e d ’ ,
                  t r a n s p a r e n t => 0 ,
                 ) o r warn $graph−>e r r o r ;
                             Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                           History
                          Chart::Clicker
                                           Examples
                              GraphViz
                                           Code
                                   SVG


Code



  $graph−>p l o t ( $ d a t a ) o r d i e $graph−>e r r o r ;

  open (OUT, ”>b a l k e n . png ” ) o r d i e $ ! ;
  binmode OUT;
  p r i n t OUT $graph−>gd−>png ;
  c l o s e OUT;




                            Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                            About
                           Chart::Clicker
                                            Examples
                               GraphViz
                                            Code
                                    SVG


About




        started 2006
        current version 2.65, July 2010
        http://github.com/gphat/chart-clicker/
        http://www.onemogin.com/clicker/




                             Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                              About
                             Chart::Clicker
                                              Examples
                                 GraphViz
                                              Code
                                      SVG


Examples


  5




  3




  1

             2            4               6              8            10
   Series 0 Series 1 Series 2




                                Uwe Voelker   Graphic Visualization
GD and GD::Graph
                                              About
                             Chart::Clicker
                                              Examples
                                 GraphViz
                                              Code
                                      SVG


Examples



  9




  5




  1
              2           4               6              8            10
   Series 0 Series 1 Series 2




                                Uwe Voelker   Graphic Visualization
GD and GD::Graph
                                              About
                             Chart::Clicker
                                              Examples
                                 GraphViz
                                              Code
                                      SVG


Examples


  5




  3




  1

           2             4                6               8           10
   Series 0 Series 1 Series 2




                                Uwe Voelker   Graphic Visualization
GD and GD::Graph
                                          About
                         Chart::Clicker
                                          Examples
                             GraphViz
                                          Code
                                  SVG


Examples




   Series 0 Series 1 Series 2 Series 3

                           Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                              About
                             Chart::Clicker
                                              Examples
                                 GraphViz
                                              Code
                                      SVG


Examples


  5




  3




  1

           2             4                6               8           10
   Series 0 Series 1 Series 2




                                Uwe Voelker   Graphic Visualization
GD and GD::Graph
                                               About
                              Chart::Clicker
                                               Examples
                                  GraphViz
                                               Code
                                       SVG


Code
  use   Chart : : C l i c k e r ;
  use   Chart : : C l i c k e r : : Context ;
  use   C h a r t : : C l i c k e r : : Data : : Dat aSe t ;
  use   C h a r t : : C l i c k e r : : Data : : Marker ;
  use   C h a r t : : C l i c k e r : : Data : : S e r i e s ;
  use   C h a r t : : C l i c k e r : : R e n d e r e r : : Bar ;
  use   Geometry : : P r i m i t i v e : : R e c t a n g l e ;
  use   G r a p h i c s : : C o l o r : : RGB ;

 my $ c c = C h a r t : : C l i c k e r −>new (
      w i d t h => 5 0 0 ,
      h e i g h t => 2 5 0 ,
      format => ’ p d f ’ ,
 );
                                Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                             About
                            Chart::Clicker
                                             Examples
                                GraphViz
                                             Code
                                     SVG


Code
 my @hours = qw/1 2 3 4 5 6 7 8 9 10 11 1 2 / ;

 my $ s e r i e s 1 = C h a r t : : C l i c k e r : : Data : : S e r i e s −>new (
     keys          =>  @hours ,
     v a l u e s => [ qw/ 5 . 8 5 . 0 4 . 9 4 . 8 4 . 5 4 . 2 5
                              3.5 2.9 2.5 1.8 .9 . 8 / ] ) ;
 my $ s e r i e s 2 = C h a r t : : C l i c k e r : : Data : : S e r i e s −>new (
     keys          =>  @hours ,
     v a l u e s => [ qw/ . 7 1 . 1 1 . 7 2 . 5 3 . 0 4 . 5
                              5.0 4.9 4.7 4.8 4.2 4 . 4 / ] ) ;
 my $ s e r i e s 3 = C h a r t : : C l i c k e r : : Data : : S e r i e s −>new (
     keys          =>  @hours ,
     v a l u e s => [ qw/ . 3 1 . 4 1 . 2 1 . 5 4 . 0 3 . 5
                              2.0 1.9 2.7 4.2 3.2 1 . 1 / ] ) ;
                              Uwe Voelker    Graphic Visualization
GD and GD::Graph
                                              About
                             Chart::Clicker
                                              Examples
                                 GraphViz
                                              Code
                                      SVG


Code
 my $ d s = C h a r t : : C l i c k e r : : Data : : DataSet−>new (
          s e r i e s => [ $ s e r i e s 1 , $ s e r i e s 2 , $ s e r i e s 3 ] ) ;
 $cc−>a d d t o d a t a s e t s ( $ d s ) ;
 my $ a r e a = C h a r t : : C l i c k e r : : R e n d e r e r : : Bar−>new (
          o p a c i t y => . 6 ) ;
 $ a r e a −>b r u s h −>w i d t h ( 3 ) ;
 my $ d e f = $cc−>g e t c o n t e x t ( ’ d e f a u l t ’ ) ;
 $ d e f −>r e n d e r e r ( $ a r e a ) ;
 $ d e f −>r a n g e a x i s −>t i c k v a l u e s ( [ qw( 1 3 5 ) ] ) ;
 $ d e f −>r a n g e a x i s −>format ( ’%d ’ ) ;
 $ d e f −>d o m a i n a x i s −>t i c k v a l u e s ( [ qw( 2 4 6 8 1 0 ) ] ) ;
 $ d e f −>d o m a i n a x i s −>format ( ’%d ’ ) ;
 $ d e f −>d o m a i n a x i s −>f u d g e a m o u n t ( . 0 5 ) ;
 $cc−>w r i t e o u t p u t ( ’ b a r . p d f ’ ) ;
                               Uwe Voelker    Graphic Visualization
About
                       GD and GD::Graph
                                            Examples
                           Chart::Clicker
                                            Hints
                               GraphViz
                                            GraphViz + Devel::NYTProf
                                    SVG
                                            GraphViz.pm


About




        graph visualization software
        different renderers
        http://www.graphviz.org/




                             Uwe Voelker    Graphic Visualization
About
                          GD and GD::Graph
                                                        Examples
                              Chart::Clicker
                                                        Hints
                                  GraphViz
                                                        GraphViz + Devel::NYTProf
                                       SVG
                                                        GraphViz.pm


Examples

                                                 name



                              1
                    C-I               institute
    name
                    n                       1
           course                                S-I
                    n
   code                                      n
                        S-C       m
                                        student             name



                                                    grade
                              number


                                      Uwe Voelker       Graphic Visualization
About
                           GD and GD::Graph
                                                       Examples
                               Chart::Clicker
                                                       Hints
                                   GraphViz
                                                       GraphViz + Devel::NYTProf
                                        SVG
                                                       GraphViz.pm


Examples
            0xf7fc4380                                                     3.43322790286038071e-06
                         0xf7fc4380                                            44.79998779296875
  0x10ba8                                 0xf7fc4380
                                                           0xf7fc4380                  0
                -1
                             2
            0xf7fc44b8                                                               (nil)
                                              1
                                                               2

                                                              (nil)
                2                            (nil)                                    -1



                                                               -1
                                              -1
                                                              (nil)


                            (nil)
                                                               -1

                                                           0xf7fc43e0
                             -1



                                                               1



                                    Uwe Voelker        Graphic Visualization
About
                        GD and GD::Graph
                                             Examples
                            Chart::Clicker
                                             Hints
                                GraphViz
                                             GraphViz + Devel::NYTProf
                                     SVG
                                             GraphViz.pm


Examples - simple dot file


  digraph test {
          London ;
          P a r i s [ l a b e l=” C i t y o f  n l u r v e ” ] ;
          ”New York ” ;

              London −> ”New York ” [ l a b e l=” F a r ” ] ;
              London −> P a r i s ;
              P a r i s −> London ;
  }




                              Uwe Voelker    Graphic Visualization
About
                      GD and GD::Graph
                                           Examples
                          Chart::Clicker
                                           Hints
                              GraphViz
                                           GraphViz + Devel::NYTProf
                                   SVG
                                           GraphViz.pm


Examples - image map



  d i g r a p h mainmap {
      input       [ URL=”N” , i d=”N” ] ;
      command [ URL=” N” , i d=”N” ] ;
      o u t p u t [ URL=”N” , i d=”N” ] ;

      i n p u t −> command −> o u t p u t ;
  }




                            Uwe Voelker    Graphic Visualization
About
                       GD and GD::Graph
                                              Examples
                           Chart::Clicker
                                              Hints
                               GraphViz
                                              GraphViz + Devel::NYTProf
                                    SVG
                                              GraphViz.pm


Examples - image map

  my $ f i l e = $ARGV [ 1 ] | |            ’ x . dot ’ ;

  # generate f i l e s
  ‘ d o t −Tcmapx np −o o u t . map −T g i f −o o u t . g i f $ f i l e ‘ ;

  # r e a d image map
  my @map = r e a d f i l e ( ’ o u t . map ’ ) ;
  my %node = ( ) ;
  f o r e a c h ( r e a d f i l e ( ’ o u t . map ’ ) ) {
       i f (/< a r e a .+ i d=” ( [ ˆ ” ]+) ” .+ c o o r d s=” ( [ ˆ ” ]+) ” / ) {
          $node { $1 } = [ s p l i t / , / , $2 ] ;
      }
  }

                             Uwe Voelker      Graphic Visualization
About
                       GD and GD::Graph
                                            Examples
                           Chart::Clicker
                                            Hints
                               GraphViz
                                            GraphViz + Devel::NYTProf
                                    SVG
                                            GraphViz.pm


Examples - image map
  my $app =      sub {
    my $ r e q   = P l a c k : : Request −>new ( s h i f t ) ;
    my $x        = $req −>param ( ’ image . x ’ ) | | 0 ;
    my $y        = $req −>param ( ’ image . y ’ ) | | 0 ;

    my $message = ’ ’ ;
    f o r e a c h my $ i d ( keys %node ) {
       my @c = @{ $node { $ i d } } ;
         i f ( $x >= $c [ 0 ] and $x <= $c [ 2 ] and
                $y >= $c [ 1 ] and $y <= $c [ 3 ] ) {
            $message = ” H i t $ i d . ” ;
            last ;
        }
    }
                             Uwe Voelker    Graphic Visualization
About
                             GD and GD::Graph
                                                  Examples
                                 Chart::Clicker
                                                  Hints
                                     GraphViz
                                                  GraphViz + Devel::NYTProf
                                          SVG
                                                  GraphViz.pm


Examples - image map

    my $ r e s = $req −>n e w r e s p o n s e ( 2 0 0 ) ;
    $ r e s −>c o n t e n t t y p e ( ’ t e x t / html ’ ) ;
    $ r e s −>body ( ’<html><body><form> ’ .
  ’<i n p u t t y p e=”image ” name=”image ” s r c =”o u t . g i f ”> ’ .
  ’</form><p> ’ . $message . ’</p></body></html> ’ ) ;

       r e t u r n $ r e s −> f i n a l i z e ;
  };

  builder {
     e n a b l e ’ S t a t i c ’ , p a t h => q r / o u t . ( g i f | map ) / ;
     $app ;
  };

                                   Uwe Voelker    Graphic Visualization
About
                     GD and GD::Graph
                                          Examples
                         Chart::Clicker
                                          Hints
                             GraphViz
                                          GraphViz + Devel::NYTProf
                                  SVG
                                          GraphViz.pm


Hints - different renderer




          dot hierarchical graphs, short edges, no crossings
        neato “spring model”, compact graphs
        twopi radial graphs, concentric circles
        circo circular layout, for cyclic structures




                           Uwe Voelker    Graphic Visualization
About
                  GD and GD::Graph
                                       Examples
                      Chart::Clicker
                                       Hints
                          GraphViz
                                       GraphViz + Devel::NYTProf
                               SVG
                                       GraphViz.pm


Hints - output




      dot -Tpdf input.dot > output.pdf




                        Uwe Voelker    Graphic Visualization
About
                    GD and GD::Graph
                                         Examples
                        Chart::Clicker
                                         Hints
                            GraphViz
                                         GraphViz + Devel::NYTProf
                                 SVG
                                         GraphViz.pm


Hints - output




      dot -Tpdf input.dot > output.pdf
      smaller margins
      dot -Teps input.dot > output.eps
      epstopdf output.eps




                          Uwe Voelker    Graphic Visualization
About
                       GD and GD::Graph
                                            Examples
                           Chart::Clicker
                                            Hints
                               GraphViz
                                            GraphViz + Devel::NYTProf
                                    SVG
                                            GraphViz.pm


Hints - layout




      use rank and randir
      use invisible cluster to group nodes
      reverse arrows
      read the manual and FAQ




                             Uwe Voelker    Graphic Visualization
About
                          GD and GD::Graph
                                               Examples
                              Chart::Clicker
                                               Hints
                                  GraphViz
                                               GraphViz + Devel::NYTProf
                                       SVG
                                               GraphViz.pm


GraphViz + Devel::NYTProf
  sub add {
      $sum += $ f o r e a c h ( @ ) ;
      r e t u r n $sum ;
  }

  sub m u l t i p l y {
      my $ p r o d u c t = 1 ;
      $ p r o d u c t ∗= $ f o r e a c h ( @ ) ;
      return $product ;
  }

  sub s q u a r e { m u l t i p l y ( $ [ 0 ] , $ [ 0 ] ) }

  p r i n t m u l t i p l y ( s q u a r e ( 2 ) , add ( 1 , 3 ) ) ;
                                Uwe Voelker    Graphic Visualization
About
                 GD and GD::Graph
                                      Examples
                     Chart::Clicker
                                      Hints
                         GraphViz
                                      GraphViz + Devel::NYTProf
                              SVG
                                      GraphViz.pm


GraphViz + Devel::NYTProf


                                  main

                 main::RUNTIME




     main::add           main::CORE:print                     main::square




                                 main::multiply




                       Uwe Voelker    Graphic Visualization
About
                          GD and GD::Graph
                                               Examples
                              Chart::Clicker
                                               Hints
                                  GraphViz
                                               GraphViz + Devel::NYTProf
                                       SVG
                                               GraphViz.pm


GraphViz.pm

  use G r a p h V i z ;

  my $g = GraphViz−>new ( ) ;

  $g−>a d d n o d e ( ’ London ’ ) ;
  $g−>a d d n o d e ( ’ P a r i s ’ , l a b e l => ’ C i t y o f  n l u r v e ’ ) ;
  $g−>a d d n o d e ( ’New York ’ ) ;

  $g−>a d d e d g e ( ’ London ’ => ’ P a r i s ’ ) ;
  $g−>a d d e d g e ( ’ London ’ => ’New York ’ , l a b e l => ’ F a r ’
  $g−>a d d e d g e ( ’ P a r i s ’ => ’ London ’ ) ;

  $g−>a s p n g ( ’ o u t . png ’ ) ;

                                Uwe Voelker    Graphic Visualization
About
                GD and GD::Graph
                                     Examples
                    Chart::Clicker
                                     Hints
                        GraphViz
                                     GraphViz + Devel::NYTProf
                             SVG
                                     GraphViz.pm


GraphzViz.pm


      London


                             Far


      City of
                                     New York
      lurve

                      Uwe Voelker    Graphic Visualization
About
                    GD and GD::Graph
                                         Examples
                        Chart::Clicker
                                         Hints
                            GraphViz
                                         GraphViz + Devel::NYTProf
                                 SVG
                                         GraphViz.pm


GraphViz.pm




     a little bit outdated (no big changes since 5 years)
     some parameters incomplete (rankdir)
     some output formats missing (PDF, EPS)




                          Uwe Voelker    Graphic Visualization
About
                    GD and GD::Graph
                                         Examples
                        Chart::Clicker
                                         Hints
                            GraphViz
                                         GraphViz + Devel::NYTProf
                                 SVG
                                         GraphViz.pm


GraphViz.pm




     a little bit outdated (no big changes since 5 years)
     some parameters incomplete (rankdir)
     some output formats missing (PDF, EPS)
     Anyone interested in improving?




                          Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
                          Chart::Clicker   Examples
                              GraphViz     Rasterizer
                                   SVG     BatikServer


About




        Scalable Vector Graphics
        XML dialect
        http://www.w3.org/TR/SVG/




                            Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
                        Chart::Clicker   Examples
                            GraphViz     Rasterizer
                                 SVG     BatikServer


Examples




     http://www.mein-kreditmanager.de/
     supplier of business informations (solvency)
     SVG is generated with Template::Toolkit
     rasterized on server side to PNG




                          Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
               Chart::Clicker   Examples
                   GraphViz     Rasterizer
                        SVG     BatikServer


Examples




                 Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
               Chart::Clicker   Examples
                   GraphViz     Rasterizer
                        SVG     BatikServer


Examples




                 Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
               Chart::Clicker   Examples
                   GraphViz     Rasterizer
                        SVG     BatikServer


Examples




                 Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
                      Chart::Clicker   Examples
                          GraphViz     Rasterizer
                               SVG     BatikServer


Rasterizer




        Batik http://xmlgraphics.apache.org/batik/
     Inkscape http://www.inkscape.org/
              http://wiki.inkscape.org/wiki/index.php/
              CompilingStatic
  ImageMagick http://www.imagemagick.org/ (convert)




                        Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
                        Chart::Clicker   Examples
                            GraphViz     Rasterizer
                                 SVG     BatikServer


BatikServer




      Batik rasterizer as deamon
      handelsauskunft.com uses patched 0.3.1
      https://code.gocept.com/svn/websvn/listing.php?
      repname=gocept&path=/BatikServer/trunk/




                          Uwe Voelker    Graphic Visualization
GD and GD::Graph     About
                 Chart::Clicker   Examples
                     GraphViz     Rasterizer
                          SVG     BatikServer


Questions?




                   Uwe Voelker    Graphic Visualization

Contenu connexe

Dernier

Dernier (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Graphic visualization

  • 1. GD and GD::Graph Chart::Clicker GraphViz SVG Graphic Visualization There is a Life after GD and GD::Graph Uwe Voelker XING AG August 5th 2010 Uwe Voelker Graphic Visualization
  • 2. GD and GD::Graph History Chart::Clicker Examples GraphViz Code SVG History 1990 ImageMagick 1994 gdlib 1996 GD 1997 GD::Graph 1997 Image::Magick 2003 Book “Grafiken mit Perl” (GD, ImageMagick, Gimp) Uwe Voelker Graphic Visualization
  • 3. GD and GD::Graph History Chart::Clicker Examples GraphViz Code SVG Examples Uwe Voelker Graphic Visualization
  • 4. GD and GD::Graph History Chart::Clicker Examples GraphViz Code SVG Examples Uwe Voelker Graphic Visualization
  • 5. GD and GD::Graph History Chart::Clicker Examples GraphViz Code SVG Code use GD : : Graph : : b a r s ; use GD : : Graph : : Data ; my $ d a t a = GD : : Graph : : Data−>new ( [ [ qw/1 s t 2 nd 3 r d 4 t h 5 t h 6 t h 7 t h 8 t h 9 t h / ] , [ 1 , 2 , 5 , 6 , 3 , 1.5 , 1 , 3 , 4] , ] ) o r d i e GD : : Graph : : Data−>e r r o r ; my $ g r a p h = GD : : Graph : : b a r s −>new ; # 400 x 300 $graph−>s e t ( b a r s p a c i n g => 8 , s h a d o w d e p t h => 4 , shadowclr => ’ d r e d ’ , t r a n s p a r e n t => 0 , ) o r warn $graph−>e r r o r ; Uwe Voelker Graphic Visualization
  • 6. GD and GD::Graph History Chart::Clicker Examples GraphViz Code SVG Code $graph−>p l o t ( $ d a t a ) o r d i e $graph−>e r r o r ; open (OUT, ”>b a l k e n . png ” ) o r d i e $ ! ; binmode OUT; p r i n t OUT $graph−>gd−>png ; c l o s e OUT; Uwe Voelker Graphic Visualization
  • 7. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG About started 2006 current version 2.65, July 2010 http://github.com/gphat/chart-clicker/ http://www.onemogin.com/clicker/ Uwe Voelker Graphic Visualization
  • 8. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Examples 5 3 1 2 4 6 8 10 Series 0 Series 1 Series 2 Uwe Voelker Graphic Visualization
  • 9. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Examples 9 5 1 2 4 6 8 10 Series 0 Series 1 Series 2 Uwe Voelker Graphic Visualization
  • 10. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Examples 5 3 1 2 4 6 8 10 Series 0 Series 1 Series 2 Uwe Voelker Graphic Visualization
  • 11. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Examples Series 0 Series 1 Series 2 Series 3 Uwe Voelker Graphic Visualization
  • 12. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Examples 5 3 1 2 4 6 8 10 Series 0 Series 1 Series 2 Uwe Voelker Graphic Visualization
  • 13. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Code use Chart : : C l i c k e r ; use Chart : : C l i c k e r : : Context ; use C h a r t : : C l i c k e r : : Data : : Dat aSe t ; use C h a r t : : C l i c k e r : : Data : : Marker ; use C h a r t : : C l i c k e r : : Data : : S e r i e s ; use C h a r t : : C l i c k e r : : R e n d e r e r : : Bar ; use Geometry : : P r i m i t i v e : : R e c t a n g l e ; use G r a p h i c s : : C o l o r : : RGB ; my $ c c = C h a r t : : C l i c k e r −>new ( w i d t h => 5 0 0 , h e i g h t => 2 5 0 , format => ’ p d f ’ , ); Uwe Voelker Graphic Visualization
  • 14. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Code my @hours = qw/1 2 3 4 5 6 7 8 9 10 11 1 2 / ; my $ s e r i e s 1 = C h a r t : : C l i c k e r : : Data : : S e r i e s −>new ( keys => @hours , v a l u e s => [ qw/ 5 . 8 5 . 0 4 . 9 4 . 8 4 . 5 4 . 2 5 3.5 2.9 2.5 1.8 .9 . 8 / ] ) ; my $ s e r i e s 2 = C h a r t : : C l i c k e r : : Data : : S e r i e s −>new ( keys => @hours , v a l u e s => [ qw/ . 7 1 . 1 1 . 7 2 . 5 3 . 0 4 . 5 5.0 4.9 4.7 4.8 4.2 4 . 4 / ] ) ; my $ s e r i e s 3 = C h a r t : : C l i c k e r : : Data : : S e r i e s −>new ( keys => @hours , v a l u e s => [ qw/ . 3 1 . 4 1 . 2 1 . 5 4 . 0 3 . 5 2.0 1.9 2.7 4.2 3.2 1 . 1 / ] ) ; Uwe Voelker Graphic Visualization
  • 15. GD and GD::Graph About Chart::Clicker Examples GraphViz Code SVG Code my $ d s = C h a r t : : C l i c k e r : : Data : : DataSet−>new ( s e r i e s => [ $ s e r i e s 1 , $ s e r i e s 2 , $ s e r i e s 3 ] ) ; $cc−>a d d t o d a t a s e t s ( $ d s ) ; my $ a r e a = C h a r t : : C l i c k e r : : R e n d e r e r : : Bar−>new ( o p a c i t y => . 6 ) ; $ a r e a −>b r u s h −>w i d t h ( 3 ) ; my $ d e f = $cc−>g e t c o n t e x t ( ’ d e f a u l t ’ ) ; $ d e f −>r e n d e r e r ( $ a r e a ) ; $ d e f −>r a n g e a x i s −>t i c k v a l u e s ( [ qw( 1 3 5 ) ] ) ; $ d e f −>r a n g e a x i s −>format ( ’%d ’ ) ; $ d e f −>d o m a i n a x i s −>t i c k v a l u e s ( [ qw( 2 4 6 8 1 0 ) ] ) ; $ d e f −>d o m a i n a x i s −>format ( ’%d ’ ) ; $ d e f −>d o m a i n a x i s −>f u d g e a m o u n t ( . 0 5 ) ; $cc−>w r i t e o u t p u t ( ’ b a r . p d f ’ ) ; Uwe Voelker Graphic Visualization
  • 16. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm About graph visualization software different renderers http://www.graphviz.org/ Uwe Voelker Graphic Visualization
  • 17. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples name 1 C-I institute name n 1 course S-I n code n S-C m student name grade number Uwe Voelker Graphic Visualization
  • 18. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples 0xf7fc4380 3.43322790286038071e-06 0xf7fc4380 44.79998779296875 0x10ba8 0xf7fc4380 0xf7fc4380 0 -1 2 0xf7fc44b8 (nil) 1 2 (nil) 2 (nil) -1 -1 -1 (nil) (nil) -1 0xf7fc43e0 -1 1 Uwe Voelker Graphic Visualization
  • 19. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples - simple dot file digraph test { London ; P a r i s [ l a b e l=” C i t y o f n l u r v e ” ] ; ”New York ” ; London −> ”New York ” [ l a b e l=” F a r ” ] ; London −> P a r i s ; P a r i s −> London ; } Uwe Voelker Graphic Visualization
  • 20. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples - image map d i g r a p h mainmap { input [ URL=”N” , i d=”N” ] ; command [ URL=” N” , i d=”N” ] ; o u t p u t [ URL=”N” , i d=”N” ] ; i n p u t −> command −> o u t p u t ; } Uwe Voelker Graphic Visualization
  • 21. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples - image map my $ f i l e = $ARGV [ 1 ] | | ’ x . dot ’ ; # generate f i l e s ‘ d o t −Tcmapx np −o o u t . map −T g i f −o o u t . g i f $ f i l e ‘ ; # r e a d image map my @map = r e a d f i l e ( ’ o u t . map ’ ) ; my %node = ( ) ; f o r e a c h ( r e a d f i l e ( ’ o u t . map ’ ) ) { i f (/< a r e a .+ i d=” ( [ ˆ ” ]+) ” .+ c o o r d s=” ( [ ˆ ” ]+) ” / ) { $node { $1 } = [ s p l i t / , / , $2 ] ; } } Uwe Voelker Graphic Visualization
  • 22. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples - image map my $app = sub { my $ r e q = P l a c k : : Request −>new ( s h i f t ) ; my $x = $req −>param ( ’ image . x ’ ) | | 0 ; my $y = $req −>param ( ’ image . y ’ ) | | 0 ; my $message = ’ ’ ; f o r e a c h my $ i d ( keys %node ) { my @c = @{ $node { $ i d } } ; i f ( $x >= $c [ 0 ] and $x <= $c [ 2 ] and $y >= $c [ 1 ] and $y <= $c [ 3 ] ) { $message = ” H i t $ i d . ” ; last ; } } Uwe Voelker Graphic Visualization
  • 23. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Examples - image map my $ r e s = $req −>n e w r e s p o n s e ( 2 0 0 ) ; $ r e s −>c o n t e n t t y p e ( ’ t e x t / html ’ ) ; $ r e s −>body ( ’<html><body><form> ’ . ’<i n p u t t y p e=”image ” name=”image ” s r c =”o u t . g i f ”> ’ . ’</form><p> ’ . $message . ’</p></body></html> ’ ) ; r e t u r n $ r e s −> f i n a l i z e ; }; builder { e n a b l e ’ S t a t i c ’ , p a t h => q r / o u t . ( g i f | map ) / ; $app ; }; Uwe Voelker Graphic Visualization
  • 24. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Hints - different renderer dot hierarchical graphs, short edges, no crossings neato “spring model”, compact graphs twopi radial graphs, concentric circles circo circular layout, for cyclic structures Uwe Voelker Graphic Visualization
  • 25. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Hints - output dot -Tpdf input.dot > output.pdf Uwe Voelker Graphic Visualization
  • 26. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Hints - output dot -Tpdf input.dot > output.pdf smaller margins dot -Teps input.dot > output.eps epstopdf output.eps Uwe Voelker Graphic Visualization
  • 27. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm Hints - layout use rank and randir use invisible cluster to group nodes reverse arrows read the manual and FAQ Uwe Voelker Graphic Visualization
  • 28. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm GraphViz + Devel::NYTProf sub add { $sum += $ f o r e a c h ( @ ) ; r e t u r n $sum ; } sub m u l t i p l y { my $ p r o d u c t = 1 ; $ p r o d u c t ∗= $ f o r e a c h ( @ ) ; return $product ; } sub s q u a r e { m u l t i p l y ( $ [ 0 ] , $ [ 0 ] ) } p r i n t m u l t i p l y ( s q u a r e ( 2 ) , add ( 1 , 3 ) ) ; Uwe Voelker Graphic Visualization
  • 29. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm GraphViz + Devel::NYTProf main main::RUNTIME main::add main::CORE:print main::square main::multiply Uwe Voelker Graphic Visualization
  • 30. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm GraphViz.pm use G r a p h V i z ; my $g = GraphViz−>new ( ) ; $g−>a d d n o d e ( ’ London ’ ) ; $g−>a d d n o d e ( ’ P a r i s ’ , l a b e l => ’ C i t y o f n l u r v e ’ ) ; $g−>a d d n o d e ( ’New York ’ ) ; $g−>a d d e d g e ( ’ London ’ => ’ P a r i s ’ ) ; $g−>a d d e d g e ( ’ London ’ => ’New York ’ , l a b e l => ’ F a r ’ $g−>a d d e d g e ( ’ P a r i s ’ => ’ London ’ ) ; $g−>a s p n g ( ’ o u t . png ’ ) ; Uwe Voelker Graphic Visualization
  • 31. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm GraphzViz.pm London Far City of New York lurve Uwe Voelker Graphic Visualization
  • 32. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm GraphViz.pm a little bit outdated (no big changes since 5 years) some parameters incomplete (rankdir) some output formats missing (PDF, EPS) Uwe Voelker Graphic Visualization
  • 33. About GD and GD::Graph Examples Chart::Clicker Hints GraphViz GraphViz + Devel::NYTProf SVG GraphViz.pm GraphViz.pm a little bit outdated (no big changes since 5 years) some parameters incomplete (rankdir) some output formats missing (PDF, EPS) Anyone interested in improving? Uwe Voelker Graphic Visualization
  • 34. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer About Scalable Vector Graphics XML dialect http://www.w3.org/TR/SVG/ Uwe Voelker Graphic Visualization
  • 35. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer Examples http://www.mein-kreditmanager.de/ supplier of business informations (solvency) SVG is generated with Template::Toolkit rasterized on server side to PNG Uwe Voelker Graphic Visualization
  • 36. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer Examples Uwe Voelker Graphic Visualization
  • 37. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer Examples Uwe Voelker Graphic Visualization
  • 38. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer Examples Uwe Voelker Graphic Visualization
  • 39. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer Rasterizer Batik http://xmlgraphics.apache.org/batik/ Inkscape http://www.inkscape.org/ http://wiki.inkscape.org/wiki/index.php/ CompilingStatic ImageMagick http://www.imagemagick.org/ (convert) Uwe Voelker Graphic Visualization
  • 40. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer BatikServer Batik rasterizer as deamon handelsauskunft.com uses patched 0.3.1 https://code.gocept.com/svn/websvn/listing.php? repname=gocept&path=/BatikServer/trunk/ Uwe Voelker Graphic Visualization
  • 41. GD and GD::Graph About Chart::Clicker Examples GraphViz Rasterizer SVG BatikServer Questions? Uwe Voelker Graphic Visualization