Projekt

Obecné

Profil

Stáhnout (1.72 KB) Statistiky
| Větev: | Tag: | Revize:
1
{
2
  "$schema": "https://vega.github.io/schema/vega/v5.json",
3
  "width": 400,
4
  "height": 200,
5
  "padding": 5,
6

    
7
  "data": [
8
    {
9
      "name": "table",
10
      "values": [
11
        {"category": "A", "amount": 28},
12
        {"category": "B", "amount": 55},
13
        {"category": "C", "amount": 43},
14
        {"category": "D", "amount": 91},
15
        {"category": "E", "amount": 81},
16
        {"category": "F", "amount": 53},
17
        {"category": "G", "amount": 19},
18
        {"category": "H", "amount": 87}
19
      ],
20
      "transform": [
21
        {
22
          "type": "pie",
23
          "field": "amount",
24
          "startAngle": 0,
25
          "endAngle": 6.29,
26
          "sort": false
27
        }
28
      ]
29
    }
30
  ],
31

    
32
  "scales": [
33
    {
34
      "name": "color",
35
      "type": "ordinal",
36
      "domain": {"data":  "table", "field": "category"},
37
      "range": {"scheme" : "dark2"}
38
    }
39
  ],
40

    
41
  "marks": [
42
    {
43
      "type": "arc",
44
      "from": {"data": "table"},
45
      "encode": {
46
        "enter": {
47
          "fill": {
48
            "scale": "color",
49
            "field": "category"
50
          },
51
          "x": {
52
            "signal": "width / 2"
53
          },
54
          "y": {
55
            "signal": "height / 2"
56
          },
57
          "startAngle": {
58
            "field": "startAngle"
59
          },
60
          "endAngle": {
61
            "field": "endAngle"
62
          },
63
          "outerRadius": {
64
            "signal": "width / 3"
65
          }
66
        },
67
        "update": {
68
          "stroke": {
69
            "value": "black"
70
          },
71
          "strokeWidth": {
72
            "value": 1
73
          }
74
        },
75
        "hover": {
76
          "stroke": {
77
            "value": "red"
78
          },
79
          "strokeWidth": {
80
            "value": 3
81
          }
82
        }
83
      }
84
    }
85
  ]
86
}
(4-4/6)