Autosize does not automatically resize the chart based in the container. You need to listen for size changes and set the width and height signals through the Vega view API.
--
You received this message because you are subscribed to the Google Groups "vega-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vega-js+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yes, you need to add JS listeners since the spec doesn't have access to the DOM around the visualization.
If you only want to support small changes of the scale, you can also use CSS and scale a Vega visualization like any image.
The size in Vega usually determines the dimensions of the chart area without axes and legends. You can use autosize `fit` and no padding to change that.
You received this message because you are subscribed to a topic in the Google Groups "vega-js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vega-js/YovF3RvlnRg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vega-js+u...@googlegroups.com.
{ "$schema": "https://vega.github.io/schema/vega/v3.0.json", "width": 200, "height": 200,
"data": [ { "name": "table", "values": [12, 23, 47, 6, 52, 19], "transform": [{"type": "pie", "field": "data"}] } ],
"signals": [ { "name": "width", "value": "", "on": [ { "events": { "source": "window", "type": "resize" }, "update": "containerSize()[0]*0.95" } ] }, { "name": "height", "value": "", "on": [ { "events": { "source": "window", "type": "resize" }, "update": "containerSize()[1]*0.95" } ] } ],
"scales": [ { "name": "r", "type": "sqrt", "domain": {"data": "table", "field": "data"}, "zero": true, "range": [ { "signal": "width*0.03" }, { "signal": "width*0.50" } ] } ],
"marks": [ { "type": "arc", "from": {"data": "table"}, "encode": { "update": { "x": {"signal": "width / 2"}, "y": { "signal": "height / 2"}, "startAngle": {"field": "startAngle"}, "endAngle": {"field": "endAngle"}, "outerRadius": {"scale": "r", "field": "data"}, "stroke": {"value": "#fff"}, "fill": {"value": "#ccc"} }, "hover": { "fill": {"value": "pink"} } } } ]}