Public
Edited
Oct 4, 2023
Insert cell
md`# Syllabus heatmap `
Insert cell
import {select} from '@jashkenas/inputs'

Insert cell
FileAttachment("Disciplinary Perspectives-&&-Course Topics@2.csv").csv()
Insert cell
viewof fileselection = {
const files = new Map([
FileAttachment("Course Level-&&-Course Topics@4.csv"),
FileAttachment("Disciplinary Perspectives-&&-Instructor Name@3.csv"),
FileAttachment("Course Level-&&-Disciplinary Perspectives@4.csv"),
FileAttachment("Instructional Modality-&&-Instructor Name@1.csv"),
FileAttachment("Course Level-&&-Instructional Modality@2.csv"),
FileAttachment("Instructor Name-&&-Instructional Modality@6.csv"),
FileAttachment("Course Level-&&-Instructor Name@2.csv"),
FileAttachment("Instructor Name-&&-Course Topics@8.csv"),
FileAttachment("Disciplinary Perspectives-&&-Course Topics@2.csv"),
FileAttachment("Disciplinary Perspectives-&&-Instructional Modality@3.csv")

].map(f => [f.name, f]));
const form = select({
description: "Select Dataset",
options: Array.from(files.keys()),
value: "Disciplinary Perspectives-&&-Course Topics--03252022.csv"
});
return Object.defineProperty(html`<div>${form}`, 'value', {get() { return files.get(form.value) }});
}
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
vega = require("vega-embed@3")
Insert cell
viewof selection = {
const colorschemas = new Array("blues","reds","oranges","greens","purples","purpleblue","redpurple","yellowgreen");
const form = select({
description: "Select Color Schema",
options: colorschemas,
value: "oranges"
});
return Object.defineProperty(html`<div>${form}`, 'value', {get() { return form.value }});
}
Insert cell
d3 = require('d3')
Insert cell
data = fileselection.csv()
Insert cell
//from https://observablehq.com/@john-guerra/get-column-names-from-csv
keys=Object.keys(data[0])
Insert cell
// from https://www.d3-graph-gallery.com/graph/basic_datamanipulation.html
max = d3.max(data, function(data) { return +data.value; });
Insert cell
colorschema=selection

Insert cell
viewof heatmap = vega({
data: { values: data },
width: 800,
height: 800,
title: fileselection,
mark: 'rect',
selection: { highlight: {type: "single"}} ,
encoding: {
x: { field: keys[0], type: 'o'},
y: { field: keys[1], type: 'o'},
color: {
field: 'value',
type: 'q',
scale: { scheme: selection, domain: [0, max] }
},

}
});


Insert cell
clicked = Generators.observe((notify) => {
const clicked = (event, {datum}) => window.open(datum.url);
heatmap.addEventListener("click", clicked);
return () => heatmap.removeEventListener("click", clicked);
})



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