Projekt

Obecné

Profil

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

    
7
  "data": [
8
    {
9
      "name": "table",
10
      "url": "data_big.json",
11
      "transform": [
12
        {
13
          "type": "formula",
14
          "expr": "toDate(datum[\"time\"])",
15
          "as": "dateTime"
16
        },
17
        {
18
          "type": "timeunit",
19
          "field": "dateTime",
20
          "units": ["year","month", "date", "hours"]
21
        }
22
      ]
23
    },
24
    {
25
      "name": "table2",
26
      "source": "table",
27
      "transform":[
28
        {
29
          "type": "lookup",
30
          "from": "table",
31
          "key": "unit0",
32
          "fields": ["unit1"],
33
          "as": ["obj"]
34
        }
35
      ]
36
    }
37
  ],
38

    
39
  "scales": [
40
    {
41
      "name": "xscale",
42
      "type": "time",
43
      "domain": {"data": "table", "fields": ["unit0", "unit1"]},
44
      "range": "width"
45
    },
46
    {
47
      "name": "yscale",
48
      "type": "linear",
49
      "domain": {"data": "table", "field": "value"},
50
      "nice": true,
51
      "range": "height"
52
    }
53
  ],
54

    
55
  "axes": [
56
    { "orient": "bottom", "scale": "xscale" },
57
    { "orient": "left", "scale": "yscale" }
58
  ],
59

    
60
  "marks": [
61
    {
62
      "type": "symbol",
63
      "from": {"data":"table"},
64
      "encode": {
65
        "enter": {
66
          "shape": {"value": "circle"},
67
          "size": {"value": 10},
68
          "x": {"scale": "xscale", "field": "dateTime"},
69
          "y": {"scale": "yscale", "field": "value"},
70
          "color": {"value": "both"},
71
          "strokeWidth": {"value": 4}
72
        }
73
      }
74
    },
75
    {
76
      "type": "rule",
77
      "from": {"data":"table2"},
78
      "encode": {
79
        "enter": {
80
          "x": {"scale": "xscale", "field": "unit0"},
81
          "x2":[
82
            {
83
              "test": "isValid(datum.obj)",
84
              "scale" : "xscale",
85
              "field" : "obj.unit0"
86
            },
87
            {
88
              "scale" : "xscale",
89
              "field" : "unit0"
90
            }
91
          ],
92
          "y": {"scale": "yscale", "field": "value"},
93
          "y2":[
94
            {
95
              "test": "isValid(datum.obj)",
96
              "scale" : "yscale",
97
              "field" : "obj.value"
98
            },
99
            {
100
              "scale" : "yscale",
101
              "field" : "value"
102
            }
103
          ]
104

    
105

    
106

    
107
        },
108
        "update": {
109
          "stroke": {"value": "steelblue"},
110
          "strokeWidth": {"value": 1}
111
        },
112
        "hover": {
113
          "stroke": {"value": "red"},
114
          "strokeWidth": {"value": 3}
115
        }
116
      }
117
    }
118
  ]
119

    
120
}
(7-7/10)