Drawing graphs with PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TheDD

    #1

    Drawing graphs with PHP

    Hi all,

    i have a question:

    is there any librairy for drawing graphs with PHP? Not graphs like
    histogram or alike, but like a set of shapes linked together in a certain
    way (like a flow chart or call graph).

    I have found a script to handle the graph in memory but i can already do
    that, my problem is to draw it (it an optimal way, and without crossing
    links if possible).

    Thx
    --
    TheDD
  • Ian.H

    #2
    Re: Drawing graphs with PHP

    On Sun, 09 Nov 2003 10:49:52 +0100, TheDD wrote:
    [color=blue]
    > Hi all,
    >
    > i have a question:
    >
    > is there any librairy for drawing graphs with PHP? Not graphs like
    > histogram or alike, but like a set of shapes linked together in a certain
    > way (like a flow chart or call graph).
    >
    > I have found a script to handle the graph in memory but i can already do
    > that, my problem is to draw it (it an optimal way, and without crossing
    > links if possible).
    >
    > Thx[/color]


    Not 100% sure if it covers your req's.. but have a google for 'JPGraph'.
    This might be just what you're looking for =)


    HTH.



    Regards,

    Ian

    --
    Ian.H [Design & Development]
    digiServ Network - Web solutions
    www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
    Programming, Web design, development & hosting.

    Comment

    • Andy Hassall

      #3
      Re: Drawing graphs with PHP

      On Sun, 9 Nov 2003 10:49:52 +0100, TheDD <pas.d@email.co m> wrote:
      [color=blue]
      >i have a question:
      >
      >is there any librairy for drawing graphs with PHP? Not graphs like
      >histogram or alike, but like a set of shapes linked together in a certain
      >way (like a flow chart or call graph).
      >
      >I have found a script to handle the graph in memory but i can already do
      >that, my problem is to draw it (it an optimal way, and without crossing
      >links if possible).[/color]

      The most popular free directed graph drawing library is the 'dot' program from
      the Graphviz library:

      http://www.research.att.com/sw/tools/graphviz/

      It does a decent enough job for small-ish graphs (<50 nodes), can output in
      various formats, including HTML image maps so you can make the nodes clickable.

      Basically you'll have to output a file in the simple format that dot
      understands describing the graph, and use system() or backticks `` to call dot
      to render that to a file.

      Doesn't guarantee optimal layout or zero crossing edges; it uses heuristics to
      get a generally reasonable layout.

      There are commercial packages that do a better job but they're mostly
      incredibly expensive. The Graph Layout Toolkit from Tom Sawyer Software looked
      impressive, but the quote they called back with had quite a few zeroes ;-)

      --
      Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
      Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

      Comment

      • TheDD

        #4
        Re: Drawing graphs with PHP

        On Sun, 09 Nov 2003 09:55:15 GMT, Ian.H wrote:[color=blue]
        > On Sun, 09 Nov 2003 10:49:52 +0100, TheDD wrote:[/color]
        [color=blue][color=green]
        >> [...][/color][/color]
        [color=blue]
        > Not 100% sure if it covers your req's.. but have a google for 'JPGraph'.
        > This might be just what you're looking for =)[/color]
        [color=blue]
        > HTH.[/color]
        [color=blue]
        > Regards,[/color]

        No, it's for histogram graphs and similar :(

        Thx anyway
        --
        TheDD

        Comment

        • TheDD

          #5
          Re: Drawing graphs with PHP

          On Sun, 09 Nov 2003 14:10:39 +0000, Andy Hassall wrote:[color=blue]
          > On Sun, 9 Nov 2003 10:49:52 +0100, TheDD <pas.d@email.co m> wrote:[/color]
          [color=blue][color=green]
          >> [...][/color][/color]
          [color=blue]
          > The most popular free directed graph drawing library is the 'dot' program from
          > the Graphviz library:[/color]
          [color=blue]
          > http://www.research.att.com/sw/tools/graphviz/[/color]
          [color=blue]
          > It does a decent enough job for small-ish graphs (<50 nodes), can output in
          > various formats, including HTML image maps so you can make the nodes clickable.[/color]
          [color=blue]
          > Basically you'll have to output a file in the simple format that dot
          > understands describing the graph, and use system() or backticks `` to call dot
          > to render that to a file.[/color]

          I thought about this, but i was hopping for something "better integrated".
          I will look how this can be done (html map § png image, html, or just
          getting the coordinates and drawing myself).
          [color=blue]
          > Doesn't guarantee optimal layout or zero crossing edges; it uses heuristics to
          > get a generally reasonable layout.[/color]
          [color=blue]
          > There are commercial packages that do a better job but they're mostly
          > incredibly expensive. The Graph Layout Toolkit from Tom Sawyer Software looked
          > impressive, but the quote they called back with had quite a few zeroes ;-)[/color]

          Yeah, i can imagine ;)

          Thx
          --
          TheDD http://www.epita.fr/~mancel_d
          Ing2 Groupe B2
          EPITA Promotion 2005

          Comment

          • Andy Hassall

            #6
            Re: Drawing graphs with PHP

            On Tue, 11 Nov 2003 10:49:38 +0100, TheDD <mancel_d@epita .fr> wrote:
            [color=blue]
            >On Sun, 09 Nov 2003 14:10:39 +0000, Andy Hassall wrote:[color=green]
            >> On Sun, 9 Nov 2003 10:49:52 +0100, TheDD <pas.d@email.co m> wrote:[/color]
            >[color=green][color=darkred]
            >>> [...][/color][/color]
            >[color=green]
            >> The most popular free directed graph drawing library is the 'dot' program from
            >> the Graphviz library:[/color]
            >[color=green]
            >> http://www.research.att.com/sw/tools/graphviz/[/color]
            >[color=green]
            >> It does a decent enough job for small-ish graphs (<50 nodes), can output in
            >> various formats, including HTML image maps so you can make the nodes clickable.[/color]
            >[color=green]
            >> Basically you'll have to output a file in the simple format that dot
            >> understands describing the graph, and use system() or backticks `` to call dot
            >> to render that to a file.[/color]
            >
            >I thought about this, but i was hopping for something "better integrated".
            >I will look how this can be done (html map § png image, html, or just
            >getting the coordinates and drawing myself).[/color]

            Haven't tried it personally, but a quick search came up with the following PHP
            class for wrapping up Graphviz:



            Probably worth a look.

            --
            Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
            Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

            Comment

            • david

              #7
              Re: Drawing graphs with PHP

              Andy Hassall wrote:
              [color=blue][color=green][color=darkred]
              >>>>[...][/color][/color][/color]
              [color=blue]
              > Haven't tried it personally, but a quick search came up with the following PHP
              > class for wrapping up Graphviz:
              >
              > http://pear.php.net/package/Image_GraphViz
              >
              > Probably worth a look.[/color]

              Yes, it will prevent me from writing some code, but not a hard part. It's still
              not integrated since i need to save a dot file (through the lib), proccess
              through graphviz, and then use the output :/

              Thx anyway :) i will work on this again in one week.

              NB: i must be a bad searcher ;)

              --
              TheDD

              Comment

              Working...