Benutzer:Antonsusi/Graph

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Demo[Bearbeiten | Quelltext bearbeiten]

<graph>

{
  "width": 500,
  "height": 50,
  "data": [
    {
      "name": "tree",
      "values": [
        {"A": "Mammal","B": "Herbivore","C": "Cow" },
        {"A": "Mammal","B": "Herbivore","C": "Goat" },
        {"A": "Mammal","B": "Omnivore","C": "Human"},
        {"A": "Mammal","B": "Omnivore","C": "Bat"},
        {"A": "Fish","B": "Carnivore","C": "Shark"},
        {"A": "Fish","B": "Carnivore","C": "Electric Eel"},
        {"A": "Fish","B": "Omnivore","C": "Piranha "},
        {"A": "Fish","B": "Omnivore","C": "catfish "}
      ],
      "transform": [
        {"type": "treeify","groupby": ["A","B"]},
        {
          "type": "hierarchy",
          "mode": "cluster",
          "nodesize": [11,200]
        },
        {
          "type": "formula",
          "field": "align",
          "expr": "datum.children ? 'right' : 'left'"
        },
        {
          "type": "formula",
          "field": "offset",
          "expr": "datum.children ? -5 : 5"
        }
      ]
    }
  ],
  "marks": [
    {
      "type": "path",
      "from": {
        "data": "tree",
        "transform": [
          {"type": "filter","test": "datum.parent"},
          {
            "type": "linkpath",
            "sourceX": "parent.layout_y",
            "sourceY": "parent.layout_x",
            "targetX": "layout_y",
            "targetY": "layout_x",
            "shape": "cornerX"
          }
        ]
      },
      "properties": {
        "enter": {
          "path": {"field": "layout_path"},
          "stroke": {"value": "#ddd"}
        }
      }
    },
    {
      "type": "text",
      "from": {
        "data": "tree",
        "transform": [
          {
            "type": "formula",
            "field": "ff_node_label",
            "expr": "if(datum.layout_depth == 0, 'Animals', if(datum.layout_depth == 1, datum.A, if(datum.layout_depth == 2, datum.B, if(datum.layout_depth == 3, datum.C, ''))))"
          }
        ]
      },
      "properties": {
        "enter": {
          "x": {"field": "layout_y"},
          "dx": {"field": "offset"},
          "y": {"field": "layout_x"},
          "font": {"value": "Helvetica Neue"},
          "fontSize": {"value": 10},
          "align": {"field": "align"},
          "baseline": {"value": "middle"},
          "fill": {"value": "#000"},
          "text": {"field": "ff_node_label"}
        }
      }
    }
  ]
}

</graph>

Ergibt:

Die Darstellung von Grafiken ist aktuell auf Grund eines Sicherheitsproblems deaktiviert.


Test[Bearbeiten | Quelltext bearbeiten]

Test 1[Bearbeiten | Quelltext bearbeiten]

Die Darstellung von Grafiken ist aktuell auf Grund eines Sicherheitsproblems deaktiviert.

Test 2[Bearbeiten | Quelltext bearbeiten]

Die Darstellung von Grafiken ist aktuell auf Grund eines Sicherheitsproblems deaktiviert.

Test 3[Bearbeiten | Quelltext bearbeiten]

Die Darstellung von Grafiken ist aktuell auf Grund eines Sicherheitsproblems deaktiviert.