Published
Edited
Oct 6, 2020
Insert cell
md`# COVID-19 deaths in United Kingdom (Regionwise Distribution)`
Insert cell
xlsx = require('https://bundle.run/xlsx@0.14.1')
Insert cell
viewof binary = html`<input type=file>`
Insert cell
input = new Uint8Array(await Files.buffer(binary))
Insert cell
wb = xlsx.read(input, {type: 'array'})
Insert cell
ws = wb.Sheets[sheet_name]
Insert cell
headers = Object.keys(xlsx.utils.sheet_to_json(wb.Sheets[sheet_name])[0])
Insert cell
as_json = xlsx.utils.sheet_to_json(ws)
Insert cell
import {checkbox, text, select} from '@jashkenas/inputs'
Insert cell
import {table} from "@tmcw/tables"
Insert cell
viewof sheet_name = select({options: wb.SheetNames, title: 'Sheet name'})
Insert cell
vegalite = require('@observablehq/vega-lite')
Insert cell
vegalite({
data: {values: as_json},
width: 700,
height: 400,
mark:{"type": "bar", "cornerRadiusEnd": 4},
encoding: {
x: {title:"Regionwise Ditribution","field": "Region", "type": "ordinal", sort:null},
y: {title:"Total Deaths","field": "Deaths", "type": "quantitative"},
tooltip: {"field": "Deaths", "type": "quantitative"},
color:{value:"#ff8333"}
}
})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more