File tree 2 files changed +46
-1
lines changed
2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,42 @@ In your Idyll markup,
26
26
27
27
```
28
28
29
+ To use with a ` vega ` specification, set the mode to ` vega ` and do not pass the
30
+ data as a separate parameter:
31
+
32
+ ```
33
+ [IdyllVegaLite mode:"vega" spec:`{
34
+ ...
35
+ ...
36
+ }` /]
37
+ ```
38
+
29
39
See https://idyll-lang.github.io/examples/csv/ for example usage.
40
+
41
+
42
+ ## Troubleshooting
43
+
44
+ Depending on your environment, you may see errors when trying to compile an Idyll document
45
+ that depends on this library. In this case, you can compile using the ` compileLibs ` option
46
+ to apply all code transformations to the vega dependencies as well, which will make them
47
+ compatible with the rest of the build system:
48
+
49
+ ```
50
+ $ idyll --compileLibs
51
+ ```
52
+
53
+ or specify in ` package.json ` with:
54
+
55
+ ```
56
+ "idyll": {
57
+ "compileLibs": true
58
+ }
59
+ ```
60
+
61
+ This option will cause the initial compile time to be slower, but after the first run
62
+ the results are cached and so it should be quicker on subsequent compilation.
63
+
64
+ ## Contributors
65
+
66
+ - Matthew Conlen (https://github.com/mathisonian )
67
+ - Dan Marshall (https://github.com/danmarshall)
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ class IdyllVegaLite extends React.Component {
14
14
}
15
15
}
16
16
17
+ isVegaSpec ( ) {
18
+ return this . props . mode === 'vega' || ( this . props . spec . $schema && this . props . spec . $schema . startsWith ( "https://vega.github.io/schema/vega/" ) )
19
+ }
20
+
17
21
componentDidMount ( ) {
18
22
const { Handler } = require ( 'vega-tooltip' )
19
23
this . setState ( {
@@ -25,8 +29,11 @@ class IdyllVegaLite extends React.Component {
25
29
let adjustedSpec = spec ;
26
30
27
31
let Runtime = VegaLite ;
28
- if ( this . props . mode === 'vega' ) {
32
+ if ( this . isVegaSpec ( ) ) {
29
33
Runtime = Vega ;
34
+ if ( ! adjustedSpec . data ) {
35
+ console . warn ( 'If passing a vega spec you must provide a data object in the spec.' ) ;
36
+ }
30
37
} else {
31
38
//vega-lite spec. Modify the spec if data was passed.
32
39
if ( data ) {
You can’t perform that action at this time.
0 commit comments