Area Between Lines

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "usermeta": {
    "deneb": {
      "build": "1.1.0.0",
      "metaVersion": 1,
      "provider": "vegaLite",
      "providerVersion": "5.2.0"
    },
    "interactivity": {
      "tooltip": true,
      "contextMenu": true,
      "selection": false,
      "dataPointLimit": 50
    },
    "information": {
      "name": "Area between Lines",
      "description": "[No Description Provided]",
      "author": "Kerry Kolosko",
      "uuid": "a850bd46-63db-4fd4-95bb-c4f5ac94b103",
      "generated": "2022-03-27T11:01:43.323Z"
    },
    "dataset": [
      {
        "key": "__0__",
        "name": "Year",
        "description": "",
        "type": "numeric",
        "kind": "column"
      },
      {
        "key": "__1__",
        "name": "Males (Hermanussen (2003) and NCD-RisC (2017))",
        "description": "",
        "type": "numeric",
        "kind": "measure"
      },
      {
        "key": "__2__",
        "name": "Females (Hermanussen (2003) and NCD-RisC (2017))",
        "description": "",
        "type": "numeric",
        "kind": "measure"
      }
    ]
  },
  "config": {
    "autosize": {
      "type": "fit",
      "contains": "padding"
    },
    "view": {
      "stroke": "grey",
      "fill": "white"
    },
    "font": "courier",
    "bar": {"color": "black"},
    "axis": {
      "domain": true,
      "labelColor": "black",
      "labelFontSize": 12,
      "labelPadding": 5,
      "ticks": false,
      "tickCount": 10,
      "titleFontSize": 14,
      "titleFontWeight": "regular",
      "titleColor": "black",
      "gridDash": [1, 5],
      "gridColor": "grey"
    }
  },
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "area",
        "fill": "#E8DED4",
        "opacity": 0.6
      },
      "encoding": {
        "y": {
          "field": "__1__",
          "type": "quantitative"
        },
        "y2": {
          "field": "__2__",
          "type": "quantitative"
        },
        "x": {
          "field": "__0__",
          "type": "quantitative"
        }
      }
    },
    {
      "mark": "line",
      "encoding": {
        "color": {
          "datum": "Female",
          "scale": {
            "range": [
              "black",
              "firebrick"
            ]
          }
        },
        "x": {
          "field": "__0__",
          "type": "quantitative",
          "title": "__0__"
        },
        "y": {
          "field": "__2__",
          "type": "quantitative",
          "title": "Height (cm)",
          "axis": {
            "format": "f",
            "tickCount": 3
          }
        }
      }
    },
    {
      "mark": "line",
      "encoding": {
        "color": {
          "datum": "Males",
          "scale": {
            "range": [
              "black",
              "firebrick"
            ]
          }
        },
        "x": {
          "field": "__0__",
          "type": "quantitative"
        },
        "y": {
          "field": "__1__",
          "type": "quantitative",
          "scale": {"zero": false}
        }
      }
    }
  ]
}

Leave a comment

Your email address will not be published. Required fields are marked *