Difference between revisions of "Wgraph:Example 2"

From FollowTheScore
Jump to: navigation, search
Line 1: Line 1:
== sample graphs for mediawiki parser extension 'wgraph' ==
+
== A second example ==
  
This script generates a demo graph. The graph reflects articles (about [[:Category:Painter|painters]]) and their interrelationships.
 
If you click the thumb image you will get the SVG file in which nodes contain clickable links to wiki articles.
 
  
{{#dpl:category=Painter|columns=4}}
+
{|class=wikitable
{{#wgraph: thumb=50 | svg |
+
!with manhattan edges,<br>top down orientation
  display_edge_labels = yes
+
!with splines<br>left to right orientation
  splines=yes
+
|-
  {{#dpl:
+
|
  |category = Painter
+
{{#wgraph: thumb=50 | svg | png |
  |include={Wgraph node}.dpl
+
node Picasso        { }
  |addcategories = true
+
edge Signac Picasso { }
  |mode=userformat
+
node Gauguin        { type Painter;Poet }
  |listseparators=\n,\nnode "%TITLE%" { label="%TITLE%" url="%PAGE%" type="%CATNAMES%" ,} ,
+
node Henri_Matisse  { url Henri_Matisse }
   |noresultsheader=// no 'Painter' nodes
+
node Signac        { type Painter scaling 2 bordercolor blue}
   }}
+
 
  {{#dpl:
+
edge Gauguin "Henri Matisse" {
  |uses = Template:is friend of
+
                      type friend;roommate}
  |include={Is friend of}.dpl
+
edge from Gauguin to Signac {
  |mode=userformat
+
                      type friend
  |listseparators=,\nedge {,} ,\n
+
                      label "good friend"}
  |multisecseparators=}\nedge {,
+
edge from Signac to Henri_Matisse {}
  |noresultsheader=// no 'is friend of' relations
+
nodetype Poet      { color=green shape=ellipse }
  }}
+
nodetype Painter   { color yellow }
  {{#dpl:
+
edgetype roommate   { color gold }
  |namespace=Category
+
edgetype friend    { color #ff33aa fontname:HelvO10 }
  |uses = Template:wgraph nodetype
+
orientation top_to_bottom 
  |include = {Wgraph nodetype}.dpl
+
splines = yes
  |mode=userformat
+
}}
  |listseparators=\n,\nnodetype "%TITLE%" { ,} ,
+
|
  |noresultsheader=// no nodetypes
+
{{#wgraph: thumb=50 | wgl |
  }}
+
node Picasso        { }
  {{#dpl:
+
edge Signac Picasso { }
  |namespace=Template
+
node Gauguin        { type Painter;Poet }
  |uses = Template:wgraph edgetype
+
node Henri_Matisse  { url Henri_Matisse }
   |include = {Wgraph edgetype}.dpl
+
node Signac        { type Painter scaling 2 bordercolor blue}
  |mode=userformat
+
 
  |listseparators=\n,\nedgetype "%TITLE%" {,} ,
+
edge Gauguin "Henri Matisse" {
  |noresultsheader=// no edgetypes
+
                      type friend;roommate}
  }}
+
edge from Gauguin to Signac {
 +
                      type friend
 +
                      label "good friend"}
 +
edge from Signac to Henri_Matisse {}
 +
nodetype Poet      { color=green shape=ellipse }
 +
nodetype Painter   { color yellow }
 +
edgetype roommate  { color gold }
 +
edgetype friend    { color #ff33aa fontname:HelvO10 }
 +
orientation top_to_bottom 
 +
splines = yes
 
}}
 
}}
 +
|}
 +
 +
[[Category:Wgraph]]

Revision as of 11:05, 22 July 2007

A second example

with manhattan edges,
top down orientation
with splines
left to right orientation

{{#wgraph: thumb=50 | svg | png | node Picasso { } edge Signac Picasso { } node Gauguin { type Painter;Poet } node Henri_Matisse { url Henri_Matisse } node Signac { type Painter scaling 2 bordercolor blue}

edge Gauguin "Henri Matisse" {

                     type friend;roommate}

edge from Gauguin to Signac {

                     type friend 
                     label "good friend"}

edge from Signac to Henri_Matisse {} nodetype Poet { color=green shape=ellipse } nodetype Painter { color yellow } edgetype roommate { color gold } edgetype friend { color #ff33aa fontname:HelvO10 } orientation top_to_bottom splines = yes }}

{{#wgraph: thumb=50 | wgl | node Picasso { } edge Signac Picasso { } node Gauguin { type Painter;Poet } node Henri_Matisse { url Henri_Matisse } node Signac { type Painter scaling 2 bordercolor blue}

edge Gauguin "Henri Matisse" {

                     type friend;roommate}

edge from Gauguin to Signac {

                     type friend 
                     label "good friend"}

edge from Signac to Henri_Matisse {} nodetype Poet { color=green shape=ellipse } nodetype Painter { color yellow } edgetype roommate { color gold } edgetype friend { color #ff33aa fontname:HelvO10 } orientation top_to_bottom splines = yes }}