Published
Edited
Dec 5, 2021
Importers
Insert cell
Insert cell
Insert cell
barchart = GroupedBarChart(data8.filter(d=> d.Substance == "Opioids"), {
x: d => d.Region,
y: d => d.Value,
z: d => d.Year_Quarter,
yLabel: "Opioid death in Canada Per 100,000",
xDomain: d3.groupSort(data8, D => d3.sum(D, d => -d.Value), d => d.Region).slice(0, 8),
zDomain: Time,
colors: d3.schemeSpectral[Time.length],
width,
height: 700
})
Insert cell
Time = [2016,2017,2018,2019,2020,"2021 (Jan to Mar)" ]
Insert cell
Insert cell
data7 = data6.filter(d => (!d.Region.includes("Nunavut")))
Insert cell
data8 = data7.filter(d => (!d.Region.includes("Mani")))
Insert cell
data1 = d3.group(data, d => d.Region)
Insert cell
Insert cell
data21 = data2.filter(d => (d.Substance.includes("Stimulants")))
Insert cell
data4 = data2.filter(d => (d.Source.includes("Deaths")))
Insert cell
data5 = data4.filter(d => (d.Type_Event.includes("Total")))
Insert cell
data = Object.assign(d3.csvParse(await FileAttachment("SubstanceHarmsData.csv").text(), d3.autoType))
Insert cell
datatest = data.filter(d => ( d.Region == "British Columbia") && d.Unit == "Crude rate" && d.Substance == "Opioids" && d.Specific_Measure == "Sex")
Insert cell
import {Wrangler, op, dataInput} from "@observablehq/data-wrangler"
Insert cell
viewof table = Inputs.table(data7.filter(d=> d.Substance == "Opioids"), {})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { Swatches} from "@d3/color-legend"
Insert cell
import {howto, altplot} from "@d3/example-components"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more