Graph Test: Difference between revisions
From wikiluntti
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<graph> | |||
{{Graph:Chart|width=600|height=100|xAxisTitle=X|yAxisTitle=Y | {{Graph:Chart|width=600|height=100|xAxisTitle=X|yAxisTitle=Y | ||
|type=rect|x=1,2,3,4,5,6,7,8|y=10,12,6,14,2,10,7,9}} | |type=rect|x=1,2,3,4,5,6,7,8|y=10,12,6,14,2,10,7,9}} | ||
</graph> | |||
{{Graph:Chart|width=100|height=100|type=pie|legend=Legende | {{Graph:Chart|width=100|height=100|type=pie|legend=Legende | ||
Line 21: | Line 23: | ||
"name": "tree", | "name": "tree", | ||
"values": [ | "values": [ | ||
{"A": " | {"A": "Luukalat","B": "Viuhkaeväiset","C": "Neopterygii", "D": "Lohikalat", "E": "Lohet" }, | ||
{"A": " | {"A": "Luukalat","B": "Viuhkaeväiset","C": "Lion" }, | ||
{"A": " | {"A": "Luukalat","B": "Viuhkaeväiset","C": "Cow" }, | ||
{"A": " | {"A": "Luukalat","B": "Herbivore","C": "Goat" }, | ||
{"A": " | {"A": "Luukalat","B": "Omnivore","C": "Human"}, | ||
{"A": " | {"A": "Luukalat","B": "Omnivore","C": "Bat"}, | ||
{"A": "Fish","B": "Carnivore","C": "Shark"}, | {"A": "Fish","B": "Carnivore","C": "Shark"}, | ||
{"A": "Fish","B": "Carnivore","C": "Electric Eel"}, | {"A": "Fish","B": "Carnivore","C": "Electric Eel"}, | ||
Line 88: | Line 90: | ||
"type": "formula", | "type": "formula", | ||
"field": "ff_node_label", | "field": "ff_node_label", | ||
"expr": "if(datum.layout_depth == 0, ' | "expr": "if(datum.layout_depth == 0, 'Selkärankaiset', if(datum.layout_depth == 1, datum.A, if(datum.layout_depth == 2, datum.B, if(datum.layout_depth == 3, datum.C, ''))))" | ||
} | } | ||
] | ] |
Revision as of 21:51, 13 June 2021
<graph> Template:Graph:Chart </graph>
<graph> {
"width": 600, "height": 150, "background": "#ffffff", "data": [ { "name": "tree", "values": [ {"A": "Luukalat","B": "Viuhkaeväiset","C": "Neopterygii", "D": "Lohikalat", "E": "Lohet" }, {"A": "Luukalat","B": "Viuhkaeväiset","C": "Lion" }, {"A": "Luukalat","B": "Viuhkaeväiset","C": "Cow" }, {"A": "Luukalat","B": "Herbivore","C": "Goat" }, {"A": "Luukalat","B": "Omnivore","C": "Human"}, {"A": "Luukalat","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": [20,100] }, { "type": "formula", "field": "align", "expr": "'right'" }, { "type": "formula", "field": "offset", "expr": "-10" } ] } ], "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"}, "strokeWidth": {"value": 2}, "stroke": {"value": "#000000"} } } }, { "type": "text", "from": { "data": "tree", "transform": [ { "type": "formula", "field": "ff_node_label", "expr": "if(datum.layout_depth == 0, 'Selkärankaiset', 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"}, "dy": {"value": -8}, "font": {"value": "Arial"}, "fontSize": {"value": 16}, "align": {"field": "align"}, "baseline": {"value": "middle"}, "fill": {"value": "#0000ff"}, "text": {"field": "ff_node_label"} } } } ]
}
</graph>