Skip to content

Instantly share code, notes, and snippets.

@domoritz
Last active May 21, 2020 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domoritz/bbd2cc22e8b1fe2eb25c378d34992d65 to your computer and use it in GitHub Desktop.
Save domoritz/bbd2cc22e8b1fe2eb25c378d34992d65 to your computer and use it in GitHub Desktop.
Vega interaction bug with SVG
license: mit
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega@5.12.1"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-lite@4.8.1"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
</head>
<body>
<div id="vis"></div>
<script>
var spec = {"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}}, "data": {"url": "https://vega.github.io/vega-datasets/data/unemployment-across-industries.json"}, "mark": "area", "encoding": {"color": {"type": "nominal", "field": "series", "scale": {"scheme": "category20b"}}, "opacity": {"condition": {"value": 1, "selection": "selector002"}, "value": 0.2}, "x": {"type": "temporal", "axis": {"domain": false, "format": "%Y", "tickSize": 0}, "field": "date", "timeUnit": "yearmonth"}, "y": {"type": "quantitative", "aggregate": "sum", "axis": null, "field": "count", "stack": "center"}}, "selection": {"selector002": {"type": "multi", "fields": ["series"], "bind": "legend"}}, "$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json"};
var embedOpt = {"mode": "vega-lite", renderer: 'svg'};
vegaEmbed("#vis", spec, embedOpt)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment