aswi2021codebakers-gitlab/src/vega-analyze/testvega.js @ 9fa751ff
1 | 9fa751ff | Štěpán Červenka | var view; |
---|---|---|---|
2 | |||
3 | fetch('piechart.json') |
||
4 | .then(res => res.json()) |
||
5 | .then(spec => render(spec)) |
||
6 | .catch(err => console.error(err)); |
||
7 | |||
8 | function render(spec) { |
||
9 | view = new vega.View(vega.parse(spec), { |
||
10 | renderer: 'canvas', // renderer (canvas or svg) |
||
11 | container: '#view', // parent DOM container |
||
12 | hover: true // enable hover processing |
||
13 | });
|
||
14 | |||
15 | return view.runAsync(); |
||
16 | }
|
||
17 | |||
18 |