{
  "$schema": "https://vega.github.io/schema/vega/v4.json",
  "width": 600,
  "height": 360,
  "autosize": "fit",
  "data": [
    {
      "name": "table",
      "url": "<%= dataset_url %>"
    }
  ],
  "scales": [
    {
      "name": "xscale",
      "type": "band",
      "domain": {
        "data": "table",
        "field": "<%= data_mapper.column_1 %>"
      },
      "range": "width",
      "padding": 0.3,
      "round": true
    },
    {
      "name": "yscale",
      "domain": {
        "data": "table",
        "field": "<%= data_mapper.column_2 %>"
      },
      "nice": true,
      "range": "height"
    }
  ],
  "axes": [
    {
      "orient": "bottom",
      "scale": "xscale",
      "ticks": false,
      "labelOverlap": "greedy",
      "labelPadding": 10
    }
  ],
  "marks": [
    {
      "name": "bars",
      "type": "rect",
      "from": {
        "data": "table"
      },
      "encode": {
        "update": {
          "fill": {
            "value": "#FEC44F"
          },
          "x": {
            "scale": "xscale",
            "field": "<%= data_mapper.column_1 %>"
          },
          "width": {
            "scale": "xscale",
            "band": 1
          },
          "y": {
            "scale": "yscale",
            "field": "<%= data_mapper.column_2 %>"
          },
          "y2": {
            "scale": "yscale",
            "value": 0
          },
          "tooltip": {
            "signal": "datum"
          }
        }
      }
    },
    {
      "type": "text",
      "from": {
        "data": "table"
      },
      "encode": {
        "update": {
          "x": {
            "scale": "xscale",
            "field": "<%= data_mapper.column_1 %>",
            "offset": 29
          },
          "y": {
            "scale": "yscale",
            "field": "<%= data_mapper.column_2 %>",
            "offset": -10
          },
          "fill": {
            "value": "#000000"
          },
          "align": {
            "value": "right"
          },
          "baseline": {
            "value": "middle"
          },
          "text": {
            "signal": "datum['<%= data_mapper.column_2 %>']"
          }
        }
      }
    }
  ]
}
