blockcharts alpha

Gallery / Relationships and patterns /

Calendar heatmap

A number per day over months: weekly patterns.

80.8 KB of code · core 32.5 + 11 blocks 48.4

Orders per day

Weekdays bring about 105 orders a day, weekends less than half of that, about 45.

How it is made: transform.calendar turns each date into a week and a weekday, drawn by a rect from week to weekEnd on a time scale and on a band of weekdays. For several years, add a facet on a column with the year.

What the report is made of

The composer reads the JSON below and puts into the page the core and only the blocks its chart uses: 11 of the 59, 80.8 KB of code, minified, which is 37% of the 215.9 KB that the core and every block weigh together. The report file is 88.0 KB: that code, the data, the styles and the page around them.

BlockWhat it doesShare of the codeKB
core.composed
A report with compressed data: the composer has run the checks already.
A report with compressed data: the composer has run the checks already. 32.5
lib.pointer
Where the pointer is on the chart, and following a mouse or a finger once a frame. Shared by tooltip, crosshair, zoom and brush.
Where the pointer is on the chart, and following a mouse or a finger once a frame. Shared by tooltip, crosshair, zoom and brush. 1.7
lib.ticks
Round steps and ticks (1, 2 or 5 × 10ⁿ). Shared by the number scales and the histogram bins.
Round steps and ticks (1, 2 or 5 × 10ⁿ). Shared by the number scales and the histogram bins. 0.7
scale.band
One band per category: the axis of bar charts.
One band per category: the axis of bar charts. 1.2
scale.sequential
Numbers to a color ramp: heatmaps, hexbins.
Numbers to a color ramp: heatmaps, hexbins. 2.2
scale.time
Dates to positions, ticks in days, months or years (UTC).
Dates to positions, ticks in days, months or years (UTC). 4.1
transform.calendar
Weeks and weekdays for a calendar heatmap.
Weeks and weekdays for a calendar heatmap. 1.7
mark.rect
Rectangles: bars, grouped bars, ranges, heatmap cells; the hexagons of a hexbin.
Rectangles: bars, grouped bars, ranges, heatmap cells; the hexagons of a hexbin. 4.5
guide.axis
Axes: formatted labels, a title, long categories wrapped.
Axes: formatted labels, a title, long categories wrapped. 11.7
guide.legend
Legends: categories, a color bar, bubble sizes.
Legends: categories, a color bar, bubble sizes. 6.0
interaction.tooltip
The values under the pointer.
The values under the pointer. 10.7
renderer.svg
Draws into SVG: sharp, selectable, prints well. The default.
Draws into SVG: sharp, selectable, prints well. The default. 3.9
TotalThe core 32.5 and 11 blocks 48.480.8

The JSON

This is the whole input. data holds the datasets, each chart is a spec that names one. In a checkout of the repository: node scripts/compose.js skills/blockcharts/recipes/calendar-heatmap.json report.html. Saved as page.json, it composes the same with the skill's own runtime/compose.js.

calendar-heatmap.json

{
  "title": "Calendar heatmap",
  "data": {
    "orders": [
      {
        "date": "2025-01-01",
        "orders": 90
      },
      {
        "date": "2025-01-02",
        "orders": 108
      },
      {
        "date": "2025-01-03",
        "orders": 102
      },
      {
        "date": "2025-01-04",
        "orders": 60
      },
      {
        "date": "2025-01-05",
        "orders": 54
      },
      {
        "date": "2025-01-06",
        "orders": 109
      },
      {
        "date": "2025-01-07",
        "orders": 126
      },
      {
        "date": "2025-01-08",
        "orders": 120
      },
      {
        "date": "2025-01-09",
        "orders": 137
      },
      {
        "date": "2025-01-10",
        "orders": 130
      },
      {
        "date": "2025-01-11",
        "orders": 64
      },
      {
        "date": "2025-01-12",
        "orders": 80
      },
      {
        "date": "2025-01-13",
        "orders": 132
      },
      {
        "date": "2025-01-14",
        "orders": 148
      },
      {
        "date": "2025-01-15",
        "orders": 140
      },
      {
        "date": "2025-01-16",
        "orders": 132
      },
      {
        "date": "2025-01-17",
        "orders": 147
      },
      {
        "date": "2025-01-18",
        "orders": 78
      },
      {
        "date": "2025-01-19",
        "orders": 92
      },
      {
        "date": "2025-01-20",
        "orders": 143
      },
      {
        "date": "2025-01-21",
        "orders": 133
      },
      {
        "date": "2025-01-22",
        "orders": 146
      },
      {
        "date": "2025-01-23",
        "orders": 135
      },
      {
        "date": "2025-01-24",
        "orders": 125
      },
      {
        "date": "2025-01-25",
        "orders": 77
      },
      {
        "date": "2025-01-26",
        "orders": 66
      },
      {
        "date": "2025-01-27",
        "orders": 137
      },
      {
        "date": "2025-01-28",
        "orders": 125
      },
      {
        "date": "2025-01-29",
        "orders": 113
      },
      {
        "date": "2025-01-30",
        "orders": 124
      },
      {
        "date": "2025-01-31",
        "orders": 112
      },
      {
        "date": "2025-02-01",
        "orders": 63
      },
      {
        "date": "2025-02-02",
        "orders": 50
      },
      {
        "date": "2025-02-03",
        "orders": 98
      },
      {
        "date": "2025-02-04",
        "orders": 108
      },
      {
        "date": "2025-02-05",
        "orders": 95
      },
      {
        "date": "2025-02-06",
        "orders": 106
      },
      {
        "date": "2025-02-07",
        "orders": 93
      },
      {
        "date": "2025-02-08",
        "orders": 21
      },
      {
        "date": "2025-02-09",
        "orders": 31
      },
      {
        "date": "2025-02-10",
        "orders": 79
      },
      {
        "date": "2025-02-11",
        "orders": 90
      },
      {
        "date": "2025-02-12",
        "orders": 78
      },
      {
        "date": "2025-02-13",
        "orders": 66
      },
      {
        "date": "2025-02-14",
        "orders": 78
      },
      {
        "date": "2025-02-15",
        "orders": 6
      },
      {
        "date": "2025-02-16",
        "orders": -5
      },
      {
        "date": "2025-02-17",
        "orders": 68
      },
      {
        "date": "2025-02-18",
        "orders": 57
      },
      {
        "date": "2025-02-19",
        "orders": 70
      },
      {
        "date": "2025-02-20",
        "orders": 61
      },
      {
        "date": "2025-02-21",
        "orders": 51
      },
      {
        "date": "2025-02-22",
        "orders": 5
      },
      {
        "date": "2025-02-23",
        "orders": -4
      },
      {
        "date": "2025-02-24",
        "orders": 71
      },
      {
        "date": "2025-02-25",
        "orders": 63
      },
      {
        "date": "2025-02-26",
        "orders": 55
      },
      {
        "date": "2025-02-27",
        "orders": 70
      },
      {
        "date": "2025-02-28",
        "orders": 63
      },
      {
        "date": "2025-03-01",
        "orders": 19
      },
      {
        "date": "2025-03-02",
        "orders": 13
      },
      {
        "date": "2025-03-03",
        "orders": 66
      },
      {
        "date": "2025-03-04",
        "orders": 83
      },
      {
        "date": "2025-03-05",
        "orders": 77
      },
      {
        "date": "2025-03-06",
        "orders": 94
      },
      {
        "date": "2025-03-07",
        "orders": 88
      },
      {
        "date": "2025-03-08",
        "orders": 23
      },
      {
        "date": "2025-03-09",
        "orders": 40
      },
      {
        "date": "2025-03-10",
        "orders": 95
      },
      {
        "date": "2025-03-11",
        "orders": 90
      },
      {
        "date": "2025-03-12",
        "orders": 107
      },
      {
        "date": "2025-03-13",
        "orders": 102
      },
      {
        "date": "2025-03-14",
        "orders": 119
      },
      {
        "date": "2025-03-15",
        "orders": 54
      },
      {
        "date": "2025-03-16",
        "orders": 48
      },
      {
        "date": "2025-03-17",
        "orders": 125
      },
      {
        "date": "2025-03-18",
        "orders": 119
      },
      {
        "date": "2025-03-19",
        "orders": 136
      },
      {
        "date": "2025-03-20",
        "orders": 130
      },
      {
        "date": "2025-03-21",
        "orders": 123
      },
      {
        "date": "2025-03-22",
        "orders": 79
      },
      {
        "date": "2025-03-23",
        "orders": 72
      },
      {
        "date": "2025-03-24",
        "orders": 148
      },
      {
        "date": "2025-03-25",
        "orders": 140
      },
      {
        "date": "2025-03-26",
        "orders": 132
      },
      {
        "date": "2025-03-27",
        "orders": 147
      },
      {
        "date": "2025-03-28",
        "orders": 138
      },
      {
        "date": "2025-03-29",
        "orders": 92
      },
      {
        "date": "2025-03-30",
        "orders": 83
      },
      {
        "date": "2025-03-31",
        "orders": 133
      },
      {
        "date": "2025-04-01",
        "orders": 146
      },
      {
        "date": "2025-04-02",
        "orders": 136
      },
      {
        "date": "2025-04-03",
        "orders": 125
      },
      {
        "date": "2025-04-04",
        "orders": 137
      },
      {
        "date": "2025-04-05",
        "orders": 66
      },
      {
        "date": "2025-04-06",
        "orders": 77
      },
      {
        "date": "2025-04-07",
        "orders": 126
      },
      {
        "date": "2025-04-08",
        "orders": 114
      },
      {
        "date": "2025-04-09",
        "orders": 125
      },
      {
        "date": "2025-04-10",
        "orders": 112
      },
      {
        "date": "2025-04-11",
        "orders": 123
      },
      {
        "date": "2025-04-12",
        "orders": 51
      },
      {
        "date": "2025-04-13",
        "orders": 38
      },
      {
        "date": "2025-04-14",
        "orders": 108
      },
      {
        "date": "2025-04-15",
        "orders": 96
      },
      {
        "date": "2025-04-16",
        "orders": 106
      },
      {
        "date": "2025-04-17",
        "orders": 94
      },
      {
        "date": "2025-04-18",
        "orders": 81
      },
      {
        "date": "2025-04-19",
        "orders": 32
      },
      {
        "date": "2025-04-20",
        "orders": 19
      },
      {
        "date": "2025-04-21",
        "orders": 90
      },
      {
        "date": "2025-04-22",
        "orders": 78
      },
      {
        "date": "2025-04-23",
        "orders": 67
      },
      {
        "date": "2025-04-24",
        "orders": 78
      },
      {
        "date": "2025-04-25",
        "orders": 67
      },
      {
        "date": "2025-04-26",
        "orders": -4
      },
      {
        "date": "2025-04-27",
        "orders": 8
      },
      {
        "date": "2025-04-28",
        "orders": 58
      },
      {
        "date": "2025-04-29",
        "orders": 70
      },
      {
        "date": "2025-04-30",
        "orders": 61
      },
      {
        "date": "2025-05-01",
        "orders": 51
      },
      {
        "date": "2025-05-02",
        "orders": 65
      },
      {
        "date": "2025-05-03",
        "orders": -4
      },
      {
        "date": "2025-05-04",
        "orders": 11
      },
      {
        "date": "2025-05-05",
        "orders": 63
      },
      {
        "date": "2025-05-06",
        "orders": 55
      },
      {
        "date": "2025-05-07",
        "orders": 70
      },
      {
        "date": "2025-05-08",
        "orders": 63
      },
      {
        "date": "2025-05-09",
        "orders": 79
      },
      {
        "date": "2025-05-10",
        "orders": 12
      },
      {
        "date": "2025-05-11",
        "orders": 6
      },
      {
        "date": "2025-05-12",
        "orders": 83
      },
      {
        "date": "2025-05-13",
        "orders": 77
      },
      {
        "date": "2025-05-14",
        "orders": 94
      },
      {
        "date": "2025-05-15",
        "orders": 88
      },
      {
        "date": "2025-05-16",
        "orders": 82
      },
      {
        "date": "2025-05-17",
        "orders": 40
      },
      {
        "date": "2025-05-18",
        "orders": 35
      },
      {
        "date": "2025-05-19",
        "orders": 89
      },
      {
        "date": "2025-05-20",
        "orders": 107
      },
      {
        "date": "2025-05-21",
        "orders": 101
      },
      {
        "date": "2025-05-22",
        "orders": 119
      },
      {
        "date": "2025-05-23",
        "orders": 113
      },
      {
        "date": "2025-05-24",
        "orders": 48
      },
      {
        "date": "2025-05-25",
        "orders": 65
      },
      {
        "date": "2025-05-26",
        "orders": 119
      },
      {
        "date": "2025-05-27",
        "orders": 136
      },
      {
        "date": "2025-05-28",
        "orders": 130
      },
      {
        "date": "2025-05-29",
        "orders": 123
      },
      {
        "date": "2025-05-30",
        "orders": 139
      },
      {
        "date": "2025-05-31",
        "orders": 72
      },
      {
        "date": "2025-06-01",
        "orders": 88
      },
      {
        "date": "2025-06-02",
        "orders": 140
      },
      {
        "date": "2025-06-03",
        "orders": 132
      },
      {
        "date": "2025-06-04",
        "orders": 147
      },
      {
        "date": "2025-06-05",
        "orders": 138
      },
      {
        "date": "2025-06-06",
        "orders": 152
      },
      {
        "date": "2025-06-07",
        "orders": 83
      },
      {
        "date": "2025-06-08",
        "orders": 73
      },
      {
        "date": "2025-06-09",
        "orders": 146
      },
      {
        "date": "2025-06-10",
        "orders": 136
      },
      {
        "date": "2025-06-11",
        "orders": 125
      },
      {
        "date": "2025-06-12",
        "orders": 137
      },
      {
        "date": "2025-06-13",
        "orders": 126
      },
      {
        "date": "2025-06-14",
        "orders": 78
      },
      {
        "date": "2025-06-15",
        "orders": 66
      },
      {
        "date": "2025-06-16",
        "orders": 114
      },
      {
        "date": "2025-06-17",
        "orders": 125
      },
      {
        "date": "2025-06-18",
        "orders": 113
      },
      {
        "date": "2025-06-19",
        "orders": 124
      },
      {
        "date": "2025-06-20",
        "orders": 111
      },
      {
        "date": "2025-06-21",
        "orders": 38
      },
      {
        "date": "2025-06-22",
        "orders": 49
      },
      {
        "date": "2025-06-23",
        "orders": 96
      },
      {
        "date": "2025-06-24",
        "orders": 107
      },
      {
        "date": "2025-06-25",
        "orders": 94
      },
      {
        "date": "2025-06-26",
        "orders": 81
      },
      {
        "date": "2025-06-27",
        "orders": 92
      },
      {
        "date": "2025-06-28",
        "orders": 20
      },
      {
        "date": "2025-06-29",
        "orders": 31
      },
      {
        "date": "2025-06-30",
        "orders": 79
      },
      {
        "date": "2025-07-01",
        "orders": 67
      }
    ]
  },
  "charts": [
    {
      "title": "Orders per day",
      "note": "Weekdays bring about 105 orders a day, weekends less than half of that, about 45.",
      "how": "transform.calendar turns each date into a week and a weekday, drawn by a rect from week to weekEnd on a time scale and on a band of weekdays. For several years, add a facet on a column with the year.",
      "spec": {
        "data": "orders",
        "size": [
          720,
          200
        ],
        "padding": {
          "top": 8,
          "right": 8,
          "bottom": 8,
          "left": 8
        },
        "transforms": [
          {
            "type": "calendar",
            "field": "date"
          }
        ],
        "scales": {
          "x": {
            "type": "time"
          },
          "y": {
            "type": "band",
            "paddingInner": 0.1
          },
          "color": {
            "type": "sequential",
            "range": [
              "#dbeafe",
              "#1d4ed8"
            ]
          }
        },
        "guides": [
          {
            "type": "axis",
            "scale": "x",
            "format": {
              "month": "short"
            }
          },
          {
            "type": "axis",
            "scale": "y"
          },
          {
            "type": "legend",
            "scale": "color",
            "position": "right"
          }
        ],
        "marks": [
          {
            "type": "rect",
            "x": "week",
            "x2": "weekEnd",
            "y": "day",
            "color": "orders",
            "radius": 2
          }
        ],
        "interaction": [
          {
            "type": "tooltip",
            "heading": "date",
            "fields": [
              "orders"
            ],
            "formats": {
              "date": "date"
            }
          }
        ]
      }
    }
  ]
}

The report the composer makes from it is one standalone file (88.0 KB): open it from disk, mail it, print it.

In a page of your own

The charts above use the full kit (81.8 KB gzipped), the smallest one that has the blocks this example needs: lib.pointer, lib.ticks, scale.band, scale.sequential, scale.time, transform.calendar, mark.rect, guide.axis, guide.legend, interaction.tooltip, renderer.svg. The HTML below loads it from the jsDelivr CDN, pinned to version 0.0.5; to serve it from your own site, put its file there (the files of a release) and change the address.

HTML

<script src="https://cdn.jsdelivr.net/npm/blockcharts@0.0.5/release/kits/full.js"></script>

<script type="application/json" id="bc-data">
{"orders":[{"date":"2025-01-01","orders":90},{"date":"2025-01-02","orders":108},{"date":"2025-01-03","orders":102},{"date":"2025-01-04","orders":60},{"date":"2025-01-05","orders":54},{"date":"2025-01-06","orders":109},{"date":"2025-01-07","orders":126},{"date":"2025-01-08","orders":120},{"date":"2025-01-09","orders":137},{"date":"2025-01-10","orders":130},{"date":"2025-01-11","orders":64},{"date":"2025-01-12","orders":80},{"date":"2025-01-13","orders":132},{"date":"2025-01-14","orders":148},{"date":"2025-01-15","orders":140},{"date":"2025-01-16","orders":132},{"date":"2025-01-17","orders":147},{"date":"2025-01-18","orders":78},{"date":"2025-01-19","orders":92},{"date":"2025-01-20","orders":143},{"date":"2025-01-21","orders":133},{"date":"2025-01-22","orders":146},{"date":"2025-01-23","orders":135},{"date":"2025-01-24","orders":125},{"date":"2025-01-25","orders":77},{"date":"2025-01-26","orders":66},{"date":"2025-01-27","orders":137},{"date":"2025-01-28","orders":125},{"date":"2025-01-29","orders":113},{"date":"2025-01-30","orders":124},{"date":"2025-01-31","orders":112},{"date":"2025-02-01","orders":63},{"date":"2025-02-02","orders":50},{"date":"2025-02-03","orders":98},{"date":"2025-02-04","orders":108},{"date":"2025-02-05","orders":95},{"date":"2025-02-06","orders":106},{"date":"2025-02-07","orders":93},{"date":"2025-02-08","orders":21},{"date":"2025-02-09","orders":31},{"date":"2025-02-10","orders":79},{"date":"2025-02-11","orders":90},{"date":"2025-02-12","orders":78},{"date":"2025-02-13","orders":66},{"date":"2025-02-14","orders":78},{"date":"2025-02-15","orders":6},{"date":"2025-02-16","orders":-5},{"date":"2025-02-17","orders":68},{"date":"2025-02-18","orders":57},{"date":"2025-02-19","orders":70},{"date":"2025-02-20","orders":61},{"date":"2025-02-21","orders":51},{"date":"2025-02-22","orders":5},{"date":"2025-02-23","orders":-4},{"date":"2025-02-24","orders":71},{"date":"2025-02-25","orders":63},{"date":"2025-02-26","orders":55},{"date":"2025-02-27","orders":70},{"date":"2025-02-28","orders":63},{"date":"2025-03-01","orders":19},{"date":"2025-03-02","orders":13},{"date":"2025-03-03","orders":66},{"date":"2025-03-04","orders":83},{"date":"2025-03-05","orders":77},{"date":"2025-03-06","orders":94},{"date":"2025-03-07","orders":88},{"date":"2025-03-08","orders":23},{"date":"2025-03-09","orders":40},{"date":"2025-03-10","orders":95},{"date":"2025-03-11","orders":90},{"date":"2025-03-12","orders":107},{"date":"2025-03-13","orders":102},{"date":"2025-03-14","orders":119},{"date":"2025-03-15","orders":54},{"date":"2025-03-16","orders":48},{"date":"2025-03-17","orders":125},{"date":"2025-03-18","orders":119},{"date":"2025-03-19","orders":136},{"date":"2025-03-20","orders":130},{"date":"2025-03-21","orders":123},{"date":"2025-03-22","orders":79},{"date":"2025-03-23","orders":72},{"date":"2025-03-24","orders":148},{"date":"2025-03-25","orders":140},{"date":"2025-03-26","orders":132},{"date":"2025-03-27","orders":147},{"date":"2025-03-28","orders":138},{"date":"2025-03-29","orders":92},{"date":"2025-03-30","orders":83},{"date":"2025-03-31","orders":133},{"date":"2025-04-01","orders":146},{"date":"2025-04-02","orders":136},{"date":"2025-04-03","orders":125},{"date":"2025-04-04","orders":137},{"date":"2025-04-05","orders":66},{"date":"2025-04-06","orders":77},{"date":"2025-04-07","orders":126},{"date":"2025-04-08","orders":114},{"date":"2025-04-09","orders":125},{"date":"2025-04-10","orders":112},{"date":"2025-04-11","orders":123},{"date":"2025-04-12","orders":51},{"date":"2025-04-13","orders":38},{"date":"2025-04-14","orders":108},{"date":"2025-04-15","orders":96},{"date":"2025-04-16","orders":106},{"date":"2025-04-17","orders":94},{"date":"2025-04-18","orders":81},{"date":"2025-04-19","orders":32},{"date":"2025-04-20","orders":19},{"date":"2025-04-21","orders":90},{"date":"2025-04-22","orders":78},{"date":"2025-04-23","orders":67},{"date":"2025-04-24","orders":78},{"date":"2025-04-25","orders":67},{"date":"2025-04-26","orders":-4},{"date":"2025-04-27","orders":8},{"date":"2025-04-28","orders":58},{"date":"2025-04-29","orders":70},{"date":"2025-04-30","orders":61},{"date":"2025-05-01","orders":51},{"date":"2025-05-02","orders":65},{"date":"2025-05-03","orders":-4},{"date":"2025-05-04","orders":11},{"date":"2025-05-05","orders":63},{"date":"2025-05-06","orders":55},{"date":"2025-05-07","orders":70},{"date":"2025-05-08","orders":63},{"date":"2025-05-09","orders":79},{"date":"2025-05-10","orders":12},{"date":"2025-05-11","orders":6},{"date":"2025-05-12","orders":83},{"date":"2025-05-13","orders":77},{"date":"2025-05-14","orders":94},{"date":"2025-05-15","orders":88},{"date":"2025-05-16","orders":82},{"date":"2025-05-17","orders":40},{"date":"2025-05-18","orders":35},{"date":"2025-05-19","orders":89},{"date":"2025-05-20","orders":107},{"date":"2025-05-21","orders":101},{"date":"2025-05-22","orders":119},{"date":"2025-05-23","orders":113},{"date":"2025-05-24","orders":48},{"date":"2025-05-25","orders":65},{"date":"2025-05-26","orders":119},{"date":"2025-05-27","orders":136},{"date":"2025-05-28","orders":130},{"date":"2025-05-29","orders":123},{"date":"2025-05-30","orders":139},{"date":"2025-05-31","orders":72},{"date":"2025-06-01","orders":88},{"date":"2025-06-02","orders":140},{"date":"2025-06-03","orders":132},{"date":"2025-06-04","orders":147},{"date":"2025-06-05","orders":138},{"date":"2025-06-06","orders":152},{"date":"2025-06-07","orders":83},{"date":"2025-06-08","orders":73},{"date":"2025-06-09","orders":146},{"date":"2025-06-10","orders":136},{"date":"2025-06-11","orders":125},{"date":"2025-06-12","orders":137},{"date":"2025-06-13","orders":126},{"date":"2025-06-14","orders":78},{"date":"2025-06-15","orders":66},{"date":"2025-06-16","orders":114},{"date":"2025-06-17","orders":125},{"date":"2025-06-18","orders":113},{"date":"2025-06-19","orders":124},{"date":"2025-06-20","orders":111},{"date":"2025-06-21","orders":38},{"date":"2025-06-22","orders":49},{"date":"2025-06-23","orders":96},{"date":"2025-06-24","orders":107},{"date":"2025-06-25","orders":94},{"date":"2025-06-26","orders":81},{"date":"2025-06-27","orders":92},{"date":"2025-06-28","orders":20},{"date":"2025-06-29","orders":31},{"date":"2025-06-30","orders":79},{"date":"2025-07-01","orders":67}]}
</script>

<script type="application/json" data-bc-chart>
{
  "data": "orders",
  "size": [
    720,
    200
  ],
  "padding": {
    "top": 8,
    "right": 8,
    "bottom": 8,
    "left": 8
  },
  "transforms": [
    {
      "type": "calendar",
      "field": "date"
    }
  ],
  "scales": {
    "x": {
      "type": "time"
    },
    "y": {
      "type": "band",
      "paddingInner": 0.1
    },
    "color": {
      "type": "sequential",
      "range": [
        "#dbeafe",
        "#1d4ed8"
      ]
    }
  },
  "guides": [
    {
      "type": "axis",
      "scale": "x",
      "format": {
        "month": "short"
      }
    },
    {
      "type": "axis",
      "scale": "y"
    },
    {
      "type": "legend",
      "scale": "color",
      "position": "right"
    }
  ],
  "marks": [
    {
      "type": "rect",
      "x": "week",
      "x2": "weekEnd",
      "y": "day",
      "color": "orders",
      "radius": 2
    }
  ],
  "interaction": [
    {
      "type": "tooltip",
      "heading": "date",
      "fields": [
        "orders"
      ],
      "formats": {
        "date": "date"
      }
    }
  ],
  "alt": "Orders per day"
}
</script>