Difference between revisions of "Template:Graph:Piechart"
Jump to navigation
Jump to search
(Blanked the page) Tag: Blanking |
|||
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> |