Public
Edited
May 17, 2024
Insert cell
Insert cell
Insert cell
oeuvres
Insert cell
data = {
var resultat = []

oeuvres.forEach(oeuvre => {

var current = oeuvre
//console.log(typeof oeuvre.produced_at)
//console.log(oeuvre.produced_at.charAt(0))

if (oeuvre.produced_at == null)
oeuvre.siecle = "sans date"
else if (oeuvre.produced_at.charAt(0) == "2"){
oeuvre.siecle = "XXIe"
}
else if (oeuvre.produced_at.charAt(0) == "1" && oeuvre.produced_at.charAt(1) == "9")
oeuvre.siecle = "XXe"
else if (oeuvre.produced_at.charAt(0) == "1" && oeuvre.produced_at.charAt(1) == "8")
oeuvre.siecle = "XIXe"
else if (oeuvre.produced_at.charAt(0) == "1" && oeuvre.produced_at.charAt(1) == "7")
oeuvre.siecle = "XVIIIe"
else
oeuvre.siecle = "autre ("+oeuvre.produced_at+ ")"

resultat.push(oeuvre)
})

return resultat
}
Insert cell
siecles = _.uniqBy(data.map(d => d.siecle))
Insert cell
viewof sieclesSelectionnes = Inputs.checkbox(siecles, {label: "Choisir un ou plusieurs siècles", value: ["XXe"]})
Insert cell
selectionSiecle = oeuvres.filter(d => sieclesSelectionnes.includes(d.siecle))
Insert cell
sieclesSelectionnes
Insert cell
firstCategories = _.uniqBy(selectionSiecle.map(d => d.firstCat))
Insert cell
viewof categorieSelectionnee = Inputs.select(firstCategories, {label: "Choisir une categorie"})
Insert cell
categorieSelectionnee
Insert cell
selectionCategorie = selectionSiecle.filter(d => d.firstCat == categorieSelectionnee)
Insert cell
selectionCategorie
X
genreSimplifie
Y
Color
genreSimplifie
Size
Facet X
Facet Y
Mark
bar
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
collections = Plot.plot({
height: 400,
width: 1200,
facet:{
data: dataCollections,
y: "name",
marginLeft: 130,
label:"Collections"
},
marks: [
Plot.dotX(dataCollections, Plot.dodgeY({
x: "ordre",
fill: "name",
href: "url",
target: "_blank",
sort: {channel: "x"}
}))
],
x: {
type: "band",
domain: epigrammes,
ticks: false
},
y: {
tickRotate: 90,
},
marginBottom: 50,
color: {
legend: true,
}
})
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