Skip to content

Instantly share code, notes, and snippets.

{
"state": {
"version": "1.3.0",
"dataset": {
"tables": [
{
"name": "Temperature",
"displayName": "Temperature",
"columns": [
{
@donghaoren
donghaoren / README.md
Last active February 19, 2023 07:30
Responsive Vega Chart Demo

A responsive chart demo in Vega. The spec is a modification of a Vega-Lite output:

  • Set width and height to be signals. The signals gets their initial values from containerSize(), and listens to subsequent resize events on window:resize.
  • Use autosize: { type: "fit", contains: "padding" }. This ensures that the width / height correspond to the entire chart, not the plotting area.

Click Open and resize the window to see this example in action.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.25882354378700256</real>