Difference between revisions of "Template:Graph:Piechart"
Jump to navigation
Jump to search
(Mukund-pondkule-6a11@uni-paderborn.de moved page Template to Template:ColourScheme6) Tag: New redirect |
(Removed redirect to Template:ColourScheme6) Tag: Removed redirect |
||
Line 1: | Line 1: | ||
− | # | + | <includeonly>{{#tag:graph| { |
+ | "version": 2, | ||
+ | "height": {{{radius|100}}}, | ||
+ | "width": {{{radius|100}}}, | ||
+ | {{#ifeq: {{{legend|}}} | - | | ||
+ | | "legends": [{"title": "{{{legend|Legend}}}","fill": "color"}], }} | ||
+ | "padding": "auto", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "innerRadius": {"value": {{{innerradius|0}}} }, | ||
+ | "stroke": {"value": "white"}, | ||
+ | "startAngle": {"field": "layout_start"}, | ||
+ | "outerRadius": {"value": {{{radius|100}}} }, | ||
+ | "endAngle": {"field": "layout_end"}, | ||
+ | "fill": {"field": "x","scale": "color"}, | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [{"field": "y","type": "pie"}] | ||
+ | }, | ||
+ | "type": "arc" | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", "values": {{{values| [ | ||
+ | {"x": "peaches","y": 100}, | ||
+ | {"x": "plums","y": 32}, | ||
+ | {"x": "blueberries","y": 180}, | ||
+ | {"x": "strawberries","y": 46}, | ||
+ | {"x": "bananas","y": 21} | ||
+ | ] }}} | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "color", | ||
+ | "range": {{{rangeliteral|"category10"}}}, | ||
+ | "domain": {"data": "table","field": "x"}, | ||
+ | "type": "ordinal" | ||
+ | } | ||
+ | ] | ||
+ | } }}</includeonly> |