Template:Graph:MaterialPie

From Wikiwaste
Revision as of 12:00, 11 December 2019 by Admin (talk | contribs) (created graph template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

{

   "version": 2,
   "width": 100,
   "height": 100,
   "data": [
     {
       "name": "table",
       "values": [
           {"name":"AFF","value":10},
           {"name":"MQ","value":10},
           {"name":"Ind","value":10},
           {"name":"Com","value":10},
           {"name":"HH","value":10}
           ],
       "transform": [{"type": "pie","field": "value"}]
     }
   ],
   "scales": [
     {
       "name": "r",
       "type":"sqrt",
       "domain": {"data": "table","field": "value"},
       "range": [20,100]
     },
     {
         "name":"color",
         "type":"ordinal",
         "domain":{"data":"table","field":"name"},
         "range":"category10"
     }
   ],
   "marks": [
     {
       "type": "arc",
       "from": {"data": "table"},
       "properties": {
         "enter": {
           "x": {"field": {"group": "width"},"mult": 0.5},
           "y": {"field": {"group": "height"},"mult": 0.5},
           "startAngle": {"field": "layout_start"},
           "endAngle": {"field": "layout_end"},
           "innerRadius": {"value": 20},
           "outerRadius": {"scale": "r","field": "value"},
           "stroke": {"value": "#fff"},
           "fill":{"scale":"color","field":"name"}
         }
       }
     },
     {
       "type": "text",
       "from": {"data": "table"},
       "properties": {
         "enter": {
           "x": {"field": {"group": "width"},"mult": 0.5},
           "y": {"field": {"group": "height"},"mult": 0.5},
           "radius": {"scale": "r","field": "value","offset": 8},
           "theta": {"field": "layout_mid"},
           "fill": {"value": "#000"},
           "align": {"value": "center"},
           "baseline": {"value": "middle"},
           "text": {"field": "name"}
         }
       }
     }
   ],
   "legends":[{
   	"fill":"color",
   	"title":"",
   	"offset": 75,
   	"properties":{
   		"symbols":{
   			"strokeWidth":{"value":0},
   			"shape":{"value":"square"}
   		}
   	}
   }]
 }