Published
Edited
Dec 14, 2019
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// html`<div style="
// background: #fff;
// display: grid;
// padding: 30px;
// height: ${screen.height / screen.width * 180}vw;
// grid-template-areas:
// 'a a'
// 'd d'
// 'c c'
// 'b b';
// ">
// <div name="a" style=
// "grid-area:a;
// position: absolute;
// top: 5px;
// left: 5px;
// padding-bottom: 50px;
// text-align: left">
// ${viewof movieChart}
// </div>
// <div name="b" style=
// "grid-area:b;
// position: absolute;
// left: 500px;
// bottom: 0px;
// text-align: center">
// ${viewof scattermonth}
// </div>
// <div name="c" style=
// "grid-area:c;
// position: absolute;
// top: 10px;
// right: 5px;
// bottom: 10px;
// overflow-x: scroll;
// background-color: darkred;
// color: white;
// max-width: 300px";
// max-height: 200px">
// ${viewof table}
// </div>
// <div name="d" style=
// "grid-area:d;
// position: absolute;
// bottom: 30px;
// left: 5px;
// padding-bottom: 160px;
// text-align: center">
// ${viewof jump_rating}
// </div>
// </div>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function isEmpty(obj) {
for (var prop in obj) {
return false;
}
return true;
}
Insert cell
movieChart.addSignalListener("genreSelect", function(name, value) {
if (value == null)
mutable genre = null
else
mutable genre = value.Genre
})
Insert cell
mutable genre = null
Insert cell
genreSelection = {
if(isEmpty(genre)){
return Array.from(new Set(movies.map(d => d.Genre)))
} else {
return genre
}
}
Insert cell
Insert cell
movieChart.addSignalListener("timeBrush", function(name, value) {
if (value == null)
mutable year = null
else
mutable year = value.Year
})
Insert cell
mutable year = null
Insert cell
Insert cell
MPAAselect = {
if(isEmpty(mpaa)){
return Array.from(new Set(movies.map(d => d.rating)))
} else {
return mpaa
}
}
Insert cell
mutable mpaa = null
Insert cell
jump_rating.addSignalListener("MPAArating", function(name, value) {
if (value == null)
mutable mpaa = null
else
mutable mpaa = value.MPAA_Rating
})
Insert cell
awardsChart.addSignalListener("monthSelect", function(name, value) {
if (value == null)
mutable month = null
else
mutable month = value.Month
})
Insert cell
mutable month = null
Insert cell
monthSelection = {
if(isEmpty(month)){
return Array.from(new Set(movies.map(d => d.Month)))
} else {
return month
}
}
Insert cell
awardcheckbox
Insert cell
movieSelection = {
if(isEmpty(name)){
return Array.from(new Set(movies.map(d => d.Movie_Name)))
} else {
return name
}
}
Insert cell
movieNames = {
return Array.from(new Set(name(d => d.Movie_Name)))
}
Insert cell
mutable name = null
Insert cell
jump_rating.addSignalListener("criticBrush", function(name, value) {
if (value == null)
mutable name = null
else
mutable name = value
})
Insert cell
jump_rating.addSignalListener("audienceBrush", function(name, value) {
if (value == null)
mutable name = null
else
mutable name = value
})
Insert cell
moviesFiltered = movies.filter(d => genreSelection.includes(d.Genre)) // to filter by genre
.filter(d => monthSelection.includes(d.Month)) // to filter by month of release
.filter(d => yearSelection.includes(d.Year)) // to filter by year of release
.filter(d => awardcheckbox.includes(d.Award)) // to filter by award(s) received/or not
// .filter(d => movieSelection.includes(d.Movie_Name)) // to filter by brushed movies in jump_rating

// .filter(d => MPAAselect.includes(d.MPAA_Rating)) // to filter by MPAA rating
Insert cell
viewof table = printTable(moviesFiltered, [
{field: "Movie_Name", title: "Movie", align: "l"},
{field: "Director", title: "Director", align: "c"},
{field: "Year", title: "Year", align: 'r'},
])
Insert cell
viewof countries = checkbox(["USA", "UK", "Canada", "France", "Spain"])
Insert cell
countries
Insert cell
// countrySelection.addSignalListener("value", function(name, value) {
// if (value == null)
// mutable type6 = null
// else
// mutable type6 = value.Genre
// })
Insert cell
// countrySelection = {
// if(isEmpty(type)){
// return Array.from(new Set(movies.map(d => d.Country)))
// } else {
// return type6
// }
// }
Insert cell
// mutable type6 = null
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {jumpscares} from '@nussyr3/horror-movies-dataset'
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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